summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsmos <seth.mos@dds.nl>2012-04-16 10:03:02 +0200
committersmos <seth.mos@dds.nl>2012-04-16 10:03:02 +0200
commitc08a5659d872e0f701a074d7fe6450f4d221e6b6 (patch)
tree9132033c1d17b50334c297ccce2857b9b34d544f
parent01a58d89dad177807a90a09de9bbcc39058213f2 (diff)
downloadpfsense-c08a5659d872e0f701a074d7fe6450f4d221e6b6.zip
pfsense-c08a5659d872e0f701a074d7fe6450f4d221e6b6.tar.gz
Only add the IPv4 gateway in the DHCPv4 config if we have a IPv4 gateway defined on the system at all.
This makes clients trying the IPv4 transport fail a lot faster, and thus more graceful.
-rw-r--r--etc/inc/services.inc23
1 files changed, 20 insertions, 3 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index 262df75..cfe028e 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -372,6 +372,16 @@ EOD;
$dhcpdconf .= "always-broadcast on\n";
$dhcpdifs = array();
+ $add_routers = false;
+ $gateways_arr = return_gateways_array();
+ /* only add a routers line if the system has any IPv4 gateway at all */
+ /* a static route has a gateway, manually overriding this field always works */
+ foreach($gateways_arr as $gwitem) {
+ if($gwitem['ipprotocol'] == "inet") {
+ $add_routers = true;
+ break;
+ }
+ }
/* loop through and determine if we need to setup
* failover peer "bleh" entries
@@ -499,10 +509,12 @@ EOPP;
if (isset($dhcpifconf['denyunknown']))
$dhcpdconf .= " deny unknown-clients;\n";
- if ($dhcpifconf['gateway'])
+ if ($dhcpifconf['gateway']) {
$routers = $dhcpifconf['gateway'];
- else
+ $add_routers = true;
+ } else {
$routers = $ifcfgip;
+ }
if($dhcpifconf['failover_peerip'] <> "") {
$dhcpdconf .= " failover peer \"dhcp{$dhcpnum}\";\n";
@@ -512,7 +524,12 @@ EOPP;
$dhcpdconf .= <<<EOD
range {$dhcpifconf['range']['from']} {$dhcpifconf['range']['to']};
}
- option routers {$routers};
+
+EOD;
+
+ if($add_routers)
+ $dhcpdconf .= " option routers {$routers};\n";
+ $dhcpdconf .= <<<EOD
$dnscfg
EOD;
OpenPOWER on IntegriCloud