diff options
author | Ermal <eri@pfsense.org> | 2011-07-25 17:56:25 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2011-07-25 17:56:25 +0000 |
commit | b368b35a6751d5b29c17ba1c5ec29fdd4a4861d1 (patch) | |
tree | fc0ffb907f7435b6321a6821d9d258089cd3b412 /etc/inc/system.inc | |
parent | 6813d6e7cff0d488c489f284dabf47ee4384a64c (diff) | |
download | pfsense-b368b35a6751d5b29c17ba1c5ec29fdd4a4861d1.zip pfsense-b368b35a6751d5b29c17ba1c5ec29fdd4a4861d1.tar.gz |
Resolve issues that made php core dump or eat a lot of memory when big routing tables are present.
Diffstat (limited to 'etc/inc/system.inc')
-rw-r--r-- | etc/inc/system.inc | 48 |
1 files changed, 6 insertions, 42 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 15d38e5..0d04de6 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -31,7 +31,7 @@ /* pfSense_BUILDER_BINARIES: /usr/sbin/powerd /usr/bin/killall /sbin/sysctl /sbin/route - pfSense_BUILDER_BINARIES: /bin/hostname /bin/ls /usr/bin/netstat /usr/sbin/syslogd + pfSense_BUILDER_BINARIES: /bin/hostname /bin/ls /usr/sbin/syslogd pfSense_BUILDER_BINARIES: /usr/sbin/pccardd /usr/local/sbin/lighttpd /bin/chmod /bin/mkdir pfSense_BUILDER_BINARIES: /usr/bin/tar /usr/local/sbin/ntpd /usr/sbin/ntpdate pfSense_BUILDER_BINARIES: /usr/bin/nohup /sbin/dmesg /usr/local/sbin/atareinit /sbin/kldload @@ -398,52 +398,19 @@ function system_routing_configure($interface = "") { } } } - /* Create a array from the existing inet route table */ - exec("/usr/bin/netstat -rnf inet", $route_str); - array_shift($route_str); - array_shift($route_str); - array_shift($route_str); - array_shift($route_str); - $route_arr = array(); - foreach($route_str as $routeline) { - $items = preg_split("/[ ]+/i", $routeline); - $route_arr[$items[0]] = array($items[0], $items[1], $items[5]); - } if ($dont_add_route == false ) { if (!empty($interface) && $interface != $interfacegw) ; else if (($interfacegw <> "bgpd") && (is_ipaddrv4($gatewayip))) { - $action = "add"; - if(isset($route_arr['default'])) { - $action = "change"; - } - log_error("ROUTING: $action default route to $gatewayip"); - mwexec("/sbin/route {$action} -inet default " . escapeshellarg($gatewayip)); + log_error("ROUTING: setting default route to $gatewayip"); + mwexec("/sbin/route change -inet default " . escapeshellarg($gatewayip)); } - } - /* Create a array from the existing inet6 route table */ - exec("/usr/bin/netstat -rnf inet6", $routev6_str); - array_shift($routev6_str); - array_shift($routev6_str); - array_shift($routev6_str); - array_shift($routev6_str); - $routev6_arr = array(); - foreach($routev6_str as $routeline) { - $items = preg_split("/[ ]+/i", $routeline); - $routev6_arr[$items[0]] = array($items[0], $items[1], $items[5]); - } - - if ($dont_add_route == false ) { if (!empty($interface) && $interface != $interfacegwv6) ; else if (($interfacegwv6 <> "bgpd") && (is_ipaddrv6($gatewayipv6))) { - $action = "add"; - if(isset($routev6_arr['default'])) { - $action = "change"; - } - log_error("ROUTING: $action IPv6 default route to $gatewayipv6"); + log_error("ROUTING: setting IPv6 default route to $gatewayipv6"); mwexec("/sbin/route {$action} -inet6 default " . escapeshellarg($gatewayipv6)); } } @@ -463,9 +430,6 @@ function system_routing_configure($interface = "") { $gatewayip = $gateway['gateway']; $interfacegw = $gateway['interface']; - $action = "add"; - if (isset($route_arr[$rtent['network']])) - $action = "change"; if(is_ipaddrv6($gatewayip)) { $inetfamily = "-inet6"; @@ -473,10 +437,10 @@ function system_routing_configure($interface = "") { $inetfamily = "-inet"; } if (is_ipaddr($gatewayip)) { - mwexec("/sbin/route {$action} {$inetfamily} " . escapeshellarg($rtent['network']) . + mwexec("/sbin/route change {$inetfamily} " . escapeshellarg($rtent['network']) . " " . escapeshellarg($gatewayip)); } else if (!empty($interfacegw)) { - mwexec("/sbin/route {$action} {$inetfamily} " . escapeshellarg($rtent['network']) . + mwexec("/sbin/route change {$inetfamily} " . escapeshellarg($rtent['network']) . " -iface " . escapeshellarg($interfacegw)); } } |