3 alias debug
=${DEBUG:-:}
5 # allow env to override nvram
7 if [ -x /usr
/sbin
/nvram
]; then
9 get
) eval "echo \${$2:-\$(command nvram get $2)}";;
14 get
) eval "echo \${$2:-\${DEFAULT_$2}}";;
22 ifconfig
"$1" >&- 2>&- ||
23 [ "${1%%[0-9]}" = "br" ] ||
25 [ "${1%%[0-9]}" = "vlan" ] && (
27 hwname
=$
(nvram get vlan
${i}hwname
)
28 hwaddr
=$
(nvram get
${hwname}macaddr
)
29 [ -z "$hwaddr" ] && return 1
31 vif
=$
(ifconfig
-a |
awk '/^eth.*'$hwaddr'/ {print $1; exit}' IGNORECASE
=1)
32 debug
"# vlan$i => $vif"
34 $DEBUG ifconfig
$vif up
35 $DEBUG vconfig add
$vif $i 2>&-
38 { debug
"# missing interface '$1' ignored"; false
; }
44 c
=((c
>> 1)&0x55555555)+(c
&0x55555555),
45 c
=((c
>> 2)&0x33333333)+(c
&0x33333333),
46 c
=((c
>> 4)&0x0f0f0f0f)+(c
&0x0f0f0f0f),
47 c
=((c
>> 8)&0x00ff00ff)+(c
&0x00ff00ff),
48 c
=((c
>>16)&0x0000ffff)+(c
&0x0000ffff)
57 set $
(echo $1 |
tr '\.' ' ')
58 echo $
(($1<<24|$2<<16|$3<<8|$4))
62 echo $(($1>>24&255)).$
(($1>>16&255)).$
(($1>>8&255)).$
(($1&255))
This page took 0.045004 seconds and 5 git commands to generate.