summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
Diffstat (limited to 'etc/inc')
-rw-r--r--etc/inc/interfaces.inc30
-rw-r--r--etc/inc/system.inc12
2 files changed, 38 insertions, 4 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index d86b20e..c31e259 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -2034,7 +2034,20 @@ EOD;
set iface name {$realif}
EOD;
- if ($interface == "wan")
+ $setdefaultgw = false;
+ $founddefaultgw = false;
+ if (is_array($config['gateways']['gateway_item'])) {
+ foreach($config['gateways']['gateway_item'] as $gateway) {
+ if($interface == $gateway['interface'] && isset($gateway['defaultgw'])) {
+ $setdefaultgw = true;
+ break;
+ } else if (isset($gateway['defaultgw'])) {
+ $founddefaultgw = true;
+ break;
+ }
+ }
+ }
+ if (($interface == "wan" && $founddefaultgw == false) || $setdefaultgw == true)
$mpdconf .= <<<EOD
set iface route default
@@ -2183,7 +2196,20 @@ EOD;
set iface name {$realif}
EOD;
- if ($interface == "wan")
+ $setdefaultgw = false;
+ $founddefaultgw = false;
+ if (is_array($config['gateways']['gateway_item'])) {
+ foreach($config['gateways']['gateway_item'] as $gateway) {
+ if($interface == $gateway['interface'] && isset($gateway['defaultgw'])) {
+ $setdefaultgw = true;
+ break;
+ } else if (isset($gateway['defaultgw'])) {
+ $founddefaultgw = true;
+ break;
+ }
+ }
+ }
+ if (($interface == "wan" && $founddefaultgw == false) || $setdefaultgw == true)
$mpdconf .= <<<EOD
set iface route default
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index 4f194be..c5329f2 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -314,6 +314,10 @@ function system_routing_configure() {
if(isset($gateway['defaultgw'])) {
$gatewayip = $gateway['gateway'];
$interfacegw = $gateway['interface'];
+ /* This handles the case where a dynamic gateway is choosen as default. */
+ if (!is_ipaddr($gatewayip))
+ $gatewayip = get_interface_gateway($interfacegw);
+ break;
}
}
if(($interfacegw <> "bgpd") && (is_ipaddr($gatewayip))) {
@@ -353,13 +357,17 @@ function system_routing_configure() {
if($rtent['gateway'] == $gateway['name']) {
$gatewayip = $gateway['gateway'];
$interfacegw = $gateway['interface'];
+ /* This handles the case where a dynamic gateway is choosen. */
+ if (!is_ipaddr($gatewayip))
+ $gatewayip = get_interface_gateway($interfacegw);
+ break;
}
}
}
- if((is_ipaddr($rtent['gateway'])) && ($gatewayip == "")) {
+ if((is_ipaddr($rtent['gateway'])) && empty($gatewayip)) {
$gatewayip = $rtent['gateway'];
$interfacegw = $rtent['interface'];
- }
+ }
if((isset($rtent['interfacegateway'])) && (! is_ipaddr($gatewayip))) {
mwexec("/sbin/route add " . escapeshellarg($rtent['network']) .
" -iface " . escapeshellarg(convert_friendly_interface_to_real_interface_name($interfacegw)));
OpenPOWER on IntegriCloud