MTU MRU einstellbar bei PPoE
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / net / red / pppoe
1 #!/bin/sh
2 ########################################################################
3 # Begin $network_devices/services/pppoe
4 #
5 # Description : PPPoE Script
6 #
7 # Authors : Michael Tremer - mitch@ipfire.org
8 #
9 # Version : 01.00
10 #
11 # Notes :
12 #
13 ########################################################################
14
15 . /etc/sysconfig/rc
16 . ${rc_functions}
17 eval $(/usr/local/bin/readhash /var/ipfire/ppp/settings)
18
19 case "${2}" in
20 up)
21 boot_mesg "Bringing up the PPPoE interface on ${1}..."
22 ip addr add 1.1.1.1/24 broadcast 1.1.1.255 dev ${1}
23
24 if [ "${METHOD}" != "PPPOE_PLUGIN" ]; then
25 PPPCOMMAND="/usr/sbin/pppd pty"
26 PPPOECOMMAND="/usr/sbin/pppoe -p /var/run/pppoe.pid -I ${1} -T 80 -U -m 1412"
27 if [ -n ${SERVICENAME} ]; then
28 PPPOECOMMAND+=" -S ${SERVICENAME}"
29 fi
30 if [ -n ${CONCENTRATORNAME} ]; then
31 PPPOECOMMAND+=" -C ${CONCENTRATORNAME}"
32 fi
33
34 if [ "${DNS}" == "Automatic" ]; then
35 ARGS+=" usepeerdns"
36 fi
37
38 if [ "${AUTH}" == "pap" ]; then
39 ARGS+=" -chap"
40 elif [ "${AUTH}" == "chap" ]; then
41 ARGS+=" -pap"
42 fi
43
44 if [ "${RECONNECTION}" != "persistent" ]; then
45 if [ "${TIMEOUT}" != "0" ]; then
46 SECONDS=$[${TIMEOUT} * 60]
47 ARGS+=" idle ${SECONDS}"
48 fi
49 if [ "${RECONNECTION}" == "dialondemand" ]; then
50 touch /var/ipfire/red/dial-on-demand
51 ARGS+=" demand nopersist connect /bin/true"
52 fi
53 DEMAND+=" active-filter outbound and not icmp[0] == 3 and not tcp[13] & 4 != 0"
54 fi
55
56 ARGS+=" noipdefault default-asyncmap defaultroute hide-password local mtu ${MTU}"
57 ARGS+=" mru ${MRU} noaccomp noccp nobsdcomp nodeflate nopcomp novj novjccomp"
58 ARGS+=" user ${USERNAME} lcp-echo-interval 20 lcp-echo-failure 3 lcp-max-configure 50"
59 ARGS+=" maxfail ${MAXRETRIES}"
60
61 if [ "${DEBUG}" == "on" ]; then
62 ARGS+=" debug"
63 fi
64
65 $PPPCOMMAND "${PPPOECOMMAND}" $ARGS $DEMAND >/dev/null 2>&1
66 PID=$$
67 evaluate_retval
68 echo $PID > /var/run/ppp-ipfire.pid
69
70 else
71 modprobe pppoe
72 PPPCOMMAND="/usr/sbin/pppd plugin rp-pppoe.so ${1}"
73 if [ "${DNS}" == "Automatic" ]; then
74 PPPCOMMAND+=" usepeerdns"
75 fi
76
77 if [ "${AUTH}" == "pap" ]; then
78 PPPCOMMAND+=" -chap"
79 elif [ "${AUTH}" == "chap" ]; then
80 PPPCOMMAND+=" -pap"
81 fi
82
83 if [ "${RECONNECTION}" != "persistent" ]; then
84 if [ "${TIMEOUT}" != "0" ]; then
85 SECONDS=$[${TIMEOUT} * 60]
86 PPPCOMMAND+=" idle ${SECONDS}"
87 fi
88 if [ "${RECONNECTION}" == "dialondemand" ]; then
89 touch /var/ipfire/red/dial-on-demand
90 PPPCOMMAND+=" demand nopersist"
91 fi
92 DEMAND+="active-filter outbound and not icmp[0] == 3 & not tcp[13] & 4 != 0"
93 fi
94
95 PPPCOMMAND+=" noipdefault defaultroute hide-password ipcp-accept-local"
96 PPPCOMMAND+=" ipcp-accept-remote passive noccp nopcomp novjccomp"
97 PPPCOMMAND+=" user ${USERNAME} lcp-echo-interval 20 lcp-echo-failure 3"
98 PPPCOMMAND+=" lcp-max-configure 50 maxfail ${MAXRETRIES}"
99
100 if [ "${DEBUG}" == "on" ]; then
101 PPPCOMMAND+=" debug"
102 fi
103
104 $PPPCOMMAND $DEMAND >/dev/null 2>&1
105 PID=$$
106 evaluate_retval
107 echo $PID > /var/run/ppp-ipfire.pid
108 fi
109
110 ;;
111
112 down)
113 boot_mesg "Bringing down the PPPoE interface on ${1}..."
114
115 modprobe -r pppoe >/dev/null 2>&1
116 kill $(cat /var/run/pppd-ipfire.pid)
117 sleep 2
118 ip addr del 1.1.1.1/24 broadcast 1.1.1.255 dev ${1}
119
120 evaluate_retval
121 ;;
122
123 *)
124 echo "Usage: ${0} [interface] {up|down}"
125 exit 1
126 ;;
127 esac
128
129 # End $network_devices/services/pppoe