summaryrefslogtreecommitdiffstats
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:13 +0000
commitb574807e445480600e1ebaf8135068d0c407347e (patch)
tree312afff3ed4c037bf9e52d5fe69f9f5c6b7f8135
parent98a4cdc2a27cb5723ba3c01e64cee980691be2a4 (diff)
downloadpfsense-b574807e445480600e1ebaf8135068d0c407347e.zip
pfsense-b574807e445480600e1ebaf8135068d0c407347e.tar.gz
Correct behaviour of switching from console from any ppp type device to other type. This has been broken since new ppp code.
-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