]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/initscripts/init.d/networking/red
Add vlan8 with dhcpclient for vdsl-iptv
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / networking / red
CommitLineData
d1e90efc
MT
1#!/bin/sh
2########################################################################
3# Begin
4#
5# Description : RED Device Script
6#
7# Authors : Michael Tremer - mitch@ipfire.org
8# Maniacikarus - maniacikarus@ipfire.org
9# Inspired by : Nathan Coulson - nathan@linuxfromscratch.org
10# Kevin P. Fleming - kpfleming@linuxfromscratch.org
11#
12# Version : 01.00
13#
14# Notes :
15#
16########################################################################
17
40049855
AF
18
19
d1e90efc
MT
20. /etc/sysconfig/rc
21. ${rc_functions}
1f2ff0fa
AF
22
23eval $(/usr/local/bin/readhash /var/ipfire/main/settings)
24if [ "$RRDLOG" == "" ]; then
25 RRDLOG=/var/log/rrd
26fi
27
d1e90efc 28eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
b8c750f3
JPT
29eval $(/usr/local/bin/readhash /var/ipfire/mac/settings)
30
31MAC=$(tr - : <<<$MAC)
d1e90efc
MT
32
33TYPE="${RED_TYPE}"
34DEVICE="${RED_DEV}"
35
0dde24fa
MT
36if [ "$TYPE" == "STATIC" ] || [ "$TYPE" == "DHCP" ]; then
37 if [ "$DEVICE" == "" ]; then
38 boot_mesg "No device for red network. Please run setup." ${FAILURE}
39 echo_failure
40 [ "${1}" == "start" ] && exit 0
41 fi
42fi
43
44if [ "${TYPE}" == "STATIC" ]; then
45 if [ "${DEVICE}" != "${GREEN_DEV}" ]; then
46 ADDRESS="${RED_ADDRESS}"
47 BROADCAST="${RED_BROADCAST}"
48 NETADDRESS="${RED_NETADDRESS}"
49 NETMASK="${RED_NETMASK}"
50 else
51 ADDRESS="${GREEN_ADDRESS}"
52 BROADCAST="${GREEN_BROADCAST}"
53 NETADDRESS="${GREEN_NETADDRESS}"
54 NETMASK="${GREEN_NETMASK}"
55 fi
d1e90efc 56 GATEWAY="${DEFAULT_GATEWAY}"
0db33b56
MT
57 # DNS1
58 # DNS2
d1e90efc
MT
59
60 if [ -z "${BROADCAST}" ]; then
0dde24fa 61 boot_mesg "BROADCAST variable missing, cannot continue." ${FAILURE}
d1e90efc
MT
62 echo_failure
63 exit 1
64 fi
65 if [ -n "${ADDRESS}" -a -n "${NETMASK}" ]; then
66 PREFIX=`whatmask ${NETMASK} | grep -e ^CIDR | awk -F': ' '{ print $2 }' | cut -c 2-`
67 args="${args} ${ADDRESS}/${PREFIX} broadcast ${BROADCAST}"
68 else
69 boot_mesg "ADDRESS and/or NETMASK variable missing from input, cannot continue." ${FAILURE}
70 echo_failure
71 exit 1
72 fi
73
74elif [ "${TYPE}" == "DHCP" ]; then
75
76 PIDFILE="/var/run/dhcpcd-${DEVICE}.pid"
77 LEASEINFO="/var/ipfire/dhcpc/dhcpcd-${DEVICE}.info"
78 DHCP_START="-N -R -L /var/ipfire/dhcpc -c /var/ipfire/dhcpc/dhcpcd.exe "
79 DHCP_STOP="-k -c /var/ipfire/dhcpc/dhcpcd.exe "
80
81fi
82
83case "${1}" in
84 start)
0dde24fa
MT
85 if [ "${DEVICE}" != "${GREEN_DEV}" ] && [ "${DEVICE}" != "" ]; then
86 boot_mesg "Bringing up the ${DEVICE} interface..."
87 boot_mesg_flush
88 # Check if an interface is there...
89 if ip link show ${DEVICE} > /dev/null 2>&1; then
90 link_status=`ip link show ${DEVICE} 2> /dev/null`
91 if [ -n "${link_status}" ]; then
92 if ! echo "${link_status}" | grep -q UP; then
b8c750f3
JPT
93 if [ -n "$MAC" ]; then
94 boot_mesg "Setting mac address on ${DEVICE} to ${MAC}"
95 ip link set dev ${DEVICE} address ${MAC}
96 evaluate_retval
97 fi
0dde24fa
MT
98 ip link set ${DEVICE} up
99 fi
d1e90efc 100 fi
0dde24fa
MT
101 else
102 boot_mesg "Interface ${DEVICE} doesn't exist." ${FAILURE}
103 echo_failure
104 exit 1
d1e90efc 105 fi
d1e90efc 106 fi
6c33dc5c 107
1e4656cd
AF
108 ## Create & Enable vnstat
109 /usr/bin/vnstat -u -i ${DEVICE} -r --enable --force > /dev/null 2>&1
d1e90efc
MT
110
111 if [ "${TYPE}" == "STATIC" ]; then
0dde24fa
MT
112
113 if [ "$DEVICE" != "${GREEN_DEV}" ]; then
114 boot_mesg "Adding IPv4 address ${ADDRESS} to the ${DEVICE} interface..."
115 ip addr add ${args} dev ${DEVICE}
116 evaluate_retval
117 fi
0db33b56
MT
118 echo -n "${DEVICE}" > /var/ipfire/red/iface
119 echo -n "${ADDRESS}" > /var/ipfire/red/local-ipaddress
120 echo -n "${GATEWAY}" > /var/ipfire/red/remote-ipaddress
b2f872eb
AF
121 grep -v "gateway" /etc/hosts > /tmp/hosts
122 echo "$GATEWAY gateway" >> /tmp/hosts
123 mv /tmp/hosts /etc/hosts
0db33b56
MT
124 echo -n "${DNS1}" > /var/ipfire/red/dns1
125 echo -n "${DNS2}" > /var/ipfire/red/dns2
bcdde652 126 touch /var/ipfire/red/active
d1e90efc 127
040e5040
MT
128 boot_mesg "Setting up default gateway ${GATEWAY}..."
129 ip route add default via ${GATEWAY} dev ${DEVICE}
130 evaluate_retval
131
0e42072a 132 run_subdir ${rc_base}/init.d/networking/red.up/
bbe6aff7
AF
133
134 # Configure aliases only if red static
135 /usr/local/bin/setaliases
136
d1e90efc 137 elif [ "${TYPE}" == "DHCP" ]; then
7e0cd11d
AF
138
139 if [ -e $LEASEINFO ]; then
140 boot_mesg -n "Stopping dhcpcd on the ${DEVICE} interface..."
141 . $LEASEINFO
142 if [ "$LEASETIME" = "4294967295" ]; then
143 # do nothing, just echo ok
144 echo ""
145 echo_ok
146 else
147 if [ -n "$DHCP_STOP" ]; then
148 /sbin/dhcpcd ${DEVICE} $DHCP_STOP &> /dev/null
149 RET="$?"
150 if [ "$RET" -eq 0 ]; then
151 echo ""
152 echo_ok
153 elif [ "$RET" -eq 1 ]; then
154 boot_mesg "dhcpcd not running!" ${WARNING}
155 echo_warning
156 else
157 echo ""
158 echo_failure
159 fi
160 else
161 echo ""
162 killproc dhcpcd
163 fi
164 fi
165 fi
166
d1e90efc
MT
167 boot_mesg -n "Starting dhcpcd on the ${DEVICE} interface..."
168 echo -n "${DEVICE}" > /var/ipfire/red/iface
169
941e123e
AF
170 ## Create & Enable vnstat
171 /usr/bin/vnstat -u -i ${DEVICE} -r --enable --force > /dev/null 2>&1
172
d1e90efc
MT
173 # Test to see if there is a stale pid file
174 if [ -f "$PIDFILE" ]; then
175 ps `cat "$PIDFILE"` | grep dhcpcd > /dev/null
176 if [ $? != 0 ]; then
177 rm -f /var/run/dhcpcd-${DEVICE}.pid > /dev/null
178 else
179 boot_mesg "dhcpcd already running!" ${WARNING}
180 echo_warning
181 exit 2
182 fi
183 fi
184
185 iptables -A REDINPUT -p tcp --source-port 67 --destination-port 68 -i ${DEVICE} -j ACCEPT
186 iptables -A REDINPUT -p udp --source-port 67 --destination-port 68 -i ${DEVICE} -j ACCEPT
187
7f5fdd04
MT
188 if [ -n "${RED_DHCP_HOSTNAME}" ]; then
189 DHCP_START+="-h ${RED_DHCP_HOSTNAME} "
d1e90efc
MT
190 fi
191
192 /sbin/dhcpcd ${DEVICE} ${DHCP_START} >/dev/null 2>&1
193 RET="$?"
194
195 if [ "$RET" = "0" ]; then
196 . /var/ipfire/dhcpc/dhcpcd-${DEVICE}.info
197 echo ""
198 echo_ok
199 boot_mesg " DHCP Assigned Settings for ${DEVICE}:"
200 boot_mesg_flush
201 boot_mesg " IP Address: $IPADDR"
202 boot_mesg_flush
7f5fdd04
MT
203 if [ -n "${RED_DHCP_HOSTNAME}" ]; then
204 boot_mesg " Hostname: $RED_DHCP_HOSTNAME"
d1e90efc
MT
205 boot_mesg_flush
206 fi
207 boot_mesg " Subnet Mask: $NETMASK"
208 boot_mesg_flush
209 boot_mesg " Default Gateway: $GATEWAY"
210 boot_mesg_flush
211 boot_mesg " DNS Server: $DNS"
212 boot_mesg_flush
213
214 echo -n `/etc/rc.d/helper/getdnsfromdhcpc.pl 1` > /var/ipfire/red/dns1
215 echo -n `/etc/rc.d/helper/getdnsfromdhcpc.pl 2` > /var/ipfire/red/dns2
216
217 . /var/ipfire/dhcpc/dhcpcd-${DEVICE}.info
218 echo "$IPADDR" > /var/ipfire/red/local-ipaddress
a332b303
CS
219 grep -v "gateway" /etc/hosts > /tmp/hosts
220 echo "$GATEWAY gateway" >> /tmp/hosts
221 mv /tmp/hosts /etc/hosts
d1e90efc 222 echo "$GATEWAY" > /var/ipfire/red/remote-ipaddress
e288abb4 223 touch /var/ipfire/red/active
d1e90efc
MT
224 else
225 echo ""
226 $(exit "$RET")
227 evaluate_retval
228 fi
229
230 elif [ "$TYPE" == "PPPOE" ]; then
a89770fa
MT
231
232 if ( ps ax | grep -q [p]ppd ); then
0dde24fa
MT
233 boot_mesg "pppd is still running." ${FAILURE}
234 echo_failure
235 exit 1
a89770fa 236 fi
0dde24fa 237
d1e90efc
MT
238 eval $(/usr/local/bin/readhash /var/ipfire/ppp/settings)
239
905fbf3e 240 [ -c "/dev/ppp" ] || mknod /dev/ppp c 108 0
d1e90efc 241
a89770fa 242 PPP_NIC=${DEVICE}
40049855
AF
243
244 if [ "$TYPE" == "vdsl" ]; then
245 boot_mesg "Createing VLAN Interface ${DEVICE}.7 ..."
246 modprobe 8021q
247 vconfig add ${DEVICE} 7
248 PPP_NIC=${DEVICE}.7
249 sleep 0.2
250 ip link set ${PPP_NIC} up
251 TYPE="pppoe"
bbe6aff7
AF
252
253
254 PIDFILE="/var/run/dhcpcd-${DEVICE}.8.pid"
255 LEASEINFO="/var/ipfire/dhcpc/dhcpcd-${DEVICE}.8.info"
256 DHCP_START="-N -R -L /var/ipfire/dhcpc -c /var/ipfire/dhcpc/dhcpcd.exe "
257 DHCP_STOP="-k -c /var/ipfire/dhcpc/dhcpcd.exe "
258
259
260 # Test to see if there is a stale pid file
261 if [ -f "$PIDFILE" ]; then
262 ps `cat "$PIDFILE"` | grep dhcpcd > /dev/null
263 if [ $? != 0 ]; then
264 rm -f /var/run/dhcpcd-${DEVICE}.8.pid > /dev/null
265 fi
266 fi
267 if [ ! -f "$PIDFILE" ]; then
268 #DHCP for VDSL IPTV
269 boot_mesg "Createing VLAN Interface ${DEVICE}.8 ..."
270 vconfig add ${DEVICE} 8
271
272 boot_mesg -n "Starting dhcpcd on the ${DEVICE}.8 interface..."
273
274 /sbin/dhcpcd ${DEVICE}.8 ${DHCP_START} >/dev/null 2>&1
275 RET="$?"
276
277 if [ "$RET" = "0" ]; then
278 . /var/ipfire/dhcpc/dhcpcd-${DEVICE}.8.info
279 echo ""
280 echo_ok
281 boot_mesg " DHCP Assigned Settings for ${DEVICE}.8:"
282 boot_mesg_flush
283 boot_mesg " IP Address: $IPADDR"
284 boot_mesg_flush
285 boot_mesg " Hostname: $RED_DHCP_HOSTNAME"
286 boot_mesg_flush
287 boot_mesg " Subnet Mask: $NETMASK"
288 boot_mesg_flush
289 boot_mesg " Default Gateway: $GATEWAY"
290 boot_mesg_flush
291 boot_mesg " DNS Server: $DNS"
292 boot_mesg_flush
293
294 else
295 echo ""
296 $(exit "$RET")
297 evaluate_retval
298 fi
299 fi
40049855
AF
300 fi
301
5aae218d 302 if [ "$TYPE" == "pppoeatm" ] || [ "$TYPE" == "pptpatm" ]; then
a89770fa 303 PPP_NIC=nas0
0dde24fa 304 boot_mesg "Createing ATM-Bridge as $PPP_NIC ..."
a89770fa
MT
305 br2684ctl -c0 -e${ENCAP} -a0.${VPI}.${VCI} >/dev/null 2>&1 &
306 sleep 1
5aae218d
AF
307 if [ "$TYPE" == "pppoeatm" ]; then
308 TYPE="pppoe"
309 fi
310 if [ "$TYPE" == "pptpatm" ]; then
311 TYPE="pptp"
312 fi
a89770fa 313 fi
5aae218d 314 if [ "$TYPE" == "pppoe" ] || [ "$TYPE" == "pptp" ]; then
4cd4876a 315 if [ "$PPP_NIC" == "" ]; then
0dde24fa
MT
316 boot_mesg "No device for red interface given. Check netsetup or dialprofile!" ${FAILURE}
317 echo_failure
cb1fb691 318 exit 0
0dde24fa 319 fi
5aae218d 320 boot_mesg "Bringing up the $TYPE interface on $PPP_NIC ..."
58e9b9dc 321 ip addr flush dev $PPP_NIC >/dev/null 2>&1
5aae218d
AF
322 if [ "$TYPE" == "pptp" ]; then
323 ip addr add $PPTP_NICCFG dev $PPP_NIC
324 fi
58e9b9dc 325 ip link set ${PPP_NIC} up
27b8cc24
MT
326 else
327 boot_mesg "Bringing up the PPP via ${TYPE} on ${COMPORT}..."
328 fi
0dde24fa 329
905fbf3e
MT
330 ### ###
331 ### Configuring the pppd ###
332 ### ###
333
334 ### Plugin Options
335 #
5aae218d
AF
336 if [ "$TYPE" == "pppoe" ]; then
337 [ "${METHOD}" == "PPPOE_PLUGIN" ] && \
338 PLUGOPTS="plugin /usr/lib/pppd/2.4.4/rp-pppoe.so"
339 fi
d1e90efc 340
905fbf3e
MT
341 ### Synchronous Mode
342 #
343 #PPPOE_SYNC=-s
a89770fa
MT
344 #PPPD_SYNC=sync
345
346 ### Access Concentrator Name
347 #
905fbf3e
MT
348 if [ -n "${CONCENTRATORNAME}" ]; then
349 ACNAME="-C ${CONCENTRATORNAME}"
d1e90efc 350 fi
905fbf3e
MT
351
352 ### Service Name
353 #
354 if [ -n "${SERVICENAME}" ]; then
355 if [ "${METHOD}" == "PPPOE_PLUGIN" ]; then
356 PLUGOPTS+=" rp_pppoe_service ${SERVICENAME}"
357 else
358 SERVICENAME="-S ${SERVICENAME}"
359 fi
d1e90efc 360 fi
a89770fa 361
905fbf3e
MT
362 ### Authentication Types
363 #
d1e90efc 364 if [ "${AUTH}" == "pap" ]; then
905fbf3e 365 AUTH="-chap"
d1e90efc 366 elif [ "${AUTH}" == "chap" ]; then
905fbf3e 367 AUTH="-pap"
57cb9775
CS
368 else
369 AUTH=""
d1e90efc 370 fi
a89770fa
MT
371
372 ### DNS Config
373 #
374 if [ "${DNS}" == "Automatic" ]; then
375 DNS="usepeerdns"
376 else
377 DNS=""
378 echo nameserver=$DNS1 > /etc/ppp/resolv.conf
379 echo nameserver=$DNS2 >> /etc/ppp/resolv.conf
a89770fa
MT
380 fi
381
905fbf3e
MT
382 ### Dial On Demand
383 #
d1e90efc
MT
384 if [ "${RECONNECTION}" != "persistent" ]; then
385 if [ "${TIMEOUT}" != "0" ] && [ "${TIMEOUT}" != "" ]; then
386 SECONDS=$[${TIMEOUT} * 60]
905fbf3e
MT
387 else
388 SECONDS=300
d1e90efc
MT
389 fi
390 if [ "${RECONNECTION}" == "dialondemand" ]; then
391 touch /var/ipfire/red/dial-on-demand
905fbf3e 392 DEMAND="demand persist idle ${SECONDS} 10.112.112.112:10.112.112.113"
a89770fa 393 DEMAND+=" ipcp-accept-remote ipcp-accept-local noipdefault ktune"
d1e90efc 394 fi
905fbf3e
MT
395 fi
396
5aae218d
AF
397 if [ "$TYPE" == "pppoe" ]; then
398 ### When using pppoe-plugin the device has to be the last option
399 #
400 [ "${METHOD}" == "PPPOE_PLUGIN" ] && PLUGOPTS+=" $PPP_NIC"
401 fi
27b8cc24
MT
402
403 if [ "$TYPE" == "modem" ]; then
a89770fa 404 PLUGOPTS=" /dev/${COMPORT} ${DTERATE} connect /etc/ppp/dialer lock modem crtscts"
7c653e4b 405 METHOD="PPPOE_PLUGIN"
27b8cc24 406 elif [ "$TYPE" == "serial" ]; then
a89770fa 407 PLUGOPTS=" /dev/${COMPORT} ${DTERATE} connect /bin/true lock modem crtscts"
7c653e4b 408 METHOD="PPPOE_PLUGIN"
27b8cc24 409 fi
905fbf3e
MT
410
411 ### Standard PPP options we always use
412 #
a89770fa 413 PPP_STD_OPTIONS="$PLUGOPTS $DNS defaultroute noipdefault noauth"
905fbf3e
MT
414 PPP_STD_OPTIONS+=" default-asyncmap hide-password nodetach mtu ${MTU}"
415 PPP_STD_OPTIONS+=" mru ${MTU} noaccomp nodeflate nopcomp novj novjccomp"
416 PPP_STD_OPTIONS+=" nobsdcomp user ${USERNAME} lcp-echo-interval 20"
417 PPP_STD_OPTIONS+=" lcp-echo-failure 3 ${AUTH}"
a89770fa 418
905fbf3e
MT
419 ### Debugging
420 #
421 if [ "${DEBUG}" == "on" ]; then
422 DEBUG="debug"
d1e90efc 423 else
905fbf3e 424 DEBUG=""
d1e90efc
MT
425 fi
426
905fbf3e
MT
427 ### PPPoE invocation
428 #
a89770fa
MT
429 if [ "$TYPE" == "pppoe" ]; then
430 PPPOE_CMD="/usr/sbin/pppoe -p /var/run/ppp-ipfire.pid.pppoe -I $PPP_NIC"
27b8cc24
MT
431 PPPOE_CMD+=" -T 80 -U $PPPOE_SYNC $ACNAME $SERVICENAMEOPT"
432 fi
5aae218d
AF
433
434 ### PPTP ###
435 #
436 if [ "$TYPE" == "pptp" ]; then
437 PPPOE_CMD="pptp $PPTP_PEER --nolaunchpppd"
7c653e4b 438 METHOD=""
5aae218d 439 fi
d1e90efc 440
905fbf3e
MT
441 ### Run everything
442 #
7c653e4b 443 if [ "$METHOD" == "PPPOE_PLUGIN" ]; then
905fbf3e
MT
444 /usr/sbin/pppd $PPP_STD_OPTIONS $DEBUG $DEMAND >/dev/null 2>&1 &
445 evaluate_retval
a89770fa 446 # echo PLUGIN: /usr/sbin/pppd $PPP_STD_OPTIONS $DEBUG $DEMAND
905fbf3e
MT
447 else
448 /usr/sbin/pppd pty "$PPPOE_CMD" $PPP_STD_OPTIONS $DEBUG $DEMAND $PPPD_SYNC >/dev/null 2>&1 &
449 evaluate_retval
a89770fa 450 # echo PPP: /usr/sbin/pppd pty "$PPPOE_CMD" $PPP_STD_OPTIONS $DEBUG $DEMAND $PPPD_SYNC
905fbf3e 451 fi
1e4656cd
AF
452 ## Create & Enable vnstat
453 /usr/bin/vnstat -u -i ppp0 -r --enable --force > /dev/null 2>&1
905fbf3e 454 /etc/rc.d/init.d/connectd start
1f2ff0fa 455 # Add a NaN value to ppp0 rrd to supress spikes at reconnect
c772568a 456 rrdtool update $RRDLOG/collectd/localhost/interface/if_octets-ppp0.rrd \
49ab1173 457 $(date +%s):: > /dev/null 2>&1
28ec28bc 458 exit 0
d1e90efc 459 fi
d1e90efc
MT
460 ;;
461
462 stop)
463 if [ "$TYPE" == "STATIC" ]; then
0dde24fa
MT
464 boot_mesg "Stopping default gateway ${GATEWAY}..."
465 ip route del default via ${GATEWAY} >/dev/null 2>&1
466 echo_ok
467 if [ "$DEVICE" != "${GREEN_DEV}" ]; then
70631572
AF
468 boot_mesg "Removing IPv4 addresses from the ${DEVICE} interface..."
469 ip addr flush dev ${DEVICE}
0dde24fa
MT
470 evaluate_retval
471 fi
0e42072a 472 run_subdir ${rc_base}/init.d/networking/red.down/
f8841352 473
d1e90efc
MT
474 elif [ "$TYPE" == "DHCP" ]; then
475 boot_mesg -n "Stopping dhcpcd on the ${DEVICE} interface..."
476 if [ -e $LEASEINFO ]; then
477 . $LEASEINFO
478 if [ "$LEASETIME" = "4294967295" ]; then
479 # do nothing, just echo ok
480 echo ""
481 echo_ok
482 else
483 if [ -n "$DHCP_STOP" ]; then
484 /sbin/dhcpcd ${DEVICE} $DHCP_STOP &> /dev/null
485 RET="$?"
486 if [ "$RET" -eq 0 ]; then
487 echo ""
488 echo_ok
489 elif [ "$RET" -eq 1 ]; then
490 boot_mesg "dhcpcd not running!" ${WARNING}
491 echo_warning
492 else
493 echo ""
494 echo_failure
495 fi
496 else
497 echo ""
498 killproc dhcpcd
499 fi
500 fi
501 else
502 boot_mesg -n "LEASEINFO Test failed! - " ${WARNING}
503 boot_mesg "dhcpcd is not running!" ${WARNING}
504 echo_warning
d1e90efc 505 fi
941e123e 506
5aae218d 507 elif [ "$TYPE" == "PPPOE" ]; then
a89770fa 508 boot_mesg "Bringing down the PPP interface ..."
1e4656cd
AF
509 ## Disable vnstat collection
510 /usr/bin/vnstat -u -i ppp0 -r --disable > /dev/null 2>&1
93b34528 511 rm -f /var/ipfire/red/keepconnected
a89770fa 512 killall -w -s TERM /usr/sbin/pppd 2>/dev/null
352e626f 513 evaluate_retval
1f2ff0fa 514 # Add a NaN value to ppp0 rrd to supress spikes at reconnect
c772568a 515 rrdtool update $RRDLOG/collectd/localhost/interface/if_octets-ppp0.rrd \
49ab1173 516 $(date +%s):: > /dev/null 2>&1
d1e90efc 517 fi
0dde24fa
MT
518
519 if [ "$DEVICE" != "${GREEN_DEV}" ] && [ "$DEVICE" != "" ]; then
40049855
AF
520 link_status=`ip link show $DEVICE.7 2> /dev/null`
521 if [ -n "${link_status}" ]; then
522 if echo "${link_status}" | grep -q UP; then
523 boot_mesg "Bringing down the ${DEVICE}.7 interface..."
524 ip link set ${DEVICE}.7 down
525 vconfig del ${DEVICE} 7
526 evaluate_retval
527 fi
bbe6aff7
AF
528 else
529 link_status=`ip link show $DEVICE 2> /dev/null`
530 if [ -n "${link_status}" ]; then
531 if echo "${link_status}" | grep -q UP; then
532 boot_mesg "Bringing down the ${DEVICE} interface..."
533 ip link set ${DEVICE} down
534 evaluate_retval
535 fi
0dde24fa 536 fi
d1e90efc
MT
537 fi
538 fi
cb1fb691 539 killall -w -s KILL /usr/sbin/pppd >/dev/null 2>&1
5aae218d 540 killall -w -s KILL pptp >/dev/null 2>&1
cb1fb691 541 killall -w -s KILL br2684ctl >/dev/null 2>&1
6c33dc5c 542
1e4656cd
AF
543 ## Disable vnstat collection
544 /usr/bin/vnstat -u -i ${DEVICE} -r --disable > /dev/null 2>&1
ed35052a
AF
545
546 rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
6c33dc5c 547 exit 0;
d1e90efc 548 ;;
d1e90efc
MT
549esac
550
551# End