busybox: update to 1.25.0
[tomato.git] / release / src / router / busybox / examples / var_service / zcip_if / zcip_handler
blob3c6ca788bdbda394f8b73412a4fdfdb1b52c213c
1 #!/bin/sh
2 # executed by zcip
3 # parameters: $1 and environment
4 # $1 is:
6 # init: zcip starts. Environment:
7 # interface=eth0
9 # config: Address is obtained.
10 # interface=eth0
11 # ip=169.254.a.b
13 # deconfig: Conflict or link went down.
14 # interface=eth0
16 service=${PWD##*/}
17 file_ipconf="$service.ipconf"
18 dir_ipconf="/var/run/service/fw"
20 exec >/dev/null
21 #exec >>"$0.out" #debug
22 exec 2>&1
24 echo "`date`: Params: $*"
26 if test x"$1" != x"config"; then
27 # Reconfigure network with this interface disabled
28 echo "Deconfiguring"
29 rm "$file_ipconf"
30 rm "$dir_ipconf/$file_ipconf"
31 sv u /var/service/fw
32 exit
35 # "config": we've got the address
36 # Record information for e.g. dhcp_$IF_pinger service
37 env >"env.out"
39 ./convert2ipconf "$file_ipconf"
40 # Reconfigure routing and firewall if needed
41 diff --brief "$file_ipconf" "$dir_ipconf/$file_ipconf" >/dev/null 2>&1
42 if test $? != 0; then
43 echo "Reconfiguring fw"
44 mkdir -p "$dir_ipconf" 2>/dev/null
45 cp "$file_ipconf" "$dir_ipconf/$file_ipconf"
46 sv u /var/service/fw