diff options
author | Ermal <eri@pfsense.org> | 2010-05-31 19:14:29 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-05-31 19:14:29 +0000 |
commit | 924f202ee818c72b10855d3a1c06b34a9e7aa595 (patch) | |
tree | 7c21bb5ebd72f07849c9438f046fd859578528cb /etc/inc/system.inc | |
parent | 1fb059612c78c034fc77ff98085576625c1d3324 (diff) | |
download | pfsense-924f202ee818c72b10855d3a1c06b34a9e7aa595.zip pfsense-924f202ee818c72b10855d3a1c06b34a9e7aa595.tar.gz |
Fixes #622. Add a new file status for signaling default gateway under /tmp. dhclient script will check for this file to define if the interface needs a default gateway or not from its given routes.
Diffstat (limited to 'etc/inc/system.inc')
-rw-r--r-- | etc/inc/system.inc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 6281a14..75e3f6d 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -263,15 +263,29 @@ function system_routing_configure() { $interfacegw = ""; /* tack on all the hard defined gateways as well */ if (is_array($config['gateways']['gateway_item'])) { + mwexec("/bin/rm {$g['tmp_path']}/*_defaultgw"); + $foundgw = false; foreach ($config['gateways']['gateway_item'] as $gateway) { if (isset($gateway['defaultgw'])) { if ($gateway['gateway'] == "dynamic") $gateway['gateway'] = get_interface_gateway($gateway['interface']); $gatewayip = $gateway['gateway']; $interfacegw = $gateway['interface']; + if (!empty($interfacegw)) { + $defaultif = get_real_interface($gateway['interface']); + if ($defaultif) + @file_put_contents("{$g['tmp_path']}/{$defaultif}_defaultgw", $gatewayip); + } + $foundgw = true; break; } } + if ($foundgw == false) { + $defaultif = get_real_interface("wan"); + $interfacegw = "wan"; + $gatewayip = get_interface_gateway("wan"); + @touch("{$g['tmp_path']}/{$defaultif}_defaultgw"); + } } $dont_add_route = false; /* if OLSRD is enabled, allow WAN to house DHCP. */ @@ -1418,4 +1432,4 @@ function system_get_dmesg_boot() { return file_get_contents("{$g['varlog_path']}/dmesg.boot"); } -?>
\ No newline at end of file +?> |