network: skip already enslaved interfaces

master
Harald Hoyer 2018-08-21 13:14:44 +02:00 committed by Harald Hoyer
parent fb280834d7
commit f6e3b59e5e
2 changed files with 12 additions and 1 deletions

View File

@ -408,7 +408,11 @@ for p in $(getargs ip=); do
esac

# If this option isn't directed at our interface, skip it
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
if [ -n "$dev" ]; then
[ "$dev" != "$netif" ] && continue
else
iface_is_enslaved "$netif" && continue
fi

# Store config for later use
for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do

View File

@ -745,6 +745,13 @@ iface_has_link() {
iface_has_carrier "$@"
}

iface_is_enslaved() {
local _li
_li=$(ip -o link show dev $1)
strstr "$li" " master " || return 1
return 0
}

find_iface_with_link() {
local iface_path="" iface=""
for iface_path in /sys/class/net/*; do