source: trunk/openwrt/package/ppp/files/ifup.pppoa @ 3401

Last change on this file since 3401 was 3401, checked in by nbd, 11 years ago

precompile ppp active filter (reduces libpcap overhead to only a few k), enable by default to support proper demand dialling, fixes #307

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.1 KB
Line 
1#!/bin/sh
2[ $# = 0 ] && { echo "  $0 <group>"; exit; }
3. /etc/functions.sh
4. /etc/network.overrides
5[ -e /etc/config/network ] && . /etc/config/network
6type=$1
7
8[ "$(nvram get ${type}_proto)" = "pppoa" ] || {
9        echo "$0: ${type}_proto isn't pppoa"
10        exit
11}
12
13for module in slhc ppp_generic pppoatm; do
14        /sbin/insmod $module 2>&- >&-
15done
16
17VPI=$(nvram get atm_vpi)
18VCI=$(nvram get atm_vci)
19USERNAME=$(nvram get ppp_username)
20PASSWORD=$(nvram get ppp_passwd)
21KEEPALIVE=$(nvram get ppp_redialperiod)
22KEEPALIVE=${KEEPALIVE:+lcp-echo-interval 1 lcp-echo-failure $KEEPALIVE}
23DEMAND=$(nvram get ppp_demand)
24case "$DEMAND" in
25        on|1|enabled)
26                DEMAND=$(nvram get ppp_idletime)
27                DEMAND=${IDLETIME:+demand idle $IDLETIME}
28                [ -f /etc/ppp/filter ] && DEMAND=${DEMAND:+precompiled-active-filter /etc/ppp/filter $DEMAND}
29        ;;
30        *) DEMAND="persist";;
31esac
32MTU=$(nvram get ppp_mtu)
33MTU=${MTU:-1500}
34
35/usr/sbin/pppd \
36        plugin pppoatm.so ${VPI:-8}.${VCI:-35} \
37        usepeerdns \
38        defaultroute \
39        linkname $type \
40        ipparam $type \
41        user "$USERNAME" \
42        password "$PASSWORD" \
43        mtu $MTU mru $MTU \
44        $DEMAND \
45        $KEEPALIVE
Note: See TracBrowser for help on using the repository browser.