diff options
author | Ermal <eri@pfsense.org> | 2011-09-12 11:46:13 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2011-09-12 11:46:29 +0000 |
commit | aab5f04c47c4f487255a473457c51f5ab570c178 (patch) | |
tree | d19c069010f50add5ae6ae728e37811afb6d8239 /etc | |
parent | ae0023beeaa0da21cf2080e81cec9631bee63c8e (diff) | |
download | pfsense-aab5f04c47c4f487255a473457c51f5ab570c178.zip pfsense-aab5f04c47c4f487255a473457c51f5ab570c178.tar.gz |
Correct behaviour of switching from console from any ppp type device to other type. This has been broken since new ppp code.
Diffstat (limited to 'etc')
-rwxr-xr-x | etc/rc.initial.setlanip | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/etc/rc.initial.setlanip b/etc/rc.initial.setlanip index fd60d6a..e74313f 100755 --- a/etc/rc.initial.setlanip +++ b/etc/rc.initial.setlanip @@ -37,6 +37,21 @@ require_once("shaper.inc"); require_once("rrd.inc"); + function console_get_interface_from_ppp($realif) { + global $config; + + if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) { + foreach ($config['ppps']['ppp'] as $pppid => $ppp) { + if ($realif == $ppp['if']) { + $ifaces = explode(",", $ppp['ports']); + return $ifaces[0]; + } + } + } + + return ""; + } + function prompt_for_enable_dhcp_server() { global $config, $fp, $interface; if($interface == "wan") { @@ -98,14 +113,17 @@ echo "Invalid interface!\n"; exit; } - + + $ifaceassigned = ""; do { - if($interface == "wan") { $upperifname = strtoupper($interface); echo gettext("Configure {$upperifname} interface via DHCP? [y|n]") . "\n> "; $intdhcp = chop(fgets($fp)); if(strtolower($intdhcp) == "y" || strtolower($intdhcp) == "yes") { + $ifppp = console_get_interface_from_ppp(get_real_interface("wan")); + if (!empty($ifppp)) + $ifaceassigned = $ifppp; $intip = "dhcp"; $intbits = ""; $isintdhcp = true; @@ -131,12 +149,17 @@ $intbits = chop(fgets($fp)); $restart_dhcpd = true; } while (!is_numeric($intbits) || ($intbits < 1) || ($intbits > 31)); - } + } + $ifppp = console_get_interface_from_ppp(get_real_interface("wan")); + if (!empty($ifppp)) + $ifaceassigned = $ifppp; } } while ($addr_blank); + if (!empty($ifaceassigned)) + $config['interfaces'][$interface]['if'] = $ifaceassigned; $config['interfaces'][$interface]['ipaddr'] = $intip; $config['interfaces'][$interface]['subnet'] = $intbits; $config['interfaces'][$interface]['enable'] = true; |