diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 52478f5482..004f2b37b9 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -2355,7 +2355,7 @@ function interface_configure($interface = "wan", $reloadall = false) { if ($reloadall == true) { /* reconfigure static routes (kernel may have deleted them) */ - system_routing_configure(); + system_routing_configure($interface); /* reload ipsec tunnels */ vpn_ipsec_configure(); diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 9a0d054f9e..ac8fa371f2 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -260,7 +260,7 @@ function system_hostname_configure() { return $status; } -function system_routing_configure() { +function system_routing_configure($interface = "") { global $config, $g; if(isset($config['system']['developerspew'])) { $mt = microtime(); @@ -322,8 +322,10 @@ function system_routing_configure() { $route_arr[$items[0]] = array($items[0], $items[1], $items[5]); } - if ($dont_add_route == false) { - if (($interfacegw <> "bgpd") && (is_ipaddr($gatewayip))) { + if ($dont_add_route == false ) { + if (!empty($interface) && $inteface != $interafegw) + ; + else if (($interfacegw <> "bgpd") && (is_ipaddr($gatewayip))) { $action = "add"; if(isset($route_arr['default'])) { $action = "change"; @@ -345,6 +347,8 @@ function system_routing_configure() { $gateways_arr = return_gateways_array(); foreach ($config['staticroutes']['route'] as $rtent) { + if (!empty($interface) && $interface != $rtent['interface']) + continue; $gatewayip = ""; if (isset($gateways_arr[$rtent['gateway']])) { $gatewayip = $gateways_arr[$rtent['gateway']]['gateway'];