From 46946ecebc7a1366a54c4cf3ea1d825975b9b1f2 Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Thu, 3 Sep 2020 08:46:57 +0200 Subject: [PATCH] Update to list of default routes Add the default route entries, which are done via a "scope link" to a network device. --- includes/internetRoute.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/internetRoute.php b/includes/internetRoute.php index 78207a61..d51dd9e8 100755 --- a/includes/internetRoute.php +++ b/includes/internetRoute.php @@ -3,6 +3,11 @@ $rInfo=array(); // get all default routes exec('ip route list | sed -rn "s/default via (([0-9]{1,3}\.){3}[0-9]{1,3}).*dev (\w*).*src (([0-9]{1,3}\.){3}[0-9]{1,3}).*/\3 \4 \1/p"', $routes); +exec('ip route list | sed -rn "s/default dev (\w*) scope link/\1/p"',$devs); +if(!empty($devs)) { + foreach ($devs as $dev) + exec('ip route list | sed -rn "s/(([0-9]{1,3}\.){3}[0-9]{1,3}).*dev.*("'.$dev.'").*scope link src (([0-9]{1,3}\.){3}[0-9]{1,3}).*/\3 \4 \1/p"',$routes); +} if (!empty($routes) ) { foreach ($routes as $i => $route) { $prop=explode(' ', $route);