1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Update to list of default routes

Add the default route entries, which are done via a "scope link" to a network device.
This commit is contained in:
zbchristian 2020-09-03 08:46:57 +02:00 committed by GitHub
parent 04d8433d1c
commit 46946ecebc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,11 @@
$rInfo=array(); $rInfo=array();
// get all default routes // 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 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) ) { if (!empty($routes) ) {
foreach ($routes as $i => $route) { foreach ($routes as $i => $route) {
$prop=explode(' ', $route); $prop=explode(' ', $route);