55 lines
1.1 KiB
Bash
Executable File
55 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# This script is run by pppd after the link is established.
|
|
|
|
# Environnement variables:
|
|
|
|
# IFNAME: $1, interface name (pppi)
|
|
# DEVICE: $2, device name (atmi)
|
|
# IPLOCAL: $4, IP address
|
|
# IPREMOTE: $5, Remote IP address
|
|
|
|
# retain only characters after / (/dev/ttyUSB0)
|
|
|
|
IFNAME=${1:-}
|
|
DEVICE=${2:-}
|
|
DEVICE=${DEVICE##*/}
|
|
IPLOCAL=${4:-}
|
|
IPREMOTE=${5:-}
|
|
|
|
# for ppp over vpn DEVICE is empty
|
|
[ "$DEVICE" = '' ] && DEVICE=$IFNAME
|
|
|
|
. /etc/bewan/scripts/globals
|
|
. /etc/bewan/lib/base
|
|
|
|
base_log "$SCRIPTD/ppp-up6 $IFNAME $DEVICE $IPLOCAL-$IPREMOTE" debug
|
|
|
|
# PPP up on WAN interface
|
|
[ -f "$INTFD/$DEVICE/wanid" ] || exit 0
|
|
WANID=`cat $INTFD/$DEVICE/wanid`
|
|
|
|
# Take wan-up-down mutex
|
|
base_enter_critical 'wan-up-down'
|
|
|
|
# Get config parameters after taking lock
|
|
base_call_initd 'setparam'
|
|
|
|
# IPv6CP can't do anything on its own
|
|
# We need to call wanip6 to start autoconfd, dhcpv6 etc...
|
|
if [ -f $WAND/$WANID/wan_ip6 ]; then
|
|
ARG=restart
|
|
base_call_initd 'wanip6 inittab'
|
|
fi
|
|
|
|
# Release wan-up-down mutex
|
|
base_exit_critical 'wan-up-down'
|
|
|
|
|
|
|
|
# Alacn, 2017-01-26
|
|
if [ -f /var/run/ppp-$IFNAME.pid ]; then
|
|
cat /var/run/ppp-$IFNAME.pid >$WAND/$WANID/ppp6.pid
|
|
fi
|
|
|