source: trunk/package/ppp/files/etc/ppp/ip-up @ 26742

Last change on this file since 26742 was 26742, checked in by jow, 6 years ago

[package] ppp: prevent duplicate hotplug for non uci managed ppp interfaces (#9275)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 946 bytes
Line 
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" ] || {
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}
Note: See TracBrowser for help on using the repository browser.