diff options
author | Scott Ullrich <sullrich@sullrich-MacBookPro.local> | 2009-02-14 19:45:37 -0500 |
---|---|---|
committer | Scott Ullrich <sullrich@sullrich-MacBookPro.local> | 2009-02-14 19:45:37 -0500 |
commit | b24bda0840cc8eb238f26cabfff4e849ccbdb96d (patch) | |
tree | 2fb114b98d3c2a94fafba7030cfd28ac77bda332 | |
parent | ac5a4b83196eb41a7b4847f3340156e92fa2eebf (diff) | |
download | pfsense-b24bda0840cc8eb238f26cabfff4e849ccbdb96d.zip pfsense-b24bda0840cc8eb238f26cabfff4e849ccbdb96d.tar.gz |
Back out simoncpu's IPV6 code, it breaks IPV4.
-rw-r--r-- | etc/inc/system.inc | 119 |
1 files changed, 29 insertions, 90 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 597748d..d4d2415 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -218,14 +218,9 @@ function system_routing_configure() { return 1; } while (!feof($fd)) { - $oldrt = fgets($fd); - if ($oldrt && stristr($route_str, trim($oldrt))) { - if (Net_IPv6::checkIPv6(trim($oldrt))) { - mwexec("/sbin/route delete -inet6 " . escapeshellarg(trim($oldrt))); - } else { - mwexec("/sbin/route delete " . escapeshellarg(trim($oldrt))); - } - } + $oldrt = trim(fgets($fd)); + if (($oldrt) && (stristr($route_str, $oldrt))) + mwexec("/sbin/route delete " . escapeshellarg($oldrt)); } fclose($fd); unlink("{$g['vardb_path']}/routes.db"); @@ -234,21 +229,19 @@ function system_routing_configure() { /* if list */ $iflist = get_configured_interface_list(); - $dont_remove_route = false; - foreach ($iflist as $ifent => $ifname) { - /* do not process interfaces that will end up with gateways */ - if (interface_has_gateway($ifent)) - $dont_remove_route = true; - } + $dont_remove_route = false; + foreach ($iflist as $ifent => $ifname) { + /* do not process interfaces that will end up with gateways */ + if (interface_has_gateway($ifent)) + $dont_remove_route = true; + } - if($config['interfaces']['wan']['ipaddr'] == "carpdev-dhcp") { + if($config['interfaces']['wan']['ipaddr'] == "carpdev-dhcp") $dont_remove_route = true; - } if($dont_remove_route == false) { - /* remove default routes */ - mwexec("/sbin/route delete default"); - mwexec("/sbin/route delete -inet6 default"); + /* remove default route */ + mwexec("/sbin/route delete default", true); } $dont_add_route = false; @@ -263,41 +256,14 @@ function system_routing_configure() { if($dont_add_route == false) { if(is_array($config['gateways']['gateway_item'])) { - $gatewayip = ''; - $interfacegw = ''; - - $gatewayip_ipv6 = ''; - $interfacegw_ipv6 = ''; - foreach($config['gateways']['gateway_item'] as $gateway) { if(isset($gateway['defaultgw'])) { - if ($gateway['type'] == 'IPv4') { - $gatewayip = $gateway['gateway']; - $interfacegw = $gateway['interface']; - } else if ($gateway['type'] == 'IPv6') { - $gatewayip_ipv6 = $gateway['gateway']; - $interfacegw_ipv6 = $gateway['interface']; - } - } - } - - if($interfacegw != "bgpd") { - /* - if (Net_IPv6::checkIPv6($gatewayip)) { - mwexec("/sbin/route add -inet6 default " . escapeshellarg($gatewayip)); - } else { - mwexec("/sbin/route add default " . escapeshellarg($gatewayip)); - } - */ - - if ($gatewayip != '') { - mwexec("/sbin/route add default " . escapeshellarg($gatewayip), true); - } - - if ($gatewayip_ipv6 != '') { - mwexec("/sbin/route add -inet6 default " . escapeshellarg($gatewayip_ipv6), true); + $gatewayip = $gateway['gateway']; + $interfacegw = $gateway['interface']; } } + if(($interfacegw <> "bgpd") && (is_ipaddr($gatewayip))) + mwexec("/sbin/route add default " . escapeshellarg($gatewayip), true); } else { /* FIXME */ /* adding gateway for 1.2-style configs without the new @@ -309,11 +275,6 @@ function system_routing_configure() { $gatewayip = $config['interfaces']['wan']['gateway']; mwexec("/sbin/route add default " . escapeshellarg($gatewayip), true); } - - if (Net_IPv6::checkIPv6($config['interfaces']['wan']['gateway_ipv6'])) { - $gatewayip = $config['interfaces']['wan']['gateway_ipv6']; - mwexec("/sbin/route add -inet6 default " . escapeshellarg($gatewayip), true); - } } } @@ -334,42 +295,19 @@ function system_routing_configure() { } } } - - if ($rtent['ip_version'] == 'IPv4') { - if(is_ipaddr($rtent['gateway']) && $gatewayip == "") { - $gatewayip = $rtent['gateway']; - $interfacegw = $rtent['interface']; - } - - if(isset($rtent['interfacegateway'])) { - mwexec("/sbin/route add " . escapeshellarg($rtent['network']) . - " -iface " . escapeshellarg(convert_friendly_interface_to_real_interface_name($interfacegw))); - } else { - mwexec("/sbin/route add " . escapeshellarg($rtent['network']) . - " " . escapeshellarg($gatewayip)); - } - - /* record route so it can be easily removed later (if necessary) */ - fwrite($fd, $rtent['network'] . "\n"); - } else if ($rtent['ip_version'] == 'IPv6') { - /// - if(Net_IPv6::checkIPv6($rtent['gateway']) && $gatewayip == "") { - $gatewayip = $rtent['gateway']; - $interfacegw = $rtent['interface']; - } - - if(isset($rtent['interfacegateway'])) { - mwexec("/sbin/route add -inet6 " . escapeshellarg($rtent['network']) . - " -iface " . escapeshellarg(convert_friendly_interface_to_real_interface_name($interfacegw))); - } else { - mwexec("/sbin/route add -inet6 " . escapeshellarg($rtent['network']) . - " " . escapeshellarg($gatewayip)); - } - - /* record route so it can be easily removed later (if necessary) */ - fwrite($fd, $rtent['network'] . "\n"); + if((is_ipaddr($rtent['gateway'])) && ($gatewayip == "")) { + $gatewayip = $rtent['gateway']; + $interfacegw = $rtent['interface']; + } + if(isset($rtent['interfacegateway'])) { + mwexec("/sbin/route add " . escapeshellarg($rtent['network']) . + " -iface " . escapeshellarg(convert_friendly_interface_to_real_interface_name($interfacegw))); + } else { + mwexec("/sbin/route add " . escapeshellarg($rtent['network']) . + " " . escapeshellarg($gatewayip)); } - + /* record route so it can be easily removed later (if necessary) */ + fwrite($fd, $rtent['network'] . "\n"); } fclose($fd); } @@ -377,6 +315,7 @@ function system_routing_configure() { return 0; } + function system_routing_enable() { global $config, $g; $retval = false; |