summaryrefslogtreecommitdiffstats
path: root/etc/inc/gwlb.inc
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-04-25 08:28:15 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-04-25 08:28:15 -0300
commit65cfd0ca74d661b069344b0ddc65d622702ae3e6 (patch)
tree3cdf28de422e692256786765c468c36a88e4e6d5 /etc/inc/gwlb.inc
parente52df814ea7dfeaafe8f302d7f99b394e06811a3 (diff)
downloadpfsense-65cfd0ca74d661b069344b0ddc65d622702ae3e6.zip
pfsense-65cfd0ca74d661b069344b0ddc65d622702ae3e6.tar.gz
Deduplicate and simplify code
Diffstat (limited to 'etc/inc/gwlb.inc')
-rw-r--r--etc/inc/gwlb.inc56
1 files changed, 12 insertions, 44 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index 50eabc1..e3cfd39 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -371,55 +371,23 @@ function return_gateways_array($disabled = false, $localhost = false) {
if (empty($gateway['gateway']) || $gateway['gateway'] == "dynamic") {
if ($gateway['ipprotocol'] == "inet") {
/* we know which interfaces is dynamic, this should be made a function */
- switch($wancfg['ipaddr']) {
- case "dhcp":
- case "pppoe":
- case "pptp":
- case "ppp":
- $gateway['ipprotocol'] = "inet";
- $gateway['gateway'] = get_interface_gateway($gateway['interface']);
- /* no IP address found, set to dynamic */
- if (!is_ipaddrv4($gateway['gateway']))
- $gateway['gateway'] = "dynamic";
- $gateway['dynamic'] = true;
- break;
- default:
- $gateway['ipprotocol'] = "inet";
- $gateway['gateway'] = get_interface_gateway($gateway['interface']);
- /* no IP address found, set to dynamic */
- if (!is_ipaddrv4($gateway['gateway']))
- $gateway['gateway'] = "dynamic";
- $gateway['dynamic'] = true;
- break;
- }
+ $gateway['ipprotocol'] = "inet";
+ $gateway['gateway'] = get_interface_gateway($gateway['interface']);
+ /* no IP address found, set to dynamic */
+ if (!is_ipaddrv4($gateway['gateway']))
+ $gateway['gateway'] = "dynamic";
+ $gateway['dynamic'] = true;
}
/* if the gateway is dynamic6 and we can find the IPv6, Great! */
if ($gateway['ipprotocol'] == "inet6") {
/* we know which interfaces is dynamic, this should be made a function, and for v6 too */
- switch($wancfg['ipaddrv6']) {
- case "6rd":
- case "6to4":
- case "dhcp6":
- case "pppoe":
- case "pptp":
- case "ppp":
- $gateway['ipprotocol'] = "inet6";
- $gateway['gateway'] = get_interface_gateway_v6($gateway['interface']);
- /* no IPv6 address found, set to dynamic6 */
- if (!is_ipaddrv6($gateway['gateway']))
- $gateway['gateway'] = "dynamic6";
- $gateway['dynamic'] = true;
- break;
- default:
- $gateway['ipprotocol'] = "inet6";
- $gateway['gateway'] = get_interface_gateway_v6($gateway['interface']);
- /* no IPv6 address found, set to dynamic6 */
- if (!is_ipaddrv6($gateway['gateway']))
- $gateway['gateway'] = "dynamic6";
- $gateway['dynamic'] = true;
- break;
- }
+ $gateway['ipprotocol'] = "inet6";
+ $gateway['gateway'] = get_interface_gateway_v6($gateway['interface']);
+ /* no IPv6 address found, set to dynamic6 */
+ if (!is_ipaddrv6($gateway['gateway']))
+ $gateway['gateway'] = "dynamic6";
+ $gateway['dynamic'] = true;
}
} else {
/* getting this detection right is hard at this point because we still don't
OpenPOWER on IntegriCloud