diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-05-22 12:18:30 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-05-27 07:03:44 -0300 |
commit | 046583c3c930d26a6a6b9ddb842d208d52f80e4d (patch) | |
tree | 4c0b1aeefaef75459af4eaf63c79a3effdcec2f1 /etc | |
parent | 5b409e07c0b899b9974a6f40598cf7de50c4286a (diff) | |
download | pfsense-046583c3c930d26a6a6b9ddb842d208d52f80e4d.zip pfsense-046583c3c930d26a6a6b9ddb842d208d52f80e4d.tar.gz |
Simplify logic
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/system.inc | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc index f6b472e..be05f94 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -474,21 +474,15 @@ function system_routing_configure($interface = "") { if (!strcasecmp("Null", substr($rtent['gateway'], 0, 3))) $blackhole = "-blackhole"; - if (is_subnetv6($rtent['network'])) { - if (is_ipaddrv6($gatewayip)) - mwexec("/sbin/route change -inet6 {$blackhole} " . escapeshellarg($rtent['network']) . - " " . escapeshellarg($gatewayip)); - else if (!empty($interfacegw)) - mwexec("/sbin/route change -inet6 {$blackhole} " . escapeshellarg($rtent['network']) . - " -iface " . escapeshellarg($interfacegw)); - } else if (is_subnetv4($rtent['network'])) { - if (is_ipaddrv4($gatewayip)) - mwexec("/sbin/route change -inet {$blackhole} " . escapeshellarg($rtent['network']) . - " " . escapeshellarg($gatewayip)); + $inet = (is_subnetv6($rtent['network']) ? "-inet6" : "-inet"); + + $cmd = "/sbin/route change {$inet} {$blackhole} " . escapeshellarg($rtent['network']) . " "; + + if (is_subnet($rtent['network'])) + if (is_ipaddr($gatewayip)) + mwexec($cmd . escapeshellarg($gatewayip)); else if (!empty($interfacegw)) - mwexec("/sbin/route change -inet {$blackhole} " . escapeshellarg($rtent['network']) . - " -iface " . escapeshellarg($interfacegw)); - } + mwexec($cmd . "-iface " . escapeshellarg($interfacegw)); } unset($gateways_arr); } |