mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-23 14:48:51 +01:00
Add Netmanager gateway detection
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
a71a44346e
commit
f3ecbc185c
@ -874,6 +874,7 @@ detect_dynamic_gateway() { # $1 = interface
|
||||
GATEWAYS=
|
||||
local gateway
|
||||
local file
|
||||
local nmcli
|
||||
|
||||
gateway=$(run_findgw_exit $1);
|
||||
|
||||
@ -897,6 +898,14 @@ detect_dynamic_gateway() { # $1 = interface
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$gateway" -a -n "$(mywhich nmcli)" ]; then
|
||||
if [ $g_family = 4 ]; then
|
||||
gateway=$(nmcli --fields DHCP4.OPTION,IP4.GATEWAY device show ${1} 2> /dev/null | sed -rn '/( routers = |IP4.GATEWAY:.*[1-9])/{s/.* //;p;q}')
|
||||
else
|
||||
gateway=$(nmcli --terse --fields IP6.GATEWAY device show ${1} 2> /dev/null | cut -f2- -d':')
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -n "$gateway" ] && echo $gateway
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user