Changes for kernel and Busybox
[tomato.git] / release / src / router / busybox / examples / zcip.script
blobe543c304e86dce178ff36780e1be7eeb88f954a8
1 #!/bin/sh
3 # only for use as a "zcip" callback script
4 if [ "x$interface" = x ]
5 then
6 exit 1
7 fi
9 # zcip should start on boot/resume and various media changes
10 case "$1" in
11 init)
12 # for now, zcip requires the link to be already up,
13 # and it drops links when they go down. that isn't
14 # the most robust model...
15 exit 0
17 config)
18 if [ "x$ip" = x ]
19 then
20 exit 1
22 # remember $ip for $interface, to use on restart
23 if [ "x$ip" != x -a -w "$ip.$interface" ]
24 then
25 echo $ip > "$ip.$interface"
27 exec ip address add dev $interface \
28 scope link local "$ip/16" broadcast +
30 deconfig)
31 if [ x$ip = x ]
32 then
33 exit 1
35 exec ip address del dev $interface local $ip
37 esac
38 exit 1