blob: e543c304e86dce178ff36780e1be7eeb88f954a8 [file] [log] [blame]
Rob Landleyad8071f2005-04-30 03:49:37 +00001#!/bin/sh
2
3# only for use as a "zcip" callback script
4if [ "x$interface" = x ]
5then
6 exit 1
7fi
8
9# zcip should start on boot/resume and various media changes
10case "$1" in
11init)
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 ;;
17config)
18 if [ "x$ip" = x ]
19 then
20 exit 1
21 fi
22 # remember $ip for $interface, to use on restart
Thomas Petazzoni98aeabe2011-08-09 04:41:00 +020023 if [ "x$ip" != x -a -w "$ip.$interface" ]
Rob Landleyad8071f2005-04-30 03:49:37 +000024 then
Thomas Petazzoni98aeabe2011-08-09 04:41:00 +020025 echo $ip > "$ip.$interface"
Rob Landleyad8071f2005-04-30 03:49:37 +000026 fi
27 exec ip address add dev $interface \
28 scope link local "$ip/16" broadcast +
29 ;;
30deconfig)
31 if [ x$ip = x ]
32 then
33 exit 1
34 fi
35 exec ip address del dev $interface local $ip
36 ;;
37esac
38exit 1