Magellan Linux

Annotation of /trunk/initscripts/sysvinit/rc/network

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2911 - (hide annotations) (download)
Thu Nov 26 14:14:05 2015 UTC (8 years, 6 months ago) by niro
File size: 14507 byte(s)
-added point-to-point network support
1 niro 2 #!/bin/bash
2 niro 931 # $Id$
3 niro 2
4     #%rlevels: 0:k 1:k 2:k 3:s 4:s 5:s 6:k
5     #%start: 20
6     #%stop: 80
7    
8     #deps
9     #%needs:
10     #%before:
11     #%after:
12    
13 niro 781 source /etc/conf.d/rc
14 niro 20 source ${rc_functions}
15 niro 1363 source /etc/conf.d/network
16 niro 2
17 niro 2382 iface_wait_online()
18 niro 2305 {
19 niro 2312 local timeout="$1"
20 niro 2305 local iface="$2"
21    
22     (( timeout *= 10 ))
23    
24     while [ ! -e /sys/class/net/${iface} ]
25     do
26     (( timeout-- > 0 )) || return 1
27     sleep 0.1
28     done
29    
30     return 0
31     }
32    
33 niro 2383 iface_has_link()
34     {
35     local interface="$1"
36     local flags
37    
38     [[ -n ${interface} ]] || return 2
39     interface="/sys/class/net/${interface}"
40     [[ -d ${interface} ]] || return 2
41     flags=$(cat ${interface}/flags)
42     echo $((${flags}|0x41)) > ${interface}/flags # 0x41: IFF_UP|IFF_RUNNING
43     [ "$(cat ${interface}/carrier)" = 1 ] || return 1
44     }
45    
46 niro 243 # read values from files
47     read_value()
48     {
49     local var="$1"
50     local file="$2"
51     local value
52    
53     # local all possible vars
54     # global
55     local ONBOOT
56     local NETWORKING
57 niro 691
58 niro 243 # static
59     local IP
60     local NETMASK
61     local BROADCAST
62     local NETWORKING
63     local FORCE_MAC_TO
64    
65     # dhcp
66     local DHCP_PROG
67     local DHCP_START
68     local DHCP_STOP
69    
70     # default gw
71     local GATEWAY
72     local GATEWAY_IF
73    
74     # wireless extensions
75     local WIRELESS_AP
76     local WIRELESS_AUTH_MODE
77     local WIRELESS_BITRATE
78     local WIRELESS_CHANNEL
79     local WIRELESS_DEFAULT_KEY
80     local WIRELESS_ESSID
81     local WIRELESS_FREQUENCY
82     local WIRELESS_KEY
83     local WIRELESS_KEY_ASCII
84     local WIRELESS_KEY_0
85     local WIRELESS_KEY_1
86     local WIRELESS_KEY_2
87     local WIRELESS_KEY_3
88     local WIRELESS_KEY_LENGTH
89     local WIRELESS_MODE
90     local WIRELESS_NICK
91     local WIRELESS_NWID
92     local WIRELESS_POWER
93 niro 636 local WIRELESS_WPA_DRIVER
94 niro 243
95 niro 636 local BRIDGE_INTERFACES
96     local BRIDGE_STP
97 niro 1092 local BRIDGE_AGEING_TIME
98     local BRIDGE_PRIORITY
99     local BRIDGE_FORWARD_DELAY
100     local BRIDGE_HELLO_TIME
101     local BRIDGE_MAX_MESSAGE_AGE
102     local BRIDGE_PATH_COST
103     local BRIDGE_PORT_PRIORITY
104 niro 636
105 niro 2911 # point-to-point support
106     local POINTOPOINT
107    
108 niro 243 source ${file}
109     eval value=\$$(echo ${var})
110     echo "${value}"
111     }
112    
113     checkconfig()
114     {
115 niro 636 if [[ -z ${NETWORKING} ]]
116 niro 2 then
117 niro 1258 rc_echo "NETWORKING missing in net.${iface}, aborted"
118 niro 2 exit 1
119     fi
120    
121 niro 20 case "${NETWORKING}" in
122 niro 2 static)
123 niro 636 if [[ -z ${IP} ]]
124 niro 2 then
125 niro 1258 rc_echo "IP missing in net.${iface}, aborted"
126 niro 2 exit 1
127     fi
128    
129 niro 636 if [[ -z ${NETMASK} ]]
130 niro 2 then
131 niro 1258 rc_echo -n "NETMASK missing in net.${iface}, "
132 niro 1363 rc_echo "using ${DEFAULT_NETMASK}"
133     NETMASK="${DEFAULT_NETMASK}"
134 niro 2 fi
135    
136 niro 636 if [[ -z ${BROADCAST} ]]
137 niro 2 then
138 niro 1258 rc_echo -n "BROADCAST missing in net.${iface}, "
139     rc_echo "using default address"
140 niro 2 fi
141     ;;
142 niro 20
143 niro 2 dhcp)
144 niro 636 if [[ -z ${DHCP_PROG} ]]
145 niro 2 then
146 niro 1258 rc_echo -n "DHCP_PROG missing in net.${iface},"
147 niro 1363 rc_echo "using default programm ${DEFAULT_DHCP_PROG}"
148     DHCP_PROG="${DEFAULT_DHCP_PROG}"
149 niro 2 fi
150 niro 1363 [[ -z ${DHCP_START} ]] && DHCP_START="${DEFAULT_DHCP_START}"
151     [[ -z ${DHCP_STOP} ]] && DHCP_STOP="${DEFAULT_DHCP_STOP}"
152 niro 2 ;;
153 niro 20
154 niro 2 esac
155     }
156    
157 niro 243 # onboot_interface_list /path/to/files*
158     onboot_interface_list()
159     {
160     local file
161     local devices
162     local iface
163 niro 2
164 niro 243 # get list of all devices
165     for file in $@
166     do
167 niro 1258 iface="$(basename ${file} | sed s/net.//)"
168    
169     # exclude backup files and exclude net.routes and net.sample too
170     case "${iface}" in
171     *~) continue ;;
172     routes) continue ;;
173     sample) continue ;;
174     esac
175    
176 niro 243 if [[ $(read_value ONBOOT ${file}) = yes ]]
177     then
178 niro 1258 devices="${devices} ${iface}"
179 niro 243 fi
180     done
181 niro 181
182 niro 243 echo "${devices}"
183     }
184 niro 181
185 niro 268 config_wireless_wep()
186     {
187     local iface="$1"
188    
189     if [[ -z ${iface} ]]
190     then
191 niro 1258 rc_echo "WEP: no \$iface given. Aborting setup."
192 niro 268 return 1
193     fi
194    
195 niro 270 ${CURS_UP}
196     ${SET_WWCOL}
197 niro 1258 rc_echo "[AUTH: WEP]"
198 niro 270
199 niro 268 iwconfig "${iface}" enc on
200     [[ -n ${WIRELESS_KEY_LENGTH} ]] && iwconfig "${iface}" enc "${WIRELESS_KEY_LENGTH}"
201     [[ -n ${WIRELESS_KEY} ]] && iwconfig "${iface}" key "${WIRELESS_KEY}"
202     [[ -n ${WIRELESS_KEY_ASCII} ]] && iwconfig "${iface}" key s:"${WIRELESS_KEY_ASCII}"
203     }
204    
205     config_wireless_wpa()
206     {
207     local iface="$1"
208    
209     if [[ -z ${iface} ]]
210     then
211 niro 1258 rc_echo "WPA: no \$iface given. Aborting setup."
212 niro 268 return 1
213     fi
214    
215 niro 2063 if [ ! -x $(type -P wpa_supplicant) ]
216 niro 268 then
217 niro 1258 rc_echo "WPA: wpa_supplicant not installed. Aborting setup."
218 niro 268 return 1
219     fi
220    
221 niro 270 ${CURS_UP}
222     ${SET_WWCOL}
223 niro 1258 rc_echo "[AUTH: WPA]"
224 niro 270
225 niro 268 # get default settings
226     [[ -f /etc/conf.d/wpa_supplicant ]] && source /etc/conf.d/wpa_supplicant
227    
228     # check the configuration
229 niro 2031 [[ -z ${WIRELESS_WPA_CONFIG} ]] && WIRELESS_WPA_CONFIG=/etc/wpa_supplicant/wpa_supplicant.auto
230 niro 268 [[ -z ${WIRELESS_WPA_SKEL} ]] && WIRELESS_WPA_SKEL=/etc/conf.d/wpa_supplicant.skel
231    
232 niro 872 # use wext as default driver, do not abort here anymore
233     [[ -z ${WIRELESS_WPA_DRIVER} ]] && WIRELESS_WPA_DRIVER=wext
234    
235 niro 268 # write a config with the settings from net.${iface}
236     # only wpa-psk ! all other needs manual setup
237     if [[ ${WIRELESS_WPA_AUTOCONF} = true ]]
238     then
239     # write default cfg from skeleton
240     cat ${WIRELESS_WPA_SKEL} > ${WIRELESS_WPA_CONFIG}
241    
242 niro 867 local wpa_proto
243     case ${WIRELESS_AUTH_MODE} in
244     wpa) wpa_proto="WPA" ;;
245     wpa2) wpa_proto="WPA2" ;;
246     esac
247    
248 niro 268 # setup the network entry
249     sed -i -e "s:@WIRELESS_ESSID@:${WIRELESS_ESSID}:g" \
250 niro 867 -e "s:@WIRELESS_KEY@:${WIRELESS_KEY_ASCII}:g" \
251     -e "s:@WIRELESS_AUTH_MODE@:${wpa_proto}:g" \
252 niro 268 ${WIRELESS_WPA_CONFIG}
253     fi
254    
255 niro 275 # remove old state dir
256 niro 1665 [ -d /run/wpa_supplicant ] && rm -rf /run/wpa_supplicant
257 niro 275
258 niro 268 # now run the wpa_supplicant dameon
259     wpa_supplicant -B \
260     -D"${WIRELESS_WPA_DRIVER}" \
261     -c"${WIRELESS_WPA_CONFIG}" \
262     -i"${iface}" \
263     ${WIRELESS_WPA_OPTS}
264 niro 270
265     # echo wait 5 seconds
266 niro 1258 rc_echo " Waiting 5 seconds to retrieve authentification reply ... "
267 niro 270 sleep 5
268 niro 268 }
269    
270     setup_wireless_extensions()
271     {
272     local iface="$1"
273    
274     if [[ -z ${iface} ]]
275     then
276 niro 1258 rc_echo "WIRELESS_EXTENSIONS: no \$iface given. Aborting setup."
277 niro 268 return 1
278     fi
279    
280 niro 275 if [[ -n ${WIRELESS_BITRATE} ]] ||
281     [[ -n ${WIRELESS_CHANNEL} ]] ||
282     [[ -n ${WIRELESS_ESSID} ]] ||
283     [[ -n ${WIRELESS_FREQUENCY} ]] ||
284     [[ -n ${WIRELESS_MODE} ]] ||
285     [[ -n ${WIRELESS_NICK} ]] ||
286     [[ -n ${WIRELESS_AUTH_MODE} ]]
287     then
288 niro 1258 rc_print "Setting up wlan-ext for ${COLBLUE}${iface}${COLDEFAULT} ... "
289 niro 275 fi
290 niro 270
291 niro 268 [[ -n ${WIRELESS_BITRATE} ]] && iwconfig "${iface}" rate "${WIRELESS_BITRATE}"
292     [[ -n ${WIRELESS_CHANNEL} ]] && iwconfig "${iface}" channel "${WIRELESS_CHANNEL}"
293     [[ -n ${WIRELESS_ESSID} ]] && iwconfig "${iface}" essid "${WIRELESS_ESSID}"
294     [[ -n ${WIRELESS_FREQUENCY} ]] && iwconfig "${iface}" freq "${WIRELESS_FREQUENCY}"
295     [[ -n ${WIRELESS_MODE} ]] && iwconfig "${iface}" mode "${WIRELESS_MODE}"
296     [[ -n ${WIRELESS_NICK} ]] && iwconfig "${iface}" nick "${WIRELESS_NICK}"
297    
298     case "${WIRELESS_AUTH_MODE}" in
299 niro 867 wpa|wpa2) config_wireless_wpa "${iface}" ;;
300     wep|on) config_wireless_wep "${iface}" ;;
301     off) iwconfig "${iface}" enc off ;;
302 niro 268 esac
303     }
304    
305 niro 1092 config_bridge_options()
306     {
307     local iface="$1"
308     local i
309     local port
310     local cost
311     local prio
312    
313     # enable spanning-tree protocol
314     case ${BRIDGE_STP} in
315     on|off) brctl stp "${iface}" "${BRIDGE_STP}" ;;
316 niro 1258 *) rc_echo "BRIDGE: unkown value \$BRIDGE_STP='$BRIDGE_STP'."; return 1 ;;
317 niro 1092 esac
318    
319     # configure ageing time
320     if [[ ! -z ${BRIDGE_AGEING_TIME} ]]
321     then
322     brctl setageing "${iface}" "${BRIDGE_AGEING_TIME}"
323     fi
324    
325     # configure bridge priority
326     if [[ ! -z ${BRIDGE_PRIORITY} ]]
327     then
328     brctl setbridgeprio "${iface}" "${BRIDGE_PRIORITY}"
329     fi
330    
331     # configure forward delay
332     if [[ ! -z ${BRIDGE_FORWARD_DELAY} ]]
333     then
334     brctl setfd "${iface}" "${BRIDGE_FORWARD_DELAY}"
335     fi
336    
337     # configure hello time
338     if [[ ! -z ${BRIDGE_HELLO_TIME} ]]
339     then
340     brctl sethello "${iface}" "${BRIDGE_HELLO_TIME}"
341     fi
342    
343     # configure maximal message age
344     if [[ ! -z ${BRIDGE_MAX_MESSAGE_AGE} ]]
345     then
346     brctl setmaxage "${iface}" "${BRIDGE_MAX_MESSAGE_AGE}"
347     fi
348    
349     # configure path cost for every port
350     if [[ ! -z ${BRIDGE_PATH_COST} ]]
351     then
352     for i in ${BRIDGE_PATH_COST}
353     do
354     port="${i%=*}"
355     cost="${i#*=}"
356     [[ ! -z ${port} ]] && brctl pathcost "${iface}" "${port}" "${cost}"
357     done
358     fi
359    
360     # configure port priority for every port
361     if [[ ! -z ${BRIDGE_PORT_PRIORITY} ]]
362     then
363     for i in ${BRIDGE_PORT_PRIORITY}
364     do
365     port="${i%=*}"
366     prio="${i#*=}"
367     [[ ! -z ${port} ]] && brctl setportprio "${iface}" "${port}" "${prio}"
368     done
369     fi
370     }
371    
372 niro 506 config_bridge_devices()
373     {
374     local iface="$1"
375     local method="$2"
376 niro 636 local bport
377 niro 506
378     if [[ -z ${iface} ]]
379     then
380 niro 1258 rc_echo "BRIDGE: no \$iface given. Aborting setup."
381 niro 506 return 1
382     fi
383    
384     if [[ -z ${method} ]]
385     then
386 niro 1258 rc_echo "BRIDGE: no \$method given. Aborting setup."
387 niro 506 return 1
388     fi
389    
390     # first check for brctl
391 niro 2030 if [[ -z $(type -P brctl) ]]
392 niro 506 then
393 niro 1258 rc_echo "brctl not found! Please install 'net-misc/bridge-utils'."
394 niro 506 return 1
395     fi
396    
397     # check the config
398 niro 638 if [[ -z ${BRIDGE_INTERFACES} ]]
399 niro 506 then
400 niro 1258 rc_echo "BRIDGE: no \$BRIDGE_INTERFACES given. Aborting setup."
401 niro 506 return 1
402     fi
403    
404     case ${method} in
405     add)
406     # setup the bridge device
407 niro 1092 brctl addbr "${iface}"
408 niro 636 for bport in ${BRIDGE_INTERFACES}
409     do
410     # enter promiscous mode
411 niro 1092 ifconfig "${bport}" 0.0.0.0 promisc
412 niro 636 # now setup the bridge
413 niro 1092 brctl addif "${iface}" "${bport}"
414 niro 636 done
415 niro 1092 # configure all other options
416     config_bridge_options "${iface}"
417 niro 506 ;;
418 niro 636
419 niro 506 remove)
420 niro 636 for bport in ${BRIDGE_INTERFACE}
421     do
422     # bring the interface down
423 niro 1092 ifconfig "${bport}" down
424 niro 636 # remove the interface from the bridge
425 niro 1092 brctl delif "${iface}" "${bport}"
426 niro 636 done
427 niro 506 # bring the bridge down
428 niro 1092 brctl delbr "${iface}"
429 niro 506 ;;
430     esac
431 niro 636
432 niro 506 # unset the bridge variable to be safe
433 niro 636 unset BRIDGE_INTERFACES
434 niro 506 # continue to setup generic networking
435     }
436    
437     config_routes()
438     {
439     local method="$1"
440     local message
441    
442     # only add and del are allowed
443     case ${method} in
444 niro 1258 add) message="Adding" ;;
445     del) message="Removing" ;;
446 niro 506 *)
447 niro 1258 rc_echo "config_routes: unsupported \$method '${method}'."
448 niro 506 exit 1
449     ;;
450     esac
451    
452     # adds/delete user routes
453     if [[ -f /etc/conf.d/net.routes ]]
454     then
455     ( cat /etc/conf.d/net.routes; echo ) | # make sure there is a LF at the end
456     while read route
457     do
458     case "${route}" in
459     \#*|"") continue ;;
460     esac
461 niro 1258 rc_print "${message} route ${COLBLUE}${route}${COLDEFAULT} ..."
462     # do not esacpe ${route} or it breaks!
463     route "${method}" ${route}
464 niro 506 evaluate_retval
465     done
466     fi
467     }
468    
469 niro 243 networking_start()
470     {
471 niro 522 local iface dns routes ALL_INTERFACES
472 niro 243
473 niro 522 if [[ -z $1 ]]
474     then
475 niro 1091 ALL_INTERFACES=$(onboot_interface_list ${rc_network_settings}/net.*)
476 niro 522 else
477 niro 1091 if [[ -e ${rc_network_settings}/net.$1 ]]
478 niro 522 then
479     ALL_INTERFACES="$1"
480     else
481     ${FAILURE}
482 niro 1258 rc_echo "Interface $1 does not exist. Aborting"
483 niro 522 ${NORMAL}
484     exit 1
485     fi
486     fi
487    
488 niro 243 # get list of all devices
489 niro 522 for iface in ${ALL_INTERFACES}
490 niro 243 do
491     # checkconfig
492 niro 1091 source ${rc_network_settings}/net.${iface} || exit 1
493 niro 243 checkconfig
494    
495 niro 2305 # wait until the device is created
496 niro 2382 iface_wait_online 5 "${iface}" || { rc_echo "device '${iface}' does not exist"; continue; }
497 niro 2305
498 niro 270 # setup mac
499 niro 955 if [[ -n ${FORCE_MAC_TO} ]]
500 niro 270 then
501 niro 1258 rc_print "Faking MAC to ${FORCE_MAC_TO} for ${COLBLUE}${iface}${COLDEFAULT} ... "
502 niro 270 ifconfig "${iface}" hw ether "${FORCE_MAC_TO}"
503     evaluate_retval
504     fi
505    
506 niro 506 # setup bridges
507     if [[ ${iface} = br[0-9]* ]]
508     then
509 niro 1092 config_bridge_devices "${iface}" add
510 niro 506 fi
511    
512 niro 270 # now configure wireless_extensions
513 niro 2101 [ -x $(type -P iwconfig) ] && setup_wireless_extensions "${iface}"
514 niro 270
515 niro 1258 rc_print "Bringing up interface ${COLBLUE}${iface}${COLDEFAULT} ..."
516 niro 243
517 niro 868 # activate the interface
518     ifconfig "${iface}" up
519    
520 niro 243 # setup static or dhcp
521     case ${NETWORKING} in
522     dhcp|DHCP)
523     ${CURS_UP}
524     ${SET_WWCOL}
525 niro 1258 rc_echo "[DHCP]"
526 niro 2383 if iface_has_link "${iface}"
527     then
528     loadproc ${DHCP_PROG} ${DHCP_START} "${iface}"
529     else
530     rc_echo "Interface '${iface}' has no link. Not running '${DHCP_PROG}'."
531     fi
532 niro 2 ;;
533 niro 243 static|STATIC)
534     ${CURS_UP}
535     ${SET_WWCOL}
536 niro 1258 rc_echo "[STATIC]"
537 niro 243 ifconfig "${iface}" "${IP}" netmask "${NETMASK}" broadcast "${BROADCAST}"
538     evaluate_retval
539 niro 2911 if [[ -n ${POINTOPOINT} ]]
540     then
541     rc_echo "Adding point-to-point route to '${POINTOPOINT}' on interface '${iface}'"
542     ifconfig "${iface}" "${IP}" pointopoint "${POINTOPOINT}"
543     evaluate_retval
544     fi
545 niro 243 ;;
546     esac
547 niro 2
548 niro 243 # setup def gw
549     if [[ -n ${GATEWAY} ]]
550 niro 2 then
551 niro 1258 rc_print "Setting up default gateway for ${COLBLUE}${iface}${COLDEFAULT} ..."
552 niro 1092 route add default gateway "${GATEWAY}" metric 1 dev "${iface}"
553 niro 2 evaluate_retval
554 niro 684
555     unset GATEWAY
556 niro 2 fi
557    
558 niro 245 # setup /etc/resolv.conf
559 niro 1090 # add given nameserver
560 niro 245 if [[ -n ${NAMESERVER} ]]
561     then
562 niro 1258 rc_print "Setting up all nameserver for ${COLBLUE}${iface}${COLDEFAULT} ..."
563 niro 1090
564 niro 2306 # wipe out the old one
565 niro 1108 echo "# Generated by the magellan-initscripts for ${iface}" > /etc/resolv.conf
566     # include head
567     if [ -f /etc/resolv.conf.head ]
568     then
569     cat /etc/resolv.conf.head >> /etc/resolv.conf
570     else
571     echo "# /etc/resolv.conf.head can replace this line" >> /etc/resolv.conf
572     fi
573    
574 niro 245 for dns in ${NAMESERVER}
575     do
576     echo "nameserver ${dns}" >> /etc/resolv.conf
577     done
578 niro 684
579 niro 1108 # include tail
580     if [ -f /etc/resolv.conf.tail ]
581     then
582     cat /etc/resolv.conf.tail >> /etc/resolv.conf
583     else
584     echo "# /etc/resolv.conf.tail can replace this line" >> /etc/resolv.conf
585     fi
586    
587 niro 684 unset NAMESERVER
588 niro 245 fi
589 niro 243 done
590 niro 506
591     # setup user routes
592     config_routes add
593 niro 243 }
594 niro 2
595 niro 243 networking_stop()
596     {
597 niro 522 if [[ -z $1 ]]
598     then
599 niro 1091 ALL_INTERFACES=$(onboot_interface_list ${rc_network_settings}/net.*)
600 niro 522 else
601 niro 1091 if [[ -e ${rc_network_settings}/net.$1 ]]
602 niro 522 then
603     ALL_INTERFACES="$1"
604     else
605     ${FAILURE}
606 niro 1258 rc_echo "Interface $1 does not exist. Aborting"
607 niro 522 ${NORMAL}
608     exit 1
609     fi
610     fi
611    
612 niro 243 # get list of all devices
613 niro 522 for iface in ${ALL_INTERFACES}
614 niro 243 do
615 niro 1091 source ${rc_network_settings}/net.${iface} || exit 1
616 niro 243 checkconfig
617    
618     if [[ -n ${GATEWAY} ]]
619 niro 2 then
620 niro 1258 rc_print "Removing default gateway ..."
621 niro 2 route del -net default
622     evaluate_retval
623     fi
624    
625 niro 1258 rc_print "Bringing down interface ${COLBLUE}${iface}${COLDEFAULT} ..."
626     ifconfig "${iface}" down
627 niro 243 evaluate_retval
628 niro 2
629 niro 506 # remove bridges
630     if [[ ${iface} = br[0-9]* ]]
631     then
632 niro 1092 config_bridge_devices "${iface}" remove
633 niro 506 fi
634    
635 niro 243 # shutdown dhcp-daemon
636 niro 1276 if [[ ${NETWORKING} = dhcp ]] && [[ -n $(pidof $(basename ${DHCP_PROG})) ]]
637 niro 243 then
638 niro 1258 rc_print "Stopping the dhcp-daemon ..."
639 niro 243 ${CURS_UP}
640     ${SET_WWCOL}
641 niro 1258 rc_echo "[$(basename ${DHCP_PROG})]"
642     if [[ -z ${DHCP_STOP} ]]
643     then
644     killproc ${DHCP_PROG}
645     evaluate_retval
646     else
647     ${DHCP_PROG} ${DHCP_STOP} "${iface}"
648     evaluate_retval
649     fi
650 niro 243 fi
651 niro 268
652     # shutdown wpa_supplicant daemon
653     if [[ -n $(pidof wpa_supplicant) ]]
654     then
655     killall wpa_supplicant
656     fi
657 niro 243 done
658 niro 275
659 niro 270 # remove state dir
660 niro 1665 if [ -d /run/wpa_supplicant ]
661 niro 270 then
662 niro 1665 rm -rf /run/wpa_supplicant
663 niro 270 fi
664 niro 506
665     # delete user routes
666     config_routes del
667 niro 243 }
668 niro 2
669 niro 243 case $1 in
670     start)
671 niro 522 networking_start $2
672 niro 2 update_svcstatus $1
673 niro 243 splash svc_started "$(basename $0)" 0
674     ;;
675    
676     stop)
677 niro 522 networking_stop $2
678 niro 243 update_svcstatus $1
679 niro 2 splash svc_stopped "$(basename $0)" 0
680     ;;
681    
682     restart)
683     $0 stop
684     sleep 1
685     $0 start
686     ;;
687    
688     *)
689 niro 1258 rc_echo "Usage: $0 {start|stop|restart} [interface]"
690 niro 2 exit 1
691     ;;
692     esac

Properties

Name Value
svn:executable *