From f60003faf1343a532f52a3f03a5e9c6687b470e3 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 27 Feb 2014 18:54:51 -0800 Subject: Return GWG IP protocol (version) when no gateway IP This is a resubmit of an older pull request I had closed. It came up again in the forum, with a user setting up a VM environment and wondering why he cannot make policy-routing rules to a gateway group. The gateway group names did not display because all his WANs were down at the time and so the existing code was too dumb to determine the IP protocol (version 4 or 6) when none of the WANs in the gateway group actually have an IP address yet. --- etc/inc/gwlb.inc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'etc/inc') diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 27271d7..faf2a00 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -827,15 +827,17 @@ function return_gateway_groups_array() { else if (!empty($int)) $gatewayip = get_interface_gateway($gateway['friendlyiface']); - if (!empty($int) && is_ipaddr($gatewayip)) { - $groupmember = array(); - $groupmember['int'] = $int; - $groupmember['gwip'] = $gatewayip; - $groupmember['weight'] = isset($gateway['weight']) ? $gateway['weight'] : 1; - if (is_array($gwvip_arr[$group['name']])&& !empty($gwvip_arr[$group['name']][$member])) - $groupmember['vip'] = $gwvip_arr[$group['name']][$member]; + if (!empty($int)) { $gateway_groups_array[$group['name']]['ipprotocol'] = $gateway['ipprotocol']; - $gateway_groups_array[$group['name']][] = $groupmember; + if (is_ipaddr($gatewayip)) { + $groupmember = array(); + $groupmember['int'] = $int; + $groupmember['gwip'] = $gatewayip; + $groupmember['weight'] = isset($gateway['weight']) ? $gateway['weight'] : 1; + if (is_array($gwvip_arr[$group['name']])&& !empty($gwvip_arr[$group['name']][$member])) + $groupmember['vip'] = $gwvip_arr[$group['name']][$member]; + $gateway_groups_array[$group['name']][] = $groupmember; + } } } } -- cgit v1.1