summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/etc_ppp/ip-up
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/etc_ppp/ip-up') (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/settings/networksettings2/etc_ppp/ip-up71
1 files changed, 71 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/etc_ppp/ip-up b/noncore/settings/networksettings2/etc_ppp/ip-up
new file mode 100755
index 0000000..ec964d0
--- a/dev/null
+++ b/noncore/settings/networksettings2/etc_ppp/ip-up
@@ -0,0 +1,71 @@
1#!/bin/sh
2exec 2> /tmp/IPL
3set -x
4#
5# This script is run by the pppd after the link is established.
6# This script is run by the pppd _after_ the link is brought down.
7#
8# variable DIR determines if it is run after establish (up) or
9# after down (down)
10#
11# It uses run-parts to run scripts in /etc/ppp/ip-$DIR.d
12#
13# This script is called with the following arguments:
14# Arg Name Example
15# $1 Interface name ppp0
16# $2 The tty ttyS1
17# $3 The link speed 38400
18# $4 Local IP number 12.34.56.78
19# $5 Peer IP number 12.34.56.99
20# $6 Optional ``ipparam'' value foo
21
22# The environment is cleared before executing this script
23# so the path must be reset
24PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
25export PATH
26
27case $0 in
28 *ip-up*)
29 DIR=up
30 ;;
31 *ip-down*)
32 DIR=down
33 ;;
34esac
35
36# These variables are for the use of the scripts run by run-parts
37PPP_IFACE="$1"
38PPP_TTY="$2"
39PPP_SPEED="$3"
40PPP_LOCAL="$4"
41PPP_REMOTE="$5"
42PPP_IPPARAM="$6"
43export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM
44
45# as an additional convenience, $PPP_TTYNAME is set to the tty name,
46# stripped of /dev/ (if present) for easier matching.
47PPP_TTYNAME=`/usr/bin/basename "$2"`
48export PPP_TTYNAME
49
50# If /var/log/ppp-ipupdown.log exists use it for logging.
51if [ -e /var/log/ppp-ipupdown.log ]; then
52 exec > /var/log/ppp-ipupdown.log 2>&1
53fi
54
55# This script can be used to override the .d files supplied by other packages.
56if [ -x /etc/ppp/ip-${DIR}.local ]; then
57 exec /etc/ppp/ip-${DIR}.local
58fi
59
60run-parts -a "$1" -a "$2" -a "$3" -a "$4" -a "$5" -a "$6" \
61 /etc/ppp/ip-${DIR}.d
62
63if [ "$DIR" = "up" ]
64then
65 # if pon was called with the "quick" argument, stop pppd
66 if [ -e /var/run/ppp-quick ]; then
67 rm /var/run/ppp-quick
68 wait
69 kill $PPPD_PID
70 fi
71fi