summaryrefslogtreecommitdiffstats
path: root/etc/rc.initial.setlanip
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2011-09-12 11:46:13 +0000
committerErmal <eri@pfsense.org>2011-09-12 11:46:29 +0000
commitaab5f04c47c4f487255a473457c51f5ab570c178 (patch)
treed19c069010f50add5ae6ae728e37811afb6d8239 /etc/rc.initial.setlanip
parentae0023beeaa0da21cf2080e81cec9631bee63c8e (diff)
downloadpfsense-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/rc.initial.setlanip')
-rwxr-xr-xetc/rc.initial.setlanip29
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;
OpenPOWER on IntegriCloud