From 1ea67f2ef911e614c08c1b4804f35c64fdbed001 Mon Sep 17 00:00:00 2001 From: Ermal Date: Fri, 18 Jun 2010 18:46:06 +0000 Subject: [PATCH] Also teach system_routing_configure to have an interface as parameter so to reload only routes related to this interface when an interface is reconfigured. --- etc/inc/interfaces.inc | 2 +- etc/inc/system.inc | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) 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'];