Diffstat (limited to 'noncore/settings/networksettings2/etc_ppp') (more/less context) (ignore whitespace changes)
-rwxr-xr-x | noncore/settings/networksettings2/etc_ppp/ip-up | 71 |
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 | ||
2 | exec 2> /tmp/IPL | ||
3 | set -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 | ||
24 | PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin | ||
25 | export PATH | ||
26 | |||
27 | case $0 in | ||
28 | *ip-up*) | ||
29 | DIR=up | ||
30 | ;; | ||
31 | *ip-down*) | ||
32 | DIR=down | ||
33 | ;; | ||
34 | esac | ||
35 | |||
36 | # These variables are for the use of the scripts run by run-parts | ||
37 | PPP_IFACE="$1" | ||
38 | PPP_TTY="$2" | ||
39 | PPP_SPEED="$3" | ||
40 | PPP_LOCAL="$4" | ||
41 | PPP_REMOTE="$5" | ||
42 | PPP_IPPARAM="$6" | ||
43 | export 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. | ||
47 | PPP_TTYNAME=`/usr/bin/basename "$2"` | ||
48 | export PPP_TTYNAME | ||
49 | |||
50 | # If /var/log/ppp-ipupdown.log exists use it for logging. | ||
51 | if [ -e /var/log/ppp-ipupdown.log ]; then | ||
52 | exec > /var/log/ppp-ipupdown.log 2>&1 | ||
53 | fi | ||
54 | |||
55 | # This script can be used to override the .d files supplied by other packages. | ||
56 | if [ -x /etc/ppp/ip-${DIR}.local ]; then | ||
57 | exec /etc/ppp/ip-${DIR}.local | ||
58 | fi | ||
59 | |||
60 | run-parts -a "$1" -a "$2" -a "$3" -a "$4" -a "$5" -a "$6" \ | ||
61 | /etc/ppp/ip-${DIR}.d | ||
62 | |||
63 | if [ "$DIR" = "up" ] | ||
64 | then | ||
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 | ||
71 | fi | ||