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

Merge pull request #1278 from RaspAP/fix/ip-route-regex

Update regex for optional src attribute
This commit is contained in:
Bill Zimmerman 2023-01-06 10:15:19 -08:00 committed by GitHub
commit 404bc34aef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ function getRouteInfo($checkAccess)
{ {
$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 (\b([0-9]{1,3}\.){3}[0-9]{1,3}).*dev (\w*)(.*((\b([0-9]{1,3}\.){3}[0-9]{1,3})))?/\3 \5 \1/p"', $routes);
$devpat = array("tun", "ppp"); // routing in case of VPN and PPP connection are different $devpat = array("tun", "ppp"); // routing in case of VPN and PPP connection are different
foreach ($devpat as $pat) { foreach ($devpat as $pat) {
exec('ip route list | grep -oP "'.$pat.'[0-9]" | sort -u', $devs); exec('ip route list | grep -oP "'.$pat.'[0-9]" | sort -u', $devs);