add rarpd (thanks to Jeff Dairiki)
[openwrt.git] / root / etc / functions.sh
1 #!/bin/ash
2
3 alias debug=${DEBUG:-:}
4
5 # allow env to override nvram
6 nvram_get () {
7 eval "echo \${$1:-\$(nvram get $1)}"
8 }
9 . /etc/nvram.overrides
10
11 # valid interface?
12 if_valid () (
13 [ "${1%%[0-9]}" = "vlan" ] && {
14 i=${1#vlan}
15 hwname=$(nvram_get vlan${i}hwname)
16 hwaddr=$(nvram_get ${hwname}macaddr)
17 [ -z "$hwaddr" ] && return 1
18
19 vif=$(ifconfig -a | awk '/^eth.*'$hwaddr'/ {print $1; exit}' IGNORECASE=1)
20 debug "# vlan$i: $hwname $hwaddr => $vif"
21
22 $DEBUG ifconfig $vif up
23 $DEBUG vconfig add $vif $i 2>/dev/null
24 }
25 ifconfig "$1" >/dev/null 2>&1 || [ "${1%%[0-9]}" = "br" ]
26 )
This page took 0.04739 seconds and 5 git commands to generate.