diff options
author | Chris Buechler <cmb@pfsense.org> | 2014-11-06 20:19:24 -0600 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2014-11-06 20:19:24 -0600 |
commit | 7bd413ebc604d3600c7de355b0ce97724951be50 (patch) | |
tree | c66899b7141e4b795d7ff117f698f02463bbb82e | |
parent | 708af6349c07cc9d69f271fc0115bd9f6ea8fdfe (diff) | |
download | pfsense-7bd413ebc604d3600c7de355b0ce97724951be50.zip pfsense-7bd413ebc604d3600c7de355b0ce97724951be50.tar.gz |
add a route debug option to log info about route commands executed (where those aren't already logged) to help with troubleshooting various routing scenarios.
-rw-r--r-- | etc/inc/system.inc | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 760a664..2b16249 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -172,11 +172,19 @@ function system_resolvconf_generate($dynupdate = false) { /* dns server array starts at 0 */ $dnscountermo = $dnscounter - 1; mwexec("/sbin/route change -host " . $syscfg['dnsserver'][$dnscountermo] . " {$gatewayip}"); + if (isset($config['system']['route-debug'])) { + $mt = microtime(); + log_error("ROUTING debug: $mt - route change -host {$syscfg['dnsserver'][$dnscountermo]} $gatewayip "); + } } if (is_ipaddrv6($gatewayip)) { /* dns server array starts at 0 */ $dnscountermo = $dnscounter - 1; mwexec("/sbin/route change -host -inet6 " . $syscfg['dnsserver'][$dnscountermo] . " {$gatewayip}"); + if (isset($config['system']['route-debug'])) { + $mt = microtime(); + log_error("ROUTING debug: $mt - route change -host -inet6 {$syscfg['dnsserver'][$dnscountermo]} $gatewayip "); + } } } } @@ -541,12 +549,21 @@ function system_staticroutes_configure($interface = "", $update_dns = false) { if (in_array($ip, $ips)) continue; mwexec("/sbin/route delete " . escapeshellarg($ip), true); + if (isset($config['system']['route-debug'])) { + $mt = microtime(); + log_error("ROUTING debug: $mt - route delete $ip "); + } } if (isset($rtent['disabled'])) { /* XXX: This can break things by deleting routes that shouldn't be deleted - OpenVPN, dynamic routing scenarios, etc. redmine #3709 */ - foreach ($ips as $ip) + foreach ($ips as $ip) { mwexec("/sbin/route delete " . escapeshellarg($ip), true); + if (isset($config['system']['route-debug'])) { + $mt = microtime(); + log_error("ROUTING debug: $mt - route delete $ip "); + } + } continue; } @@ -561,10 +578,19 @@ function system_staticroutes_configure($interface = "", $update_dns = false) { $cmd = "/sbin/route change {$inet} {$blackhole} " . escapeshellarg($ip) . " "; if (is_subnet($ip)) - if (is_ipaddr($gatewayip)) + if (is_ipaddr($gatewayip)) { mwexec($cmd . escapeshellarg($gatewayip)); - else if (!empty($interfacegw)) + if (isset($config['system']['route-debug'])) { + $mt = microtime(); + log_error("ROUTING debug: $mt - $cmd $gatewayip"); + } + } else if (!empty($interfacegw)) { mwexec($cmd . "-iface " . escapeshellarg($interfacegw)); + if (isset($config['system']['route-debug'])) { + $mt = microtime(); + log_error("ROUTING debug: $mt - $cmd -iface $interfacegw "); + } + } } } unset($gateways_arr); |