3 alias debug=${DEBUG:-:}
5 # allow env to override nvram
8 get) eval "echo \${NVRAM_$2:-\$(command nvram get $2)}";;
12 . /etc/nvram.overrides
16 [ "${1%%[0-9]}" = "vlan" ] && {
18 hwname=$(nvram get vlan${i}hwname)
19 hwaddr=$(nvram get ${hwname}macaddr)
20 [ -z "$hwaddr" ] && return 1
22 vif=$(ifconfig -a | awk '/^eth.*'$hwaddr'/ {print $1; exit}' IGNORECASE=1)
23 debug "# vlan$i: $hwname $hwaddr => $vif"
25 $DEBUG ifconfig $vif up
26 $DEBUG vconfig add $vif $i 2>/dev/null
28 ifconfig "$1" >/dev/null 2>&1 || [ "${1%%[0-9]}" = "br" ]
29 [ $? = 0 ] || { echo -e "# $1 ignored: no such interface"; return 1; }