Root/package/ppp/files/etc/ppp/ip-up

1#!/bin/sh
2
3. /etc/functions.sh
4. /lib/network/config.sh
5
6PPP_IFACE="$1"
7PPP_TTY="$2"
8PPP_SPEED="$3"
9PPP_LOCAL="$4"
10PPP_REMOTE="$5"
11PPP_IPPARAM="$(echo $6 | sed 's/\./_/g')"
12
13export 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" ] || env -i ACTION="ifup" INTERFACE="$PPP_IPPARAM" DEVICE="$PPP_IFACE" PROTO=ppp /sbin/hotplug-call "iface"
24
25[ -d /etc/ppp/ip-up.d ] && {
26    for SCRIPT in /etc/ppp/ip-up.d/*
27    do
28        [ -x "$SCRIPT" ] && "$SCRIPT" "$@"
29    done
30}
31

Archive Download this file



interactive