iface_has_host: Handle VLAN interfaces too

VLAN interface always has host. And skip HOST variable
in VLAN's configs.
This commit is contained in:
Mikhail Efremov 2016-03-09 19:44:40 +03:00
parent 75a465583f
commit b8192ace2d

View File

@ -468,8 +468,16 @@ iface_has_host()
local name="$1"; shift
local ifacesdir="${1:-$etcnet_iface_dir}"
# VLAN interface always has host
if [ "$(read_iface_option "$ifacesdir/$name" TYPE)" = "vlan" ]; then
return 0
fi
for i in $(find "$ifacesdir" -maxdepth 2 -mindepth 2 -name options); do
if egrep -qs "^HOST=[\"']?([[:alnum:]]+[[:blank:]])*$name([[:blank:]][[:alnum:]]+)*[\"']?[[:blank:]]*$" $i; then
if [ "$(read_iface_option "${i%/options}" TYPE)" = "vlan" ]; then
continue
fi
return 0
fi
done