keep track of the network interface states (stored in uci format in /var/state/networ...
[openwrt/svn-archive/archive.git] / package / ppp / files / etc / ppp / ip-up
1 #!/bin/sh
2 PPP_IFACE="$1"
3 PPP_TTY="$2"
4 PPP_SPEED="$3"
5 PPP_LOCAL="$4"
6 PPP_REMOTE="$5"
7 PPP_IPPARAM="$6"
8 export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM
9 [ -z "$PPP_IPPARAM" ] || env -i ACTION="ifup" INTERFACE="$PPP_IPPARAM" DEVICE="$PPP_IFACE" PROTO=ppp /sbin/hotplug-call "iface"
10 [ -z "$PPP_IPPARAM" -o -z "$PPP_LOCAL" ] || {
11 uci set "/var/state/network.$PPP_IPPARAM.ipaddr=$PPP_LOCAL"
12 uci set "/var/state/network.$PPP_IPPARAM.gateway=$PPP_REMOTE"
13 }
14
15
16 [ -d /etc/ppp/ip-up.d ] && {
17 for SCRIPT in /etc/ppp/ip-up.d/*
18 do
19 [ -x "$SCRIPT" ] && "$SCRIPT" $@
20 done
21 }