precompile ppp active filter (reduces libpcap overhead to only a few k), enable by...
[openwrt.git] / package / ppp / files / ifup.pppoe
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
6 type=$1
7
8 [ "$(nvram get ${type}_proto)" = "pppoe" ] || {
9 echo "$0: ${type}_proto isn't pppoe"
10 exit
11 }
12
13 for module in slhc ppp_generic pppox pppoe; do
14 /sbin/insmod $module 2>&- >&-
15 done
16
17 IFNAME=$(nvram get ${type}_device)
18 USERNAME=$(nvram get ppp_username)
19 PASSWORD=$(nvram get ppp_passwd)
20 KEEPALIVE=$(nvram get ppp_redialperiod)
21 KEEPALIVE=${KEEPALIVE:+lcp-echo-interval 1 lcp-echo-failure $KEEPALIVE}
22 DEMAND=$(nvram get ppp_demand)
23 case "$DEMAND" in
24 on|1|enabled)
25 DEMAND=$(nvram get ppp_idletime)
26 DEMAND=${IDLETIME:+demand idle $IDLETIME}
27 [ -f /etc/ppp/filter ] && DEMAND=${DEMAND:+precompiled-active-filter /etc/ppp/filter $DEMAND}
28 ;;
29 *) DEMAND="persist";;
30 esac
31 MTU=$(nvram get ppp_mtu)
32 MTU=${MTU:-1492}
33
34 ifconfig $IFNAME up
35 /usr/sbin/pppd \
36 plugin rp-pppoe.so \
37 connect /bin/true \
38 usepeerdns \
39 defaultroute \
40 linkname $type \
41 ipparam $type \
42 user "$USERNAME" \
43 password "$PASSWORD" \
44 mtu $MTU mru $MTU \
45 $DEMAND \
46 $KEEPALIVE \
47 nic-$IFNAME
48
This page took 0.07513 seconds and 5 git commands to generate.