ppp: quote positional parameters when calling up/down scripts (closes: #5622)
[openwrt/openwrt.git] / package / ppp / files / 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="$6"
9 export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM
10 [ -z "$PPP_IPPARAM" ] || {
11 env -i ACTION="ifdown" INTERFACE="$PPP_IPPARAM" DEVICE="$PPP_IFACE" PROTO=ppp /sbin/hotplug-call "iface"
12
13 # remove the interface's network state
14 uci_revert_state network "$PPP_IPPARAM"
15 }
16
17 [ -d /etc/ppp/ip-down.d ] && {
18 for SCRIPT in /etc/ppp/ip-down.d/*
19 do
20 [ -x "$SCRIPT" ] && "$SCRIPT" "$@"
21 done
22 }