4 alias debug=${DEBUG:-:}
8 ifconfig "$1" >&- 2>&- ||
9 [ "${1%%[0-9]}" = "br" ] ||
11 [ "${1%%[0-9]}" = "vlan" ] && (
13 hwname=$(nvram get vlan${i}hwname)
14 hwaddr=$(nvram get ${hwname}macaddr)
15 [ -z "$hwaddr" ] && return 1
17 vif=$(ifconfig -a | awk '/^eth.*'$hwaddr'/ {print $1; exit}' IGNORECASE=1)
18 debug "# vlan$i => $vif"
20 $DEBUG ifconfig $vif up
21 $DEBUG vconfig add $vif $i 2>&-
24 { debug "# missing interface '$1' ignored"; false; }
30 c=((c>> 1)&0x55555555)+(c&0x55555555),
31 c=((c>> 2)&0x33333333)+(c&0x33333333),
32 c=((c>> 4)&0x0f0f0f0f)+(c&0x0f0f0f0f),
33 c=((c>> 8)&0x00ff00ff)+(c&0x00ff00ff),
34 c=((c>>16)&0x0000ffff)+(c&0x0000ffff)
43 set $(echo $1 | tr '\.' ' ')
44 echo $(($1<<24|$2<<16|$3<<8|$4))
48 echo $(($1>>24&255)).$(($1>>16&255)).$(($1>>8&255)).$(($1&255))