/[baselayout]/trunk/sh/net.sh
Gentoo

Contents of /trunk/sh/net.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3091 - (hide annotations) (download) (as text)
Fri Nov 2 17:03:29 2007 UTC (10 years, 7 months ago) by uberlord
File MIME type: text/x-sh
File size: 13397 byte(s)
Fix up display for tab delimited foo
1 uberlord 2547 #!/sbin/runscript
2     # Copyright 1999-2007 Gentoo Foundation
3     # Distributed under the terms of the GNU General Public License v2
4    
5     MODULESDIR="${RC_LIBDIR}/net"
6     MODULESLIST="${RC_SVCDIR}/nettree"
7 uberlord 2565 _config_vars="config routes"
8 uberlord 2547
9     [ -z "${IN_BACKGROUND}" ] && IN_BACKGROUND=false
10    
11 uberlord 2763 description="Configures network interfaces."
12    
13 uberlord 3072 # Handy var so we don't have to embed new lines everywhere for array splitting
14     __IFS="
15     "
16    
17 uberlord 2547 depend() {
18 uberlord 2675 local IFACE=${SVCNAME#*.}
19     local IFVAR=$(echo -n "${IFACE}" | sed -e 's/[^[:alnum:]]/_/g')
20 uberlord 2547
21 uberlord 2675 need localmount
22 uberlord 2547 after bootmisc
23 uberlord 2675 provide net
24     case "${IFACE}" in
25 uberlord 2547 lo|lo0) ;;
26     *)
27     after net.lo net.lo0
28     local prov=
29     eval prov=\$RC_NEED_${IFVAR}
30     [ -n "${prov}" ] && need ${prov}
31     eval prov=\$RC_USE_${IFVAR}
32     [ -n "${prov}" ] && use ${prov}
33     eval prov=\$RC_BEFORE_${IFVAR}
34     [ -n "${prov}" ] && before ${prov}
35     eval prov=\$RC_AFTER_${IFVAR}
36     [ -n "${prov}" ] && after ${prov}
37     eval prov=\$RC_PROVIDE_${IFVAR}
38     [ -n "${prov}" ] && provide ${prov}
39     ;;
40 uberlord 2675 esac
41 uberlord 2547 }
42    
43     _shell_var() {
44 uberlord 2675 echo -n "$1" | sed -e 's/[^[:alnum:]]/_/g'
45 uberlord 2547 }
46    
47 uberlord 3067 # Support bash arrays - sigh
48 uberlord 2547 _get_array() {
49 uberlord 3067 local _a=
50 uberlord 2675 if [ -n "${BASH}" ] ; then
51 uberlord 2547 case "$(declare -p "$1" 2>/dev/null)" in
52 uberlord 2675 "declare -a "*)
53 uberlord 3067 eval "set -- \"\${$1[@]}\""
54     for _a in "$@"; do
55     printf "%s\n" "${_a}"
56     done
57     return 0
58 uberlord 2675 ;;
59 uberlord 2547 esac
60 uberlord 2675 fi
61 uberlord 2547
62 uberlord 3067 eval _a=\$$1
63     printf "%s" "${_a}"
64 uberlord 3072 printf "\n"
65 uberlord 3067 [ -n "${_a}" ]
66 uberlord 2547 }
67    
68     _wait_for_carrier() {
69 uberlord 2675 local timeout= efunc=einfon
70 uberlord 2547
71 uberlord 2675 _has_carrier && return 0
72 uberlord 2547
73 uberlord 2675 eval timeout=\$carrier_timeout_${IFVAR}
74     timeout=${timeout:-${carrier_timeout:-5}}
75 uberlord 2547
76 uberlord 2668 # Incase users don't want this nice feature ...
77     [ ${timeout} -le 0 ] && return 0
78    
79 uberlord 2768 [ "${RC_PARALLEL}" = "yes" ] && efunc=einfo
80 uberlord 2675 ${efunc} "Waiting for carrier (${timeout} seconds) "
81     while [ ${timeout} -gt 0 ] ; do
82 uberlord 2547 sleep 1
83     if _has_carrier ; then
84 uberlord 2768 [ "${efunc}" = "einfon" ] && echo
85 uberlord 2574 eend 0
86 uberlord 2675 return 0
87 uberlord 2547 fi
88     timeout=$((${timeout} - 1))
89 uberlord 2768 [ "${efunc}" = "einfon" ] && printf "."
90 uberlord 2675 done
91 uberlord 2547
92 uberlord 2768 [ "${efunc}" = "einfon" ] && echo
93 uberlord 2574 eend 1
94 uberlord 2675 return 1
95 uberlord 2547 }
96    
97     _netmask2cidr() {
98 uberlord 2675 local i= len=0
99 uberlord 2547
100 uberlord 2675 local IFS=.
101     for i in $1; do
102 uberlord 2547 while [ ${i} != "0" ] ; do
103 uberlord 2675 len=$((${len} + ${i} % 2))
104     i=$((${i} >> 1))
105 uberlord 2547 done
106 uberlord 2675 done
107 uberlord 2547
108 uberlord 2675 echo "${len}"
109 uberlord 2547 }
110    
111     _configure_variables() {
112 uberlord 2675 local var= v= t=
113 uberlord 2547
114 uberlord 2675 for var in ${_config_vars} ; do
115 uberlord 2547 local v=
116     for t in "$@" ; do
117 uberlord 2675 eval v=\$${var}_${t}
118     if [ -n "${v}" ] ; then
119 uberlord 2547 eval ${var}_${IFVAR}=\$${var}_${t}
120     continue 2
121     fi
122     done
123 uberlord 2675 done
124 uberlord 2547 }
125    
126     _show_address() {
127 uberlord 2675 einfo "received address $(_get_inet_address "${IFACE}")"
128 uberlord 2547 }
129    
130     # Basically sorts our modules into order and saves the list
131     _gen_module_list() {
132 uberlord 2712 local x= f= force=$1
133     if ! ${force} && [ -s "${MODULESLIST}" -a "${MODULESLIST}" -nt "${MODULESDIR}" ] ; then
134 uberlord 2547 local update=false
135     for x in "${MODULESDIR}"/* ; do
136 uberlord 2675 [ -e "${x}" ] || continue
137     if [ "${x}" -nt "${MODULESLIST}" ] ; then
138 uberlord 2547 update=true
139     break
140 uberlord 2675 fi
141 uberlord 2547 done
142     ${update} || return 0
143 uberlord 2675 fi
144 uberlord 2547
145 uberlord 2675 einfo "Caching network module dependencies"
146     # Run in a subshell to protect the main script
147     (
148     after() {
149 uberlord 2547 eval ${MODULE}_after="\"\${${MODULE}_after}\${${MODULE}_after:+ }$*\""
150 uberlord 2675 }
151 uberlord 2547
152 uberlord 2675 before() {
153 uberlord 2547 local mod=${MODULE}
154     local MODULE=
155     for MODULE in "$@" ; do
156 uberlord 2675 after "${mod}"
157 uberlord 2547 done
158 uberlord 2675 }
159 uberlord 2547
160 uberlord 2675 program() {
161 uberlord 2547 if [ "$1" = "start" -o "$1" = "stop" ] ; then
162 uberlord 2675 local s="$1"
163     shift
164     eval ${MODULE}_program_${s}="\"\${${MODULE}_program_${s}}\${${MODULE}_program_${s}:+ }$*\""
165 uberlord 2547 else
166 uberlord 2675 eval ${MODULE}_program="\"\${${MODULE}_program}\${${MODULE}_program:+ }$*\""
167 uberlord 2547 fi
168 uberlord 2675 }
169 uberlord 2547
170 uberlord 2675 provide() {
171 uberlord 2547 eval ${MODULE}_provide="\"\${${MODULE}_provide}\${${MODULE}_provide:+ }$*\""
172     local x
173     for x in $* ; do
174 uberlord 2675 eval ${x}_providedby="\"\${${MODULE}_providedby}\${${MODULE}_providedby:+ }${MODULE}\""
175 uberlord 2547 done
176 uberlord 2675 }
177 uberlord 2547
178 uberlord 2675 for MODULE in "${MODULESDIR}"/* ; do
179 uberlord 2547 sh -n "${MODULE}" || continue
180     . "${MODULE}" || continue
181     MODULE=${MODULE#${MODULESDIR}/}
182     MODULE=${MODULE%.sh}
183     eval ${MODULE}_depend
184     MODULES="${MODULES} ${MODULE}"
185 uberlord 2675 done
186 uberlord 2547
187 uberlord 2675 VISITED=
188     SORTED=
189     visit() {
190 uberlord 2547 case " ${VISITED} " in
191 uberlord 2675 *" $1 "*) return ;;
192 uberlord 2547 esac
193     VISITED="${VISITED} $1"
194    
195     eval AFTER=\$${1}_after
196     for MODULE in ${AFTER} ; do
197 uberlord 2675 eval PROVIDEDBY=\$${MODULE}_providedby
198     if [ -n "${PROVIDEDBY}" ] ; then
199 uberlord 2547 for MODULE in ${PROVIDEDBY} ; do
200 uberlord 2675 visit "${MODULE}"
201 uberlord 2547 done
202 uberlord 2675 else
203 uberlord 2547 visit "${MODULE}"
204 uberlord 2675 fi
205 uberlord 2547 done
206    
207     eval PROVIDE=\$${1}_provide
208     for MODULE in ${PROVIDE} ; do
209 uberlord 2675 visit "${MODULE}"
210 uberlord 2547 done
211    
212     eval PROVIDEDBY=\$${1}_providedby
213     [ -z "${PROVIDEDBY}" ] && SORTED="${SORTED} $1"
214 uberlord 2675 }
215 uberlord 2547
216 uberlord 2675 for MODULE in ${MODULES} ; do
217 uberlord 2547 visit "${MODULE}"
218 uberlord 2675 done
219 uberlord 2547
220 uberlord 2879 printf "" > "${MODULESLIST}"
221 uberlord 2675 i=0
222     for MODULE in ${SORTED} ; do
223 uberlord 2547 eval PROGRAM=\$${MODULE}_program
224     eval PROGRAM_START=\$${MODULE}_program_start
225     eval PROGRAM_STOP=\$${MODULE}_program_stop
226     eval PROVIDE=\$${MODULE}_provide
227     echo "module_${i}='${MODULE}'" >> "${MODULESLIST}"
228     echo "module_${i}_program='${PROGRAM}'" >> "${MODULESLIST}"
229     echo "module_${i}_program_start='${PROGRAM_START}'" >> "${MODULESLIST}"
230     echo "module_${i}_program_stop='${PROGRAM_STOP}'" >> "${MODULESLIST}"
231     echo "module_${i}_provide='${PROVIDE}'" >> "${MODULESLIST}"
232     i=$((${i} + 1))
233 uberlord 2675 done
234     echo "module_${i}=" >> "${MODULESLIST}"
235     )
236 uberlord 2547
237 uberlord 2675 return 0
238 uberlord 2547 }
239    
240     _load_modules() {
241 uberlord 2712 local starting=$1 mymods=
242    
243 uberlord 2675 # Ensure our list is up to date
244 uberlord 2712 _gen_module_list false
245     if ! . "${MODULESLIST}" ; then
246     _gen_module_list true
247     . "${MODULESLIST}"
248     fi
249 uberlord 2547
250 uberlord 2675 MODULES=
251     if [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ] ; then
252 uberlord 2547 eval mymods=\$modules_${IFVAR}
253     [ -z "${mymods}" ] && mymods=${modules}
254 uberlord 2675 fi
255 uberlord 2547
256 uberlord 2675 local i=-1 x= mod= f= provides=
257     while true ; do
258 uberlord 2547 i=$((${i} + 1))
259     eval mod=\$module_${i}
260     [ -z "${mod}" ] && break
261     [ -e "${MODULESDIR}/${mod}.sh" ] || continue
262    
263 uberlord 2675 eval set -- \$module_${i}_program
264 uberlord 2547 if [ -n "$1" ] ; then
265     x=
266     for x in "$@" ; do
267     [ -x "${x}" ] && break
268     done
269     [ -x "${x}" ] || continue
270 uberlord 2675 fi
271 uberlord 2547 if ${starting} ; then
272     eval set -- \$module_${i}_program_start
273     else
274     eval set -- \$module_${i}_program_stop
275     fi
276     if [ -n "$1" ] ; then
277     x=
278     for x in "$@" ; do
279     [ -x "${x}" ] && break
280     done
281     [ -x "${x}" ] || continue
282 uberlord 2675 fi
283 uberlord 2547
284     eval provides=\$module_${i}_provide
285     if ${starting} ; then
286 uberlord 2675 case " ${mymods} " in
287 uberlord 2547 *" !${mod} "*) continue ;;
288     *" !${provides} "*) [ -n "${provides}" ] && continue ;;
289 uberlord 2675 esac
290 uberlord 2547 fi
291     MODULES="${MODULES}${MODULES:+ }${mod}"
292    
293     # Now load and wrap our functions
294     if ! . "${MODULESDIR}/${mod}.sh" ; then
295 uberlord 2675 eend 1 "${SVCNAME}: error loading module \`${mod}'"
296     exit 1
297 uberlord 2547 fi
298    
299     [ -z "${provides}" ] && continue
300    
301     # Wrap our provides
302     local f=
303     for f in pre_start start post_start ; do
304 uberlord 2675 eval "${provides}_${f}() { type ${mod}_${f} >/dev/null 2>/dev/null || return 0; ${mod}_${f} \"\$@\"; }"
305 uberlord 2547 done
306    
307     eval module_${mod}_provides="${provides}"
308     eval module_${provides}_providedby="${mod}"
309 uberlord 2675 done
310 uberlord 2547
311 uberlord 2675 # Wrap our preferred modules
312     for mod in ${mymods} ; do
313 uberlord 2547 case " ${MODULES} " in
314 uberlord 2675 *" ${mod} "*)
315     eval x=\$module_${mod}_provides
316     [ -z "${x}" ] && continue
317     for f in pre_start start post_start ; do
318     eval "${x}_${f}() { type ${mod}_${f} >/dev/null 2>/dev/null || return 0; ${mod}_${f} \"\$@\"; }"
319     done
320     eval module_${x}_providedby="${mod}"
321     ;;
322 uberlord 2547 esac
323 uberlord 2675 done
324 uberlord 2547
325 uberlord 2675 # Finally remove any duplicated provides from our list if we're starting
326     # Otherwise reverse the list
327     local LIST="${MODULES}" p=
328     MODULES=
329     if ${starting} ; then
330 uberlord 2547 for mod in ${LIST} ; do
331 uberlord 2675 eval x=\$module_${mod}_provides
332     if [ -n "${x}" ] ; then
333 uberlord 2547 eval p=\$module_${x}_providedby
334     [ "${mod}" != "${p}" ] && continue
335 uberlord 2675 fi
336     MODULES="${MODULES}${MODULES:+ }${mod}"
337 uberlord 2547 done
338 uberlord 2675 else
339 uberlord 2547 for mod in ${LIST} ; do
340 uberlord 2675 MODULES="${mod}${MODULES:+ }${MODULES}"
341 uberlord 2547 done
342 uberlord 2675 fi
343 uberlord 2547
344 uberlord 2675 veinfo "Loaded modules: ${MODULES}"
345 uberlord 2547 }
346    
347     _load_config() {
348 uberlord 3067 local config="$(_get_array "config_${IFVAR}")"
349     local fallback="$(_get_array fallback_${IFVAR})"
350    
351 uberlord 2675 if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] ; then
352 uberlord 3086 [ "${config}" != "null" ] && config="127.0.0.1/8
353 uberlord 3067 ${config}"
354 uberlord 2675 else
355 uberlord 3067 if [ -z "${config}" ] ; then
356 uberlord 2675 ewarn "No configuration specified; defaulting to DHCP"
357 uberlord 3067 config="dhcp"
358 uberlord 2547 fi
359 uberlord 2675 fi
360 uberlord 2547
361 uberlord 2675 # We store our config in an array like vars
362     # so modules can influence it
363     config_index=0
364 uberlord 3072 local IFS="$__IFS"
365 uberlord 3067 for cmd in ${config}; do
366 uberlord 2547 eval config_${config_index}="'${cmd}'"
367     config_index=$((${config_index} + 1))
368 uberlord 2675 done
369     # Terminate the list
370     eval config_${config_index}=
371 uberlord 2547
372 uberlord 2675 config_index=0
373 uberlord 3067 for cmd in ${fallback}; do
374 uberlord 3084 eval fallback_${config_index}="'${cmd}'"
375 uberlord 2547 config_index=$((${config_index} + 1))
376 uberlord 2675 done
377     # Terminate the list
378     eval fallback_${config_index}=
379 uberlord 2547
380     # Don't set to zero, so any net modules don't have to do anything extra
381 uberlord 2675 config_index=-1
382 uberlord 2547 }
383    
384     start() {
385 uberlord 2675 local IFACE=${SVCNAME#*.} oneworked=false module=
386     local IFVAR=$(_shell_var "${IFACE}") cmd= metric=0 our_metric=$metric
387 uberlord 2547
388 uberlord 2675 einfo "Bringing up interface ${IFACE}"
389     eindent
390 uberlord 2547
391 uberlord 2675 if [ -z "${MODULES}" ] ; then
392 uberlord 2547 local MODULES=
393     _load_modules true
394 uberlord 2675 fi
395 uberlord 2547
396 uberlord 2742 # We up the iface twice if we have a preup to ensure it's up if
397     # available in preup and afterwards incase the user inadvertently
398     # brings it down
399 uberlord 2675 if type preup >/dev/null 2>/dev/null ; then
400 uberlord 2742 _up 2>/dev/null
401 uberlord 2547 ebegin "Running preup"
402     eindent
403     preup || return 1
404     eoutdent
405 uberlord 2675 fi
406 uberlord 2547
407 uberlord 2742 _up 2>/dev/null
408    
409 uberlord 2675 for module in ${MODULES} ; do
410 uberlord 2547 if type "${module}_pre_start" >/dev/null 2>/dev/null ; then
411 uberlord 2675 if ! ${module}_pre_start ; then
412 uberlord 2547 eend 1
413     exit 1
414 uberlord 2675 fi
415 uberlord 2547 fi
416 uberlord 2675 done
417 uberlord 2547
418 uberlord 2624 if ! _exists ; then
419     eerror "ERROR: interface ${IFACE} does not exist"
420     eerror "Ensure that you have loaded the correct kernel module for your hardware"
421     return 1
422     fi
423    
424 uberlord 2574 if ! _wait_for_carrier ; then
425     if service_started devd ; then
426     ewarn "no carrier, but devd will start us when we have one"
427     mark_service_inactive "${SVCNAME}"
428     else
429     eerror "no carrier"
430     fi
431     return 1
432     fi
433    
434 uberlord 2675 local config= config_index=
435     _load_config
436 uberlord 2547 config_index=0
437    
438 uberlord 2675 if [ -n "${our_metric}" ] ; then
439 uberlord 2547 metric=${our_metric}
440 uberlord 2675 elif [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ] ; then
441 uberlord 2547 metric=$((${metric} + $(_ifindex)))
442 uberlord 2675 fi
443 uberlord 2547
444 uberlord 2675 while true ; do
445 uberlord 2547 eval config=\$config_${config_index}
446     [ -z "${config}" ] && break
447    
448     set -- "${config}"
449 uberlord 3091 ebegin $1
450 uberlord 2547 eindent
451     case "$1" in
452 uberlord 2675 noop)
453     if [ -n "$(_get_inet_address)" ] ; then
454 uberlord 2547 oneworked=true
455     break
456 uberlord 2675 fi
457     ;;
458     null) : ;;
459     [0-9]*|*:*) _add_address ${config} ;;
460     *)
461     if type "${config}_start" >/dev/null 2>/dev/null ; then
462 uberlord 2547 "${config}"_start
463 uberlord 2675 else
464 uberlord 2547 eerror "nothing provides \`${config}'"
465 uberlord 2675 fi
466     ;;
467 uberlord 2547 esac
468     if eend $? ; then
469 uberlord 2675 oneworked=true
470 uberlord 2547 else
471 uberlord 2880 eval config=\$fallback_${config_index}
472 uberlord 2675 if [ -n "${config}" ] ; then
473 uberlord 2880 eoutdent
474     ewarn "Trying fallback configuration ${config}"
475     eindent
476     eval config_${config_index}=\$config
477     unset fallback_${config_index}
478 uberlord 2547 config_index=$((${config_index} - 1))
479 uberlord 2675 fi
480 uberlord 2547 fi
481     eoutdent
482     config_index=$((${config_index} + 1))
483 uberlord 2675 done
484 uberlord 2547
485     if ! ${oneworked} ; then
486 uberlord 2675 if type failup >/dev/null 2>/dev/null ; then
487 uberlord 2547 ebegin "Running failup"
488     eindent
489     failup
490     eoutdent
491 uberlord 2675 fi
492 uberlord 2547 return 1
493     fi
494    
495 uberlord 3067 local hidefirstroute=false first=true
496     local routes="$(_get_array "routes_${IFVAR}")"
497 uberlord 2675 if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] ; then
498 uberlord 3086 if [ "${config_0}" != "null" ]; then
499     routes="127.0.0.0/8 via 127.0.0.1
500 uberlord 3067 ${routes}"
501 uberlord 3086 hidefirstroute=true
502     fi
503 uberlord 2675 fi
504 uberlord 3072 local IFS="$__IFS"
505 uberlord 3067 for cmd in ${routes}; do
506     unset IFS
507     if ${first}; then
508 uberlord 2675 first=false
509     einfo "Adding routes"
510 uberlord 2547 fi
511     eindent
512 uberlord 3091 ebegin ${cmd}
513 uberlord 2547 # Work out if we're a host or a net if not told
514     case "${cmd}" in
515 uberlord 2675 *" -net "*|*" -host "*) ;;
516     *" netmask "*) cmd="-net ${cmd}" ;;
517     *)
518     case "${cmd%% *}" in
519 uberlord 2547 *.*.*.*/32) cmd="-host ${cmd}" ;;
520     *.*.*.*/*|0.0.0.0|default) cmd="-net ${cmd}" ;;
521     *) cmd="-host ${cmd}" ;;
522 uberlord 2675 esac
523     ;;
524 uberlord 2547 esac
525     if ${hidefirstroute} ; then
526 uberlord 2675 _add_route ${cmd} >/dev/null 2>/dev/null
527     hidefirstroute=false
528 uberlord 2547 else
529 uberlord 2675 _add_route ${cmd} >/dev/null
530 uberlord 2547 fi
531     eend $?
532     eoutdent
533 uberlord 2675 done
534 uberlord 3072 unset IFS
535 uberlord 2547
536 uberlord 2675 for module in ${MODULES} ; do
537 uberlord 2547 if type "${module}_post_start" >/dev/null 2>/dev/null ; then
538 uberlord 2675 if ! ${module}_post_start ; then
539     eend 1
540     exit 1
541     fi
542 uberlord 2547 fi
543 uberlord 2675 done
544 uberlord 2547
545 uberlord 2675 if type postup >/dev/null 2>/dev/null ; then
546 uberlord 2547 ebegin "Running postup"
547     eindent
548     postup
549     eoutdent
550 uberlord 2675 fi
551 uberlord 2547
552 uberlord 2675 return 0
553 uberlord 2547 }
554    
555     stop() {
556 uberlord 2675 local IFACE=${SVCNAME#*.} module=
557     local IFVAR=$(_shell_var "${IFACE}") opts=
558 uberlord 2547
559 uberlord 2675 einfo "Bringing down interface ${IFACE}"
560     eindent
561 uberlord 2547
562 uberlord 2675 if [ -z "${MODULES}" ] ; then
563 uberlord 2547 local MODULES=
564     _load_modules false
565 uberlord 2675 fi
566 uberlord 2547
567 uberlord 2675 if type predown >/dev/null 2>/dev/null ; then
568 uberlord 2547 ebegin "Running predown"
569     eindent
570     predown || return 1
571     eoutdent
572 uberlord 2951 else
573     if is_net_fs /; then
574     eerror "root filesystem is network mounted -- can't stop ${IFACE}"
575     return 1
576     fi
577 uberlord 2675 fi
578 uberlord 2547
579 uberlord 2675 for module in ${MODULES} ; do
580 uberlord 2547 if type "${module}_pre_stop" >/dev/null 2>/dev/null ; then
581 uberlord 2675 if ! ${module}_pre_stop ; then
582     eend 1
583     exit 1
584     fi
585     fi
586     done
587 uberlord 2547
588 uberlord 2675 for module in ${MODULES} ; do
589 uberlord 2547 if type "${module}_stop" >/dev/null 2>/dev/null ; then
590 uberlord 2675 ${module}_stop
591 uberlord 2547 fi
592 uberlord 2675 done
593 uberlord 2547
594 uberlord 2674 # Only delete addresses for non PPP interfaces
595     if ! type is_ppp >/dev/null 2>/dev/null || ! is_ppp ; then
596     _delete_addresses "${IFACE}"
597     fi
598 uberlord 2547
599 uberlord 2675 for module in ${MODULES} ; do
600 uberlord 2547 if type "${module}_post_stop" >/dev/null 2>/dev/null ; then
601 uberlord 2675 ${module}_post_stop
602 uberlord 2547 fi
603 uberlord 2675 done
604 uberlord 2547
605 uberlord 2675 [ "${IN_BACKGROUND}" != "true" ] && \
606     [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ] && \
607     _down 2>/dev/null
608 uberlord 2547
609 uberlord 2675 [ -x /sbin/resolvconf ] && resolvconf -d "${IFACE}"
610 uberlord 2547
611 uberlord 2675 if type postdown >/dev/null 2>/dev/null ; then
612 uberlord 2547 ebegin "Running postdown"
613     eindent
614     postdown
615     eoutdent
616 uberlord 2675 fi
617 uberlord 2547
618 uberlord 2675 return 0
619 uberlord 2547 }
620    
621 uberlord 2675 # vim: set ts=4 sw=4 :

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20