[package] kernel: add kmod-acpi-button
[openwrt/svn-archive/archive.git] / package / ppp / files / etc / ppp / ip-up
1 #!/bin/sh
2
3 . /etc/functions.sh
4 . /lib/network/config.sh
5
6 PPP_IFACE="$1"
7 PPP_TTY="$2"
8 PPP_SPEED="$3"
9 PPP_LOCAL="$4"
10 PPP_REMOTE="$5"
11 PPP_IPPARAM="$(echo $6 | sed 's/\./_/g')"
12
13 export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM
14 [ -z "$PPP_IPPARAM" -o -z "$PPP_LOCAL" ] || {
15 uci_set_state network "$PPP_IPPARAM" ifname "$PPP_IFACE"
16 uci_set_state network "$PPP_IPPARAM" ipaddr "$PPP_LOCAL"
17 uci_set_state network "$PPP_IPPARAM" gateway "$PPP_REMOTE"
18
19 local dns="$DNS1${DNS2:+ $DNS2}"
20 [ -n "$dns" ] && add_dns "$PPP_IPPARAM" $dns
21 }
22
23 [ -z "$PPP_IPPARAM" ] || {
24 case "$PPP_IFACE" in
25 # only handle uci managed interfaces here, others are done by generic hotplug
26 3g-*|ppp-*|pppoa-*|pppoe-*|pptp-*)
27 env -i ACTION="ifup" INTERFACE="$PPP_IPPARAM" DEVICE="$PPP_IFACE" PROTO=ppp /sbin/hotplug-call "iface"
28 ;;
29 esac
30 }
31
32 [ -d /etc/ppp/ip-up.d ] && {
33 for SCRIPT in /etc/ppp/ip-up.d/*
34 do
35 [ -x "$SCRIPT" ] && "$SCRIPT" "$@"
36 done
37 }