summaryrefslogtreecommitdiff
path: root/package/ppp
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2007-06-16 00:01:33 +0000
committerFelix Fietkau <nbd@openwrt.org>2007-06-16 00:01:33 +0000
commit4f16e9cc3e2c187d19b24785a55ce30a892efd68 (patch)
tree2f0c604247fa6fd86171a5e3398a4a662f99cb06 /package/ppp
parent8e2643a8b517b0ff5030f05020c48fc7bc0e85c2 (diff)
downloadmtk-20170518-4f16e9cc3e2c187d19b24785a55ce30a892efd68.zip
mtk-20170518-4f16e9cc3e2c187d19b24785a55ce30a892efd68.tar.gz
mtk-20170518-4f16e9cc3e2c187d19b24785a55ce30a892efd68.tar.bz2
keep track of the network interface states (stored in uci format in /var/state/network, overlay over /etc/config/network)
SVN-Revision: 7643
Diffstat (limited to 'package/ppp')
-rwxr-xr-xpackage/ppp/files/etc/ppp/ip-down16
-rwxr-xr-xpackage/ppp/files/etc/ppp/ip-up14
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 814948e..f3d63a0 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 22b65e8..a50137f 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/*