diff options
| author | Rob Landley <rob@landley.net> | 2005-04-30 03:49:37 +0000 |
|---|---|---|
| committer | Rob Landley <rob@landley.net> | 2005-04-30 03:49:37 +0000 |
| commit | ad8071f582a354924e96a3842e4fda7895bb5b7f (patch) | |
| tree | 6a0fb577de9944fcbb68604a45bbb581da6d8590 /examples | |
| parent | 55b1efc6de0bce7872dd9b46c19e6688a1976427 (diff) | |
| download | busybox-w32-ad8071f582a354924e96a3842e4fda7895bb5b7f.tar.gz busybox-w32-ad8071f582a354924e96a3842e4fda7895bb5b7f.tar.bz2 busybox-w32-ad8071f582a354924e96a3842e4fda7895bb5b7f.zip | |
David Brownell submitted a new applet, zcip, based on RFC 3927. This is
version 0418b. It compiled.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/zcip.script | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/zcip.script b/examples/zcip.script new file mode 100644 index 000000000..988e542a4 --- /dev/null +++ b/examples/zcip.script | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # only for use as a "zcip" callback script | ||
| 4 | if [ "x$interface" = x ] | ||
| 5 | then | ||
| 6 | exit 1 | ||
| 7 | fi | ||
| 8 | |||
| 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 | ||
| 16 | ;; | ||
| 17 | config) | ||
| 18 | if [ "x$ip" = x ] | ||
| 19 | then | ||
| 20 | exit 1 | ||
| 21 | fi | ||
| 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" | ||
| 26 | fi | ||
| 27 | exec ip address add dev $interface \ | ||
| 28 | scope link local "$ip/16" broadcast + | ||
| 29 | ;; | ||
| 30 | deconfig) | ||
| 31 | if [ x$ip = x ] | ||
| 32 | then | ||
| 33 | exit 1 | ||
| 34 | fi | ||
| 35 | exec ip address del dev $interface local $ip | ||
| 36 | ;; | ||
| 37 | esac | ||
| 38 | exit 1 | ||
