diff options
author | Ermal <eri@pfsense.org> | 2010-07-27 20:39:07 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-07-27 20:39:07 +0000 |
commit | 6f9b154b80b393e62c76967426139173dbd1d7f6 (patch) | |
tree | d75e16b6ae10a8cc35c20730dd7c059765431992 | |
parent | 4a71c0873c237ecd4c6e50337b8550e3bb4184c2 (diff) | |
download | pfsense-6f9b154b80b393e62c76967426139173dbd1d7f6.zip pfsense-6f9b154b80b393e62c76967426139173dbd1d7f6.tar.gz |
Ticket #725. Before falling back to the default gw interface search even static routes. Also catch up with routing code on how to find the default gw.
-rw-r--r-- | etc/inc/services.inc | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 5efd274..198437f 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -501,12 +501,34 @@ function services_dhcrelay_configure() { $iflist = get_configured_interface_list(); foreach ($iflist as $ifname) { $subnet = get_interface_ip($ifname) . "/" . get_interface_subnet($ifname); - if (ip_in_subnet($dhcrelaycfg['server'],$subnet)) + if (ip_in_subnet($dhcrelaycfg['server'],$subnet)) { $destif = get_real_interface($ifname); + break; + } + } + if (!isset($destif)) { + if (is_array($config['staticroutes']['route'])) { + foreach ($config['staticroutes']['route'] as $rtent) { + if (ip_in_subnet($dhcrelaycfg['server'], $rtent['network'])) { + $a_gateways = return_gateways_array(true); + $destif = $a_gateways[$rtent['gateway']]['interface']; + break; + } + } + } } - if (!isset($destif)) - $destif = $config['interfaces']['wan']['if']; + if (!isset($destif)) { + if (is_array($config['gateways']['gateway_item'])) { + foreach ($config['gateways']['gateway_item'] as $gateway) { + if (isset($gateway['defaultgw'])) { + $a_gateways = return_gateways_array(true); + $destif = $a_gateways[$rtent['gateway']]['interface']; + } + } + } else + $destif = get_real_interface("wan"); + } $dhcrelayifs[] = $destif; $dhcrelayifs = array_unique($dhcrelayifs); @@ -1265,4 +1287,4 @@ function upnp_start() { } } -?>
\ No newline at end of file +?> |