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