From e5ac67edfd8366e7ebd73c1ece0e164dff8f23d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=E7i?= Date: Thu, 17 Dec 2009 11:01:14 +0000 Subject: [PATCH] Correctly reconfigure vips when the underlying/parent interface gets reconfigured. --- etc/inc/interfaces.inc | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 4b1d7a76b8..36a739f5a2 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -1076,7 +1076,7 @@ function interface_proxyarp_configure() { } -function interfaces_vips_configure() { +function interfaces_vips_configure($interface = "") { global $g, $config; if(isset($config['system']['developerspew'])) { $mt = microtime(); @@ -1085,15 +1085,23 @@ function interfaces_vips_configure() { $paa = array(); if(is_array($config['virtualip']['vip'])) { $carp_setuped = false; + $anyproxyarp = false; foreach ($config['virtualip']['vip'] as $vip) { switch ($vip['mode']) { case "proxyarp": /* nothing it is handled on interface_proxyarp_configure() */ + if ($interface <> "" && $vip['interface'] <> $interface) + continue; + $anyproxyarp = true; break; case "ipalias": + if ($interface <> "" && $vip['interface'] <> $interface) + continue; interface_ipalias_configure(&$vip); break; case "carp": + if ($interface <> "" && $vip['interface'] <> $interface) + continue; if ($carp_setuped == false) { interfaces_carp_setup(); $carp_setuped = true; @@ -1101,12 +1109,15 @@ function interfaces_vips_configure() { interface_carp_configure($vip); break; case "carpdev-dhcp": + if ($interface <> "" && $vip['interface'] <> $interface) + continue; interface_carpdev_configure($vip); break; } } - interface_proxyarp_configure(); + if ($anyproxyarp == true) + interface_proxyarp_configure(); } } @@ -1727,6 +1738,9 @@ function interface_configure($interface = "wan", $reloadall = false) { interface_bridge_configure($bridge); } + if (link_interface_to_vip($interface)) + interfaces_vips_configure($interface); + if ($interface == "lan") /* make new hosts file */ system_hosts_generate(); @@ -2522,6 +2536,15 @@ function link_ip_to_carp_interface($ip) { return $carp_ints; } +function link_interface_to_vips($int) { + global $config; + + if (is_array($config['virtualip']['vip'])) + foreach ($config['virtualip']['vip'] as $vip) + if($int == $vip['interface']) + return $vip; +} + /****f* interfaces/link_interface_to_bridge * NAME * link_interface_to_bridge - Finds out a bridge group for an interface