summaryrefslogtreecommitdiffstats
path: root/etc/rc.initial.setlanip
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2008-02-25 05:09:32 +0000
committerScott Ullrich <sullrich@pfsense.org>2008-02-25 05:09:32 +0000
commite1454e42431f6dedde3a46a0d343cf817e4d2a91 (patch)
tree9014a52bf79b3b6141138836d970d4c0d55346dd /etc/rc.initial.setlanip
parent92d75c5ab784244f50ba3af611653ca9e371e5e9 (diff)
downloadpfsense-e1454e42431f6dedde3a46a0d343cf817e4d2a91.zip
pfsense-e1454e42431f6dedde3a46a0d343cf817e4d2a91.tar.gz
* Seperate prompt asking about DHCP server out to its own function.
* When configuring the lan IP, if the lan interface exist, correctly prompt if the admin would like to enable DHCP server.
Diffstat (limited to 'etc/rc.initial.setlanip')
-rwxr-xr-xetc/rc.initial.setlanip42
1 files changed, 23 insertions, 19 deletions
diff --git a/etc/rc.initial.setlanip b/etc/rc.initial.setlanip
index ea269c9..ca15724 100755
--- a/etc/rc.initial.setlanip
+++ b/etc/rc.initial.setlanip
@@ -34,6 +34,27 @@
require_once("config.inc");
require_once("functions.inc");
+ function prompt_for_enable_dhcp_server() {
+ global $config, $fp;
+ if($interface == "wan") {
+ if($config['interfaces'['lan'])
+ return "n";
+ }
+ /* only allow DHCP server to be enabled when static IP is
+ configured on this interface */
+ 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);
+ }
+ return $yn;
+ }
+
$fp = fopen('php://stdin', 'r');
$addr_blank = false;
@@ -118,25 +139,8 @@
$config['interfaces'][$interface]['ipaddr'] = $intip;
$config['interfaces'][$interface]['subnet'] = $intbits;
- if($interface <> "wan" || !$config['interfaces']['lan']) {
- /* 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";
- }
-
+ $yn = prompt_for_enable_dhcp_server();
+
// TODO: Add DHCP IPv6 support
if ($yn == "y") {
do {
OpenPOWER on IntegriCloud