list_network(): Pass ifaces directory as second argument
And use list_etcnet_iface_filtered().
This commit is contained in:
parent
28f27e4a55
commit
98e765e2c8
@ -655,29 +655,30 @@ list_static_iface()
|
||||
list_etcnet_iface_filtered "$dir" __filter_iface_static "$ipv"
|
||||
}
|
||||
|
||||
# list_network [ ip_version ]
|
||||
# list_network [ ip_version [ ifaces_dir ] ]
|
||||
list_network()
|
||||
{
|
||||
local p="${1:-4}" r=
|
||||
local dir="${2:-$etcnet_iface_dir}"
|
||||
local ifname= ifdir=
|
||||
|
||||
eval "r=\$__ipv${p}_network_re"
|
||||
for i in `find "$etcnet_iface_dir" -type d`; do
|
||||
local name="${i##*/}"
|
||||
[ "$name" != "lo" -a "$name" != "default" -a "$name" != "unknown" ] || continue
|
||||
for ifname in $(list_etcnet_iface_filtered "$dir"); do
|
||||
ifdir="$dir/$ifname"
|
||||
|
||||
local proto="$(read_iface_option $i BOOTPROTO)"
|
||||
local addr=
|
||||
if [ "$proto" = "static" ];then
|
||||
addr="$(read_iface_addresses $i "$p")"
|
||||
else
|
||||
addr="$(read_iface_current_addresses $i "$p")"
|
||||
fi
|
||||
if [ "$p" = 4 ]; then
|
||||
[ -z "$addr" ] || netname "$addr" | cut -f1
|
||||
else
|
||||
[ -z "$addr" ] || ipv6_network "$addr"
|
||||
fi
|
||||
done
|
||||
local proto="$(read_iface_option "$ifdir" BOOTPROTO)"
|
||||
local addr=
|
||||
if [ "$proto" = "static" ];then
|
||||
addr="$(read_iface_addresses "$ifdir" "$p")"
|
||||
else
|
||||
addr="$(read_iface_current_addresses "$ifdir" "$p")"
|
||||
fi
|
||||
if [ "$p" = 4 ]; then
|
||||
[ -z "$addr" ] || netname "$addr" | cut -f1
|
||||
else
|
||||
[ -z "$addr" ] || ipv6_network "$addr"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
### start/stop interfaces
|
||||
|
Loading…
Reference in New Issue
Block a user