diff options
Diffstat (limited to 'src/connections/ppp')
-rw-r--r-- | src/connections/ppp | 53 |
1 files changed, 10 insertions, 43 deletions
diff --git a/src/connections/ppp b/src/connections/ppp index ce3c8ab..9432323 100644 --- a/src/connections/ppp +++ b/src/connections/ppp @@ -1,58 +1,25 @@ #! /bin/bash -################################## -## -# /usr/lib/network/connections/ppp -## -################################## - -. /etc/rc.conf -. /etc/rc.d/functions . /usr/lib/network/network ppp_up() { - load_profile "$1" - [[ -z "$PEER" ]] && PEER=provider + load_profile $1 + [[ -z "$PEER" ]] && PEER="provider" [[ -z "$PPP_TIMEOUT" ]] && PPP_TIMEOUT=30 - if ! /usr/sbin/pppd call "$PEER" updetach child-timeout "$PPP_TIMEOUT" linkname "$PEER"; then - report_fail "Couldn't make pppd connection." - return 1 - fi + /usr/sbin/pppd call $PEER updetach child-timeout $PPP_TIMEOUT linkname $PEER - # wireless and wireless-dbus connections run this block when they call "ethernet up"; but ppp needs to do it itself - # successfully running a new profile; erase any suspended profiles on this interface - local interface="$INTERFACE" - find "$STATE_DIR/suspend/" -maxdepth 1 -type f -printf '%f\n' \ - | while read prof; do - # the pipe to "while read" will create a subshell, so sourced variables will already be in a sandbox - # we just need to clear INTERFACE which is all we care about - unset INTERFACE - . "$STATE_DIR/suspend/$prof" - if [[ "$interface" == "$INTERFACE" ]]; then - rm "$STATE_DIR/suspend/$prof" - fi - done + if [[ $? -ne 0 ]]; then + err_append "pppd connection failed" + exit 1 + fi } ppp_down() { - load_profile "$1" - kill $(head -1 "/var/run/ppp-$(basename "$PEER").pid") -} - -ppp_query() { - "$CONN_DIR/ethernet" query "$@" -} - -ppp_control() { - "$CONN_DIR/wireless" control "$@" -} - -ppp_verify() { - local INTERFACE="$1" - # do nothing + load_profile $1 + kill $(head -1 /var/run/ppp-$(basename $PEER).pid) } -ppp_$1 "$2" +ppp_$1 $2 exit $? # vim: set ts=4 et sw=4: |