diff options
author | Ermal <eri@pfsense.org> | 2013-03-18 15:28:38 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2013-03-18 15:28:38 +0000 |
commit | e9d156fd1b9620b72ebfc8e875a1d4d689a14734 (patch) | |
tree | 345ab37a3f1879034a7c8f9f2a0f379bedbb1199 /etc | |
parent | 909de4007e44529095aee760645918a6da12c9f7 (diff) | |
download | pfsense-e9d156fd1b9620b72ebfc8e875a1d4d689a14734.zip pfsense-e9d156fd1b9620b72ebfc8e875a1d4d689a14734.tar.gz |
If gatway is dynamic the type cannot be determined, trim the code trying to do something impossible. While here optimize a bit
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/gwlb.inc | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 112d0f6..ce4c317 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -161,8 +161,9 @@ EOD; /* Interface ip is needed since apinger will bind a socket to it. */ if (is_ipaddrv4($gateway['gateway'])) { $gwifip = find_interface_ip($gateway['interface'], true); - } - if (is_ipaddrv6($gateway['gateway'])) { + if (!is_ipaddrv4($gwifip)) + continue; //Skip this target + } else if (is_ipaddrv6($gateway['gateway'])) { /* link locals really need a different src ip */ if(preg_match("/fe80::/i", $gateway['gateway'])) { $linklocal = explode("%", find_interface_ipv6_ll($gateway['interface'], true)); @@ -171,9 +172,10 @@ EOD; } else { $gwifip = find_interface_ipv6($gateway['interface'], true); } - } - if (!is_ipaddr($gwifip)) - continue; //Skip this target + if (!is_ipaddrv6($gwifip)) + continue; //Skip this target + } else + continue; $monitor_ips[] = monitor_ips; $apingercfg = "target \"{$gateway['monitor']}\" {\n"; @@ -363,20 +365,8 @@ function return_gateways_array($disabled = false, $localhost = false) { * store the address family in the gateway item */ if(is_ipaddrv4($gateway['gateway'])) $gateway['ipprotocol'] = "inet"; - if(is_ipaddrv6($gateway['gateway'])) + else 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")) { @@ -407,6 +397,9 @@ function return_gateways_array($disabled = false, $localhost = false) { case "6rd": case "6to4": case "dhcp6": + case "pppoe": + case "pptp": + case "ppp": $gateway['ipprotocol'] = "inet6"; $gateway['gateway'] = get_interface_gateway_v6($gateway['interface']); if($gateway['gateway'] == "dynamic6") { |