Skip to content

Commit

Permalink
Merge pull request #187 from viktor/route_get_fix
Browse files Browse the repository at this point in the history
Supress route no found error. Issue #11475
  • Loading branch information
loos-br committed Mar 15, 2021
2 parents 41e0d95 + 46ff02a commit f5ff5cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/etc/inc/util.inc
Expand Up @@ -2670,7 +2670,7 @@ function route_get($target, $ipprotocol = '', $useroute = false) {
} else {
$inet = '6';
}
$interface = exec("/sbin/route -n{$inet} get {$target} | /usr/bin/awk '/interface:/{print $2}'");
$interface = exec("/sbin/route -n{$inet} get {$target} 2>/dev/null | /usr/bin/awk '/interface:/{print $2}'");
if (empty($interface)) {
return array();
} elseif ($interface == 'lo0') {
Expand All @@ -2684,7 +2684,7 @@ function route_get($target, $ipprotocol = '', $useroute = false) {
}
}
} else {
$gateway = exec("/sbin/route -n{$inet} get {$target} | /usr/bin/awk '/gateway:/{print $2}'");
$gateway = exec("/sbin/route -n{$inet} get {$target} 2>/dev/null | /usr/bin/awk '/gateway:/{print $2}'");
if (!$gateway) {
// non-local gateway
$gateway = get_interface_mac($interface);
Expand Down

0 comments on commit f5ff5cd

Please sign in to comment.