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
|
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() {
|
get_iface_from_mac() {
|
||||||
local mac="$1"
|
local mac="$1"
|
||||||
local iface
|
local iface
|
||||||
|
@ -6,8 +6,12 @@
|
|||||||
|
|
||||||
have_qubesdb || exit 0
|
have_qubesdb || exit 0
|
||||||
|
|
||||||
ip=$(/usr/bin/qubesdb-read /qubes-ip 2> /dev/null)
|
mac="$(/usr/bin/qubesdb-read /qubes-mac 2> /dev/null)"
|
||||||
ip6=$(/usr/bin/qubesdb-read /qubes-ip6 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
|
if [ "x$ip" != x ]; then
|
||||||
#netmask=$(/usr/bin/qubesdb-read /qubes-netmask)
|
#netmask=$(/usr/bin/qubesdb-read /qubes-netmask)
|
||||||
gateway=$(/usr/bin/qubesdb-read /qubes-gateway)
|
gateway=$(/usr/bin/qubesdb-read /qubes-gateway)
|
||||||
@ -18,7 +22,7 @@ if [ "x$ip" != x ]; then
|
|||||||
/sbin/ethtool -K "$INTERFACE" tx off
|
/sbin/ethtool -K "$INTERFACE" tx off
|
||||||
# If NetworkManager is enabled, let it configure the network
|
# If NetworkManager is enabled, let it configure the network
|
||||||
if qsvc network-manager ; then
|
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__
|
cat > "$nm_config" <<__EOF__
|
||||||
[802-3-ethernet]
|
[802-3-ethernet]
|
||||||
duplex=full
|
duplex=full
|
||||||
@ -128,3 +132,4 @@ __EOF__
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user