summaryrefslogtreecommitdiff
path: root/examples/zcip.script
diff options
context:
space:
mode:
authorRob Landley2005-04-30 03:49:37 +0000
committerRob Landley2005-04-30 03:49:37 +0000
commitad8071f582a354924e96a3842e4fda7895bb5b7f (patch)
tree6a0fb577de9944fcbb68604a45bbb581da6d8590 /examples/zcip.script
parent55b1efc6de0bce7872dd9b46c19e6688a1976427 (diff)
downloadbusybox-ad8071f582a354924e96a3842e4fda7895bb5b7f.zip
busybox-ad8071f582a354924e96a3842e4fda7895bb5b7f.tar.gz
David Brownell submitted a new applet, zcip, based on RFC 3927. This is
version 0418b. It compiled.
Diffstat (limited to 'examples/zcip.script')
-rw-r--r--examples/zcip.script38
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/zcip.script b/examples/zcip.script
new file mode 100644
index 0000000..988e542
--- /dev/null
+++ b/examples/zcip.script
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# only for use as a "zcip" callback script
+if [ "x$interface" = x ]
+then
+ exit 1
+fi
+
+# zcip should start on boot/resume and various media changes
+case "$1" in
+init)
+ # for now, zcip requires the link to be already up,
+ # and it drops links when they go down. that isn't
+ # the most robust model...
+ exit 0
+ ;;
+config)
+ if [ "x$ip" = x ]
+ then
+ exit 1
+ fi
+ # remember $ip for $interface, to use on restart
+ if [ "x$IP" != x -a -w "$IP.$interface" ]
+ then
+ echo $ip > "$IP.$interface"
+ fi
+ exec ip address add dev $interface \
+ scope link local "$ip/16" broadcast +
+ ;;
+deconfig)
+ if [ x$ip = x ]
+ then
+ exit 1
+ fi
+ exec ip address del dev $interface local $ip
+ ;;
+esac
+exit 1