diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2007-06-16 00:01:33 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2007-06-16 00:01:33 +0000 |
commit | 46da1409881bee5a1b11691d286f773f38374bd9 (patch) | |
tree | 90b0a4b1f403fbf8f0c1576ca1ea25d8fe4af8ee /package/ppp/files/etc | |
parent | 482f2d1ecc524fd6aff972cf29f5252e2f73f905 (diff) |
keep track of the network interface states (stored in uci format in /var/state/network, overlay over /etc/config/network)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7643 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/ppp/files/etc')
-rwxr-xr-x | package/ppp/files/etc/ppp/ip-down | 16 | ||||
-rwxr-xr-x | package/ppp/files/etc/ppp/ip-up | 14 |
2 files changed, 28 insertions, 2 deletions
diff --git a/package/ppp/files/etc/ppp/ip-down b/package/ppp/files/etc/ppp/ip-down index 814948e0b..f3d63a019 100755 --- a/package/ppp/files/etc/ppp/ip-down +++ b/package/ppp/files/etc/ppp/ip-down @@ -1,5 +1,19 @@ #!/bin/sh -[ -z "$6" ] || env -i ACTION="ifdown" INTERFACE="$6" DEVICE="$1" PROTO=ppp /sbin/hotplug-call "iface" +PPP_IFACE="$1" +PPP_TTY="$2" +PPP_SPEED="$3" +PPP_LOCAL="$4" +PPP_REMOTE="$5" +PPP_IPPARAM="$6" +export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM +[ -z "$PPP_IPPARAM" ] || { + env -i ACTION="ifdown" INTERFACE="$PPP_IPPARAM" DEVICE="$PPP_IFACE" PROTO=ppp /sbin/hotplug-call "iface" + + # remove the interface's network state + FILE=/var/state/network.$$ + grep -v "^config_set '$PPP_IPPARAM' " /var/state/network > "$FILE" + mv "$FILE" /var/state/network +} [ -d /etc/ppp/ip-down.d ] && { for SCRIPT in /etc/ppp/ip-down.d/* diff --git a/package/ppp/files/etc/ppp/ip-up b/package/ppp/files/etc/ppp/ip-up index 22b65e8a0..a50137f5d 100755 --- a/package/ppp/files/etc/ppp/ip-up +++ b/package/ppp/files/etc/ppp/ip-up @@ -1,5 +1,17 @@ #!/bin/sh -[ -z "$6" ] || env -i ACTION="ifup" INTERFACE="$6" DEVICE="$1" PROTO=ppp /sbin/hotplug-call "iface" +PPP_IFACE="$1" +PPP_TTY="$2" +PPP_SPEED="$3" +PPP_LOCAL="$4" +PPP_REMOTE="$5" +PPP_IPPARAM="$6" +export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM +[ -z "$PPP_IPPARAM" ] || env -i ACTION="ifup" INTERFACE="$PPP_IPPARAM" DEVICE="$PPP_IFACE" PROTO=ppp /sbin/hotplug-call "iface" +[ -z "$PPP_IPPARAM" -o -z "$PPP_LOCAL" ] || { + uci set "/var/state/network.$PPP_IPPARAM.ipaddr=$PPP_LOCAL" + uci set "/var/state/network.$PPP_IPPARAM.gateway=$PPP_REMOTE" +} + [ -d /etc/ppp/ip-up.d ] && { for SCRIPT in /etc/ppp/ip-up.d/* |