]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/net/red/pppoe
General-Fuctions gefixt, da der DHCP-Client die Strings mit einigen Leerstellen davor...
[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 1492"
57 ARGS+=" mru 1492 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 evaluate_retval
67
68 else
69 modprobe pppoe
70 PPPCOMMAND="/usr/sbin/pppd plugin rp-pppoe.so ${1}"
71 if [ "${DNS}" == "Automatic" ]; then
72 PPPCOMMAND+=" usepeerdns"
73 fi
74
75 if [ "${AUTH}" == "pap" ]; then
76 PPPCOMMAND+=" -chap"
77 elif [ "${AUTH}" == "chap" ]; then
78 PPPCOMMAND+=" -pap"
79 fi
80
81 if [ "${RECONNECTION}" != "persistent" ]; then
82 if [ "${TIMEOUT}" != "0" ]; then
83 SECONDS=$[${TIMEOUT} * 60]
84 PPPCOMMAND+=" idle ${SECONDS}"
85 fi
86 if [ "${RECONNECTION}" == "dialondemand" ]; then
87 touch /var/ipfire/red/dial-on-demand
88 PPPCOMMAND+=" demand nopersist"
89 fi
90 DEMAND+="active-filter outbound and not icmp[0] == 3 & not tcp[13] & 4 != 0"
91 fi
92
93 PPPCOMMAND+=" noipdefault defaultroute hide-password ipcp-accept-local"
94 PPPCOMMAND+=" ipcp-accept-remote passive noccp nopcomp novjccomp"
95 PPPCOMMAND+=" user ${USERNAME} lcp-echo-interval 20 lcp-echo-failure 3"
96 PPPCOMMAND+=" lcp-max-configure 50 maxfail ${MAXRETRIES}"
97
98 if [ "${DEBUG}" == "on" ]; then
99 PPPCOMMAND+=" debug"
100 fi
101
102 $PPPCOMMAND $DEMAND >/dev/null 2>&1
103 evaluate_retval
104 fi
105
106 ;;
107
108 down)
109 boot_mesg "Bringing down the PPPoE interface on ${1}..."
110
111 modprobe -r pppoe >/dev/null 2>&1
112 killall pppd
113 sleep 2
114 ip addr del 1.1.1.1/24 broadcast 1.1.1.255 dev ${1}
115
116 evaluate_retval
117 ;;
118
119 *)
120 echo "Usage: ${0} [interface] {up|down}"
121 exit 1
122 ;;
123 esac
124
125 # End $network_devices/services/pppoe