pppd: split files into netifd and non-netifd files, move the netifd ppp.sh file to...
[openwrt.git] / package / ppp / files.old / etc / ppp / ip-down
1 #!/bin/sh
2 . /etc/functions.sh
3 PPP_IFACE="$1"
4 PPP_TTY="$2"
5 PPP_SPEED="$3"
6 PPP_LOCAL="$4"
7 PPP_REMOTE="$5"
8 PPP_IPPARAM="$(echo $6 | sed 's/\./_/g')"
9 export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM
10 [ -z "$PPP_IPPARAM" ] || {
11         case "$PPP_IFACE" in
12                 # only handle uci managed interfaces here, others are done by generic hotplug
13                 3g-*|ppp-*|pppoa-*|pppoe-*|pptp-*)
14                         env -i ACTION="ifdown" INTERFACE="$PPP_IPPARAM" DEVICE="$PPP_IFACE" PROTO=ppp /sbin/hotplug-call "iface"
15                         uci_revert_state network "$PPP_IPPARAM"
16                 ;;
17         esac
18 }
19
20 [ -d /etc/ppp/ip-down.d ] && {
21         for SCRIPT in /etc/ppp/ip-down.d/*
22         do
23                 [ -x "$SCRIPT" ] && "$SCRIPT" "$@"
24         done
25 }