setup-ip: only assign IP configuration of Qubes managed iface
This commit is contained in:
parent
902da9f837
commit
f7dd41206d
@ -128,6 +128,15 @@ umount_retry() {
|
||||
return 0
|
||||
}
|
||||
|
||||
get_mac_from_iface() {
|
||||
local iface="$1"
|
||||
local mac
|
||||
if [ "x$iface" != "x" ]; then
|
||||
mac="$(cat "/sys/class/net/$iface/address")"
|
||||
fi
|
||||
echo "$mac"
|
||||
}
|
||||
|
||||
get_iface_from_mac() {
|
||||
local mac="$1"
|
||||
local iface
|
||||
|
@ -6,9 +6,13 @@
|
||||
|
||||
have_qubesdb || exit 0
|
||||
|
||||
ip=$(/usr/bin/qubesdb-read /qubes-ip 2> /dev/null)
|
||||
ip6=$(/usr/bin/qubesdb-read /qubes-ip6 2> /dev/null)
|
||||
if [ "x$ip" != x ]; then
|
||||
mac="$(/usr/bin/qubesdb-read /qubes-mac 2> /dev/null)"
|
||||
current_mac="$(get_mac_from_iface "$INTERFACE")"
|
||||
|
||||
if [ "$mac" = "$current_mac" ]; then
|
||||
ip="$(/usr/bin/qubesdb-read /qubes-ip 2> /dev/null)"
|
||||
ip6="$(/usr/bin/qubesdb-read /qubes-ip6 2> /dev/null)"
|
||||
if [ "x$ip" != x ]; then
|
||||
#netmask=$(/usr/bin/qubesdb-read /qubes-netmask)
|
||||
gateway=$(/usr/bin/qubesdb-read /qubes-gateway)
|
||||
gateway6=$(/usr/bin/qubesdb-read /qubes-gateway6)
|
||||
@ -18,7 +22,7 @@ if [ "x$ip" != x ]; then
|
||||
/sbin/ethtool -K "$INTERFACE" tx off
|
||||
# If NetworkManager is enabled, let it configure the network
|
||||
if qsvc network-manager ; then
|
||||
nm_config=/etc/NetworkManager/system-connections/qubes-uplink-$INTERFACE
|
||||
nm_config="/etc/NetworkManager/system-connections/qubes-uplink-$INTERFACE"
|
||||
cat > "$nm_config" <<__EOF__
|
||||
[802-3-ethernet]
|
||||
duplex=full
|
||||
@ -127,4 +131,5 @@ __EOF__
|
||||
/rw/config/qubes_ip_change_hook
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
Loading…
Reference in New Issue
Block a user