From e02caf4ab97b993a62e81c5002bd0581165e4a64 Mon Sep 17 00:00:00 2001 From: smos Date: Fri, 1 Jun 2012 07:41:15 +0200 Subject: Actually save the IPprotocol variable into the config, otherwise it stil won't work. People will likely need to edit and save their gateways now if they have double entries. e.g. both manual and automatically added entries, these will dissapear as soon as you save. If we know if the gateway or monitor is ipv4 or ipv6 we can autodetect which prevents this. Because we don't know what address family the gateway on a dual stack interface belongs to we better not guess, and let the user figure it out. Often, a edit and save is the fastest. For upgrading from 2.0 we could mark all gateways as being ipv4 which prevents half of the issues. Redmine ticket #2463 --- etc/inc/gwlb.inc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'etc/inc') diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index a3cbe41..68b3e48 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -340,7 +340,6 @@ function return_gateways_array($disabled = false) { continue; $wancfg = $config['interfaces'][$gateway['interface']]; - /* getting this detection right is hard at this point because we still don't * store the address family in the gateway item */ if(is_ipaddrv4($gateway['gateway'])) @@ -348,13 +347,18 @@ function return_gateways_array($disabled = false) { if(is_ipaddrv6($gateway['gateway'])) $gateway['ipprotocol'] = "inet6"; if((preg_match("/dynamic/i", $gateway['gateway'])) && (!isset($gateway['ipprotocol']))) { + if(is_ipaddrv4($gateway['gateway'])) + $gateway['ipprotocol'] = "inet"; + if(is_ipaddrv6($gateway['gateway'])) + $gateway['ipprotocol'] = "inet6"; + } + if((preg_match("/dynamic/i", $gateway['monitor'])) && (!isset($gateway['ipprotocol']))) { if(is_ipaddrv4($gateway['monitor'])) $gateway['ipprotocol'] = "inet"; if(is_ipaddrv6($gateway['monitor'])) $gateway['ipprotocol'] = "inet6"; } - /* if the gateway is dynamic and we can find the IPv4, Great! */ if(empty($gateway['gateway']) || ($gateway['gateway'] == "dynamic") && ($gateway['ipprotocol'] == "inet")) { /* we know which interfaces is dynamic, this should be made a function */ -- cgit v1.1