diff options
author | Chris Buechler <cmb@pfsense.org> | 2008-02-22 09:24:35 +0000 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2008-02-22 09:24:35 +0000 |
commit | 8e2a7e8a28d893c287afc69538e7fdb30002ba86 (patch) | |
tree | 0e1dd2c7640d6bb59bbbe1f7f887623a78a1c734 | |
parent | d01ccca84144a05c0b2ae830295433ee908bfcf5 (diff) | |
download | pfsense-8e2a7e8a28d893c287afc69538e7fdb30002ba86.zip pfsense-8e2a7e8a28d893c287afc69538e7fdb30002ba86.tar.gz |
Do not allow enabling of DHCP server on dynamic IP interfaces (fixed in HEAD in last commit)
added a couple TODO items to fix later
Single interface support
Appliance Project
-rwxr-xr-x | etc/rc.initial.setlanip | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/etc/rc.initial.setlanip b/etc/rc.initial.setlanip index 066334d..ea269c9 100755 --- a/etc/rc.initial.setlanip +++ b/etc/rc.initial.setlanip @@ -119,14 +119,20 @@ $config['interfaces'][$interface]['subnet'] = $intbits; if($interface <> "wan" || !$config['interfaces']['lan']) { - do { - $good = false; - $upperifname = strtoupper($interface); - echo "\n" . gettext("Do you want to enable the DHCP server on {$upperifname}? [y|n]") . " "; - $yn = strtolower(chop(fgets($fp))); - if ($yn[0] == "y" or $yn[0] == "n") - $good = true; - } while (!$good); + /* only allow DHCP server to be enabled when static IP is + configured on this interface */ + /* TODO: is this inadequate because the new config isn't written + out yet at this point? */ + if (is_ipaddr($config['interfaces']['$interface']['ipaddr'])) { + do { + $good = false; + $upperifname = strtoupper($interface); + echo "\n" . gettext("Do you want to enable the DHCP server on {$upperifname}? [y|n]") . " "; + $yn = strtolower(chop(fgets($fp))); + if ($yn[0] == "y" or $yn[0] == "n") + $good = true; + } while (!$good); + } } else { $yn = "n"; } @@ -155,6 +161,9 @@ $config['dhcpd'][$interface]['range']['from'] = $dhcpstartip; $config['dhcpd'][$interface]['range']['to'] = $dhcpendip; } else { + /* TODO - this line is causing a "Fatal error: Cannot unset + string offsets in /etc/rc.initial.setlanip" on below line + number */ unset($config['dhcpd'][$interface]['enable']); } |