]> git.pld-linux.org Git - projects/rc-scripts.git/blob - sysconfig/network-scripts/functions.network
Load ipv6 and ipx only when not built into kernel.
[projects/rc-scripts.git] / sysconfig / network-scripts / functions.network
1 #!/bin/sh - keep it for file(1) to get bourne shell script result
2 #
3 # $Id$
4 #
5 # This is not a shell script; it provides functions to network scripts
6 # that source it.
7
8 source_config ()
9 {
10         local foundconfig=0
11
12         DEVNAME=${CONFIG##*/}
13         DEVNAME=${DEVNAME##ifcfg-}
14         DEVNAME=${DEVNAME##tnlcfg-}
15
16         if [[ "$CONFIG" = /* ]]; then
17                 if [ -f "$CONFIG" ]; then
18                         . "$CONFIG"
19                         foundconfig=1
20                 fi
21         elif [ -f "/etc/sysconfig/interfaces/$CONFIG" ]; then
22                 . "/etc/sysconfig/interfaces/$CONFIG"
23                 foundconfig=1
24         fi
25
26         # This is sanity check so that if you've copied ifcfg-eth0 to ifcfg-eth1
27         # and forgot to alter DEVICE= line you won't accidentally bring down eth0
28         # while executing ifdown eth1. We do that only if configuration file exists
29         # (sometimes ifcfg-xyz isn't needed at all like server-side pppoe pppX interfaces)
30         if [ "$foundconfig" -eq "1" -a "$DEVICE" -a "$DEVNAME" != "$DEVICE" ]; then
31                 echo >&2 "$0: DEVICE specified in $CONFIG does not match filename. Aborting!"
32                 exit 1
33         fi
34
35         if [ "${PREFIX}" ] && [[ "$IPADDR" != */* ]]; then
36                 IPADDR="$IPADDR/$PREFIX"
37         fi
38 }
39
40 do_netreport ()
41 {
42         # Notify programs that have requested notification
43         ( cd /var/run/netreport || exit
44         for i in *; do
45                 [ -f $i ] && kill -SIGIO $i >/dev/null 2>&1 || \
46                         rm -f $i >/dev/null 2>&1
47         done
48         )
49 }
50
51 need_hostname()
52 {
53         local hostname=$(hostname)
54         if [ "$hostname" = "(none)" -o "$hostname" = "localhost" -o "$hostname" = "localhost.localdomain" ]; then
55                 NEEDHOSTNAME=yes
56         else
57                 unset NEEDHOSTNAME
58         fi
59 }
60
61 set_hostname()
62 {
63         local hostname domain
64
65         hostname=$(echo $1 | awk ' { gsub(/\..*$/,NIL); print $0; } ')
66         domain=$(echo $1 | awk ' { sub(/^[^\.]*\./,NIL); print $0; } ')
67
68         if [ "$hostname" ]; then
69                 echo "$hostname" > /etc/HOSTNAME
70                 hostname $hostname
71         fi
72
73         if [ "$domain" ]; then
74                 # XXX umask and possible /etc/resolv.conf symlink breakage
75                 > /etc/resolv.conf.new
76                 if ! grep -q "search $domain" /etc/resolv.conf; then
77                         echo "search $domain" >> /etc/resolv.conf.new
78                 fi
79                 echo "domain $domain" >> /etc/resolv.conf.new
80                 grep -v "^domain " /etc/resolv.conf >> /etc/resolv.conf.new
81                 mv -f /etc/resolv.conf.new /etc/resolv.conf
82         fi
83 }
84
85 set_dhcpclient()
86 {
87         if [ "$BOOTPROTO" = "bootp" -o "$BOOTPROTO" = "pump" ]; then
88                 DHCP_CLIENT=/sbin/pump
89         fi
90
91         if [ -z "$DHCP_CLIENT" ]; then
92                 if [ "$BOOTPROTO" = "zeroconf" -a -x /usr/sbin/avahi-autoipd ]; then
93                         DHCP_CLIENT=/usr/sbin/avahi-autoipd
94                 elif [ -x /sbin/dhcpcd ]; then
95                         DHCP_CLIENT=/sbin/dhcpcd
96                 elif [ -x /sbin/dhclient ]; then
97                         DHCP_CLIENT=/sbin/dhclient
98                 elif [ -x /sbin/dhcpxd ]; then
99                         DHCP_CLIENT=/sbin/dhcpxd
100                 elif [ -x /sbin/pump ]; then
101                         DHCP_CLIENT=/sbin/pump
102                 elif [ "$BOOTPROTO" = "auto" -a -x /usr/sbin/avahi-autoipd ]; then
103                         DHCP_CLIENT=/usr/sbin/avahi-autoipd
104                 else
105                         nls "Can't find a DHCP client."
106                         exit 1
107                 fi
108         fi
109 }
110
111 # Setup Network Address Translation (NAT)
112 setup_nat()
113 {
114         local src via dst
115
116         if [ -r /etc/sysconfig/static-nat ]; then
117                 if [ "$1" = "on" ]; then
118                         grep "^[0-9]" /etc/sysconfig/static-nat | while read src via dst; do
119                                 /sbin/ip route add nat $dst via $src
120                                 /sbin/ip rule add from $src nat $dst
121                         done
122                 elif [ "$1" = "off" ]; then
123                         LC_ALL=C /sbin/ip route show table all | grep -E "^nat[[:blank:]]" | while read nat dst via src args; do
124                                 /sbin/ip rule del from $src nat $dst
125                                 /sbin/ip route del nat $dst via $src
126                         done
127                 fi
128         fi
129 }
130
131 # Setup static ARP
132 static_arp()
133 {
134         local rc arpdev host hwaddr flags neflags
135
136         if is_yes "$STATIC_ARP" && [ -r /etc/ethers ]; then
137                 if [ -x /sbin/arp ]; then
138                         run_cmd "Setting static ARP entries" /sbin/arp -f /etc/ethers
139                 else
140                         show "Setting static ARP entries"; busy
141                         rc=0
142                         arpdev=$(ip link show | awk -F':' '(/UP/) && ! (/NOARP/) && ! (/lo:/) && ! (/NONE:/) { print $2; exit }')
143                         if [ -z "$arpdev" ]; then
144                                 rc=1
145                         else
146                                 # ip supports only ip addresses
147                                 grep "^[0-9]" /etc/ethers | \
148                                 while read host hwaddr flags; do
149                                         case "$flags" in
150                                           *temp*)
151                                                 neflags="nud stale"
152                                                 ;;
153                                           *)
154                                                 neflags="nud permanent"
155                                                 ;;
156                                         esac
157                                         if ! /sbin/ip neigh add $host lladdr $hwaddr $neflags dev $arpdev; then
158                                                 rc=1
159                                         fi
160                                 done
161                         fi
162                         if [ "$rc" -gt 0 ]; then
163                                 fail
164                         fi
165                 fi
166         fi
167 }
168
169 static_rarp()
170 {
171         if is_yes "$STATIC_RARP"; then
172                 if [ ! -e /proc/net/rarp ]; then
173                         _modprobe single rarp
174                 fi
175                 if [ -r /etc/ethers -a -x /sbin/rarp ]; then
176                         run_cmd "Setting static RARP entries" /sbin/rarp -f /etc/ethers
177                 fi
178         fi
179 }
180
181 # Set up all IP && IP parameter variables
182 setup_ip_param ()
183 {
184         # detect network device type (ie. dummy, eth for dummy0, eth0 ..)
185         if [ -z "$DEVICETYPE" ]; then
186                 DEVICETYPE=$(echo $DEVICE | awk ' { gsub(/[\.:]?[0-9]*[\.:]?[0-9]*$/,NUL); print $0 } ')
187         fi
188
189         # Setup DEVICETYPE for special cases.
190         if echo ${DEVICE} | LC_ALL=C grep -qE '^[a-z0-9]+\.[0-9]+$'; then
191                 DEVICETYPE=vlan
192         fi
193
194         # real name of device (ie. is eth0 for eth0,eth0:1,eth0:alias)
195         SUBDEVICE=$(echo "$DEVICE" | grep -E "([0-9]+:[0-9]+)")
196         DEVICE=$(echo $DEVICE | awk ' { gsub(/:.*$/,NUL); print $0 } ')
197
198         eval IP4ADDR="\$IPADDR${IP4_PRIM_IF:-}"
199         # check if ipaddr doesn't contain network length -- use $NETMASK then
200         if [[ "$IP4ADDR" != */* ]] && [ "$NETMASK" ]; then
201                 IP4ADDR=$IP4ADDR/$(calcprefix $NETMASK)
202         fi
203
204         # check if we have ipv6 or ipv4 address
205         if [[ "${IP4ADDR}" = *:* ]]; then
206                 IP6ADDR=${IP4ADDR}
207                 IP4ADDR=""
208         else
209                 eval IP4ADDROPT="\$IP_AOPTS${IP4_PRIM_IF:-}"
210                 eval IP4ROUTEOPT="\$IP_ROPTS${IP4_PRIM_IF:-}"
211         fi
212         if [ "${IP6_PRIM_IF}" ]; then
213                 eval IP6ADDR="\$IPADDR${IP6_PRIM_IF:-}"
214                 eval IP6ADDROPT="\$IPV6_AOPTS${IP6_PRIM_IF:-}"
215                 eval IP6ADDRLABEL="\$IP_LABEL${IP6_PRIM_IF:-}"
216         fi
217         if [ "${IP4_SRC_IF}" ]; then
218                 eval IP4SRCADDR="\$IPADDR${IP4_SRC_IF}"
219                 IP4SRCADDR=$(echo ${IP4SRCADDR} | awk ' { gsub(/\/.*/,NIL); print "src " $0; } ')
220         fi
221
222         # new rc-scripts 0.4.x option
223         if [ -z "$HANDLING" ]; then
224                 HANDLING=0
225         fi
226
227         # set handling for bridge
228         case "$DEVICETYPE" in
229           br|atm|lec|irda|vlan)
230                 HANDLING=1
231                 ;;
232         esac
233
234         # Multicast ready devices
235         if is_yes "$MULTICAST"; then
236                 MULTICAST="on"
237         else
238                 case "$DEVICETYPE" in
239                   eth|br)
240                         MULTICAST="on"
241                         ;;
242                   *)
243                         MULTICAST="off"
244                         ;;
245                 esac
246         fi
247
248         # ARP ready devices
249         if [ "$ARP" ]; then
250                 if is_yes "$ARP"; then
251                         ARP="arp on"
252                 else
253                         ARP="arp off"
254                 fi
255         fi
256 }
257
258 check_device_down ()
259 {
260         if LC_ALL=C ip link show dev ${DEVICE} 2> /dev/null | grep -q UP; then
261                 return 1
262         else
263                 return 0
264         fi
265 }
266
267 setup_ip_gw_ro ()
268 {
269         # IPv4 gateway
270         if is_yes "$IPV4_NETWORKING"; then
271                 if [ -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then
272                         # set up default gateway
273                         if [ "${GATEWAY}" ]; then
274                                 ip -4 route add default via ${GATEWAY} dev ${DEVICE} ${IP4SRCADDR} onlink 2>/dev/null
275                                 if [ $? = 0 ]; then
276                                         DEFGW=${GATEWAY}
277                                 else
278                                         # The default gateway could be set via eth0, while bringing up eth1 we shouldn't set default gateway again.
279                                         # To prevent this message just set GATEWAYDEV=eth0 in /etc/sysconfig/network.
280                                         nls "Warning: Default gateway already set proably via other interface. Do you need to setup GATEWAYDEV?"
281                                 fi
282                         elif [ "${GATEWAYDEV}" = "${DEVICE}" ]; then
283                                 ip -4 route add default dev ${DEVICE} ${IP4SRCADDR}
284                         fi
285                 fi
286         fi
287
288         # IPv6 gateway && IPv6 globalroute
289         if is_yes "$IPV6_NETWORKING"; then
290                 if [ -z "${GATEWAY6DEV}" -o "${GATEWAY6DEV}" = "${DEVICE}" ]; then
291                         # set up default gateway
292                         if [ "${GATEWAY6}" ]; then
293                                 ip -6 route add default via ${GATEWAY6} dev ${DEVICE} ${IP6SRCADDR} onlink
294                                 DEFGW6=${GATEWAY6}
295                         elif [ "${GATEWAY6DEV}" = "${DEVICE}" ]; then
296                                 ip -6 route add default dev ${DEVICE} ${IP6SRCADDR}
297                         fi
298                 fi
299                 if [ -z "${IPV6_GLOBALROUTEDEV}" -o "${IPV6_GLOBALROUTEDEV}" = "${DEVICE}" ]; then
300                         # set up default route
301                         if [ "${IPV6_GLOBALROUTEGW}" ]; then
302                                 ip -6 route add 2000::/3 via ${IPV6_GLOBALROUTEGW} dev ${DEVICE} ${IP6SRCADDR} onlink
303                         elif [ "${IPV6_GLOBALROUTEDEV}" = "${DEVICE}" ]; then
304                                 ip -6 route add 2000::/3 dev ${DEVICE} ${IP6SRCADDR}
305                         fi
306                 fi
307         fi
308 }
309
310 #
311 # following function sets up routes not associated to any device
312 # eg. unreachable or blackhole routes
313 # (c) 1999 Jacek Konieczny <jajcus@pld-linux.org>
314 #
315 setup_routes()
316 {
317         local args
318
319         if [ -f /etc/sysconfig/static-routes ]; then
320                 if [ "$1" = "on" -o "$1" = "yes" ]; then
321                         grep -E "^(none|any)[[:blank:]]" /etc/sysconfig/static-routes | while read device args; do
322                                 /sbin/ip route add $args
323                         done
324                 else
325                         grep -E "^(none|any)[[:blank:]]" /etc/sysconfig/static-routes | while read device args; do
326                                 /sbin/ip route del $args 2>/dev/null
327                         done
328                 fi
329         fi
330 }
331
332 # Add ONLY IPv4 address (IPv6 address is added automaticly)
333 set_up_loopback()
334 {
335         if is_yes "$IPV4_NETWORKING"; then
336                 ip addr add 127.0.0.1/8 dev lo
337         fi
338         ip link set dev lo up
339 }
340
341 set_down_loopback()
342 {
343         LC_ALL=C ip addr flush dev lo 2>&1 | grep -v "Nothing to flush"
344         ip link set dev lo down
345 }
346
347 modprobe_net()
348 {
349         if is_yes "$IPV6_NETWORKING" && \
350                 [ "$(awk '$1 ~ /^TCPv6/ { print $8 }' /proc/net/protocols 2> /dev/null)" != "kernel" ] && \
351                 is_module "ipv6"; then
352                         _modprobe single ipv6
353         fi
354
355         if is_yes "$IPX" && \
356                 [ "$(awk '$1 ~ /^IPX/ { print $8 }' /proc/net/protocols 2> /dev/null)" != "kernel" ] && \
357                 is_module "ipx"; then
358                         _modprobe single ipx
359         fi
360 }
361
362 # calculate network prefix from given network mask
363 calcprefix()
364 {
365         local old_IFS netmask prefix endp
366
367         old_IFS=$IFS
368         IFS='.'
369         netmask=$(echo $1)
370         IFS=$old_IFS
371
372         prefix=0
373         endp=0
374         for n in $netmask; do
375                 for i in 128 64 32 16 8 4 2 1; do
376                         if [ $(($n & $i)) -ne 0 ]; then
377                                 if [ $endp -eq 0 ]; then
378                                         prefix=$(($prefix + 1))
379                                 else
380                                         echo "32"
381                                         return
382                                 fi
383                         else
384                                 endp=1
385                         fi
386                 done
387         done
388         echo $prefix
389 }
390
391 # calculate network mask from given prefix
392 # (c) 1999 Grzegorz Stanislawski <stangrze@open.net.pl>
393 calcnetmask()
394 {
395         local prefix a MASK
396
397         MASK=""
398         if [ "${1##[0-9]*}" ]; then
399                 prefix=32
400         else
401                 prefix=$1
402         fi
403         for i in 1 2 3 4; do
404                 case $prefix in
405                   7)    a=254;;
406                   6)    a=252;;
407                   5)    a=248;;
408                   4)    a=240;;
409                   3)    a=224;;
410                   2)    a=192;;
411                   1)    a=128;;
412                   *)
413                         [ $prefix -ge 8 ] && a=255
414                         [ $prefix -le 0 ] && a=0
415                         ;;
416                 esac
417
418                 prefix="$(( $prefix - 8))"
419                 if [ -z "$MASK" ]; then
420                         MASK=$a
421                 else
422                         MASK=$MASK.$a
423                 fi
424         done
425
426         echo $MASK
427         return
428 }
429
430 # Retrievies PPPD PID and real interface name from /var/run/ppp-*.pid
431 get_ppp_device_and_pid ()
432 {
433         if [ -f "/var/run/ppp-$DEVNAME.pid" ]; then
434                 eval $(
435                 {
436                         read PID; echo "PID='$PID'"
437                         read REALDEVICE; echo "REALDEVICE=$REALDEVICE"
438                 } < "/var/run/ppp-$DEVNAME.pid")
439         fi
440
441         if [ -z "$REALDEVICE" ]; then
442                 REALDEVICE=$DEVICE
443         fi
444 }
445
446 # following function setups advanced routing rules
447 # Olgierd Pieczul <wojrus@pld-linux.org>
448 setup_ip_rules ()
449 {
450         local args prio from src
451
452         if [ -f /etc/sysconfig/static-routes ]; then
453                 if is_yes "$1"; then
454                         grep -E "^(from|to|iif|tos|fwmark|dev|pref|priority|prio)[[:blank:]]" /etc/sysconfig/static-routes | while read args; do
455                                 /sbin/ip rule add $args
456                         done
457                 elif is_no "$1"; then
458                         LC_ALL=C /sbin/ip rule show | grep -vE -e "from all lookup (main|default|local) \$" -e " map-to " | while read prio from src args; do
459                                 [ "$src" = "all" ] && ip rule delete $args || ip rule delete $from $src $args
460                         done
461                 fi
462         fi
463 }
464
465 is_wireless_device ()
466 {
467         if [ -x /sbin/iwconfig ]; then
468                 LC_ALL=C iwconfig "${1}" 2>&1 | grep -q "no wireless extensions" || return 0
469         fi
470         return 1
471 }
472
473 wireless_param()
474 {
475         device="$1"
476         if [ "$2" = "br" ]; then
477                 prefix="${device}_"
478         else
479                 prefix=""
480         fi
481
482         local val wlan_mode
483
484         # wlan mode needs to be first
485         wlan_mode="$(eval echo \$${prefix}WLAN_MODE)" && [ "$wlan_mode" ] && \
486                 iwconfig ${device} mode "$wlan_mode"
487
488         val="$(eval echo \$${prefix}WLAN_NICKNAME)" && [ "$val" ] && \
489                 iwconfig ${device} nick "$val"
490
491         val="$(eval echo \$${prefix}WLAN_NWID)" && [ "$val" ] && \
492                 iwconfig ${device} nwid "$val"
493
494         if [ "$wlan_mode" != "Managed" -a "$wlan_mode" != "managed" ]; then
495                 if val="$(eval echo \$${prefix}WLAN_FREQ)" && [ "$val" ]; then
496                         iwconfig ${device} freq "$val"
497                 elif val="$(eval echo \$${prefix}WLAN_CHANNEL)" && [ "$val" ]; then
498                         iwconfig ${device} channel "$val"
499                 fi
500         fi
501
502         val="$(eval echo \$${prefix}WLAN_SENS)" && [ "$val" ] && \
503                 iwconfig ${device} sens "$val"
504         val="$(eval echo \$${prefix}WLAN_AP)" && [ "$val" ] && \
505                 iwconfig ${device} ap "$val"
506         val="$(eval echo \$${prefix}WLAN_BITRATE)" && [ "$val" ] && \
507                 iwconfig ${device} rate "$val"
508         val="$(eval echo \$${prefix}WLAN_RTS_THRESHOLD)" && [ "$val" ] && \
509                 iwconfig ${device} rts "$val"
510         val="$(eval echo \$${prefix}WLAN_FRAGMENTATION_THRESHOLD)" && [ "$val" ] && \
511                 iwconfig ${device} frag "$val"
512
513         local wlan_encryption="$(eval echo \$${prefix}WLAN_ENCRYPTION)"
514         local wlan_key="$(eval echo \$${prefix}WLAN_KEY)"
515         # TODO: well, actually shouldn't set WLAN_KEY if other keys than current are set
516         if [ "$wlan_key" ]; then
517                 # wlan key can contain index of key to set
518                 # to set other than current keys suffix with 1-4:
519                 local idx
520                 for idx in 1 2 3 4; do
521                         val="$(eval echo \$${prefix}WLAN_KEY_$idx)"
522                         [ "$val" ] || continue
523                         iwconfig ${device} key "[$idx]" "$val"
524                 done
525                 if val="$(eval echo \$${prefix}WLAN_KEY_CURRENT)" && [ "$val" ]; then
526                         iwconfig ${device} key "[$val]"
527                 else
528                         iwconfig ${device} key "$wlan_key"
529                 fi
530
531                 [ "$wlan_encryption" ] && iwconfig ${device} key "$wlan_encryption"
532         fi
533
534         if is_no "$wlan_encryption"; then
535                 iwconfig ${device} key off
536         fi
537         val="$(eval echo \$${prefix}WLAN_POWER)" && [ "$val" ] && \
538                 iwconfig ${device} power "$val"
539         val="$(eval echo \$${prefix}WLAN_TXPOWER)" && [ "$val" ] && \
540                 iwconfig ${device} txpower "$val"
541         val="$(eval echo \$${prefix}WLAN_RETRY)" && [ "$val" ] && \
542                 iwconfig ${device} retry "$val"
543
544         # essid should be last due to network rescanning by wlan devices
545         val="$(eval echo \$${prefix}WLAN_ESSID)" && [ "$val" ] && \
546                 iwconfig ${device} essid "$val"
547
548         if is_yes "$(eval echo \$${prefix}WLAN_COMMIT)"; then
549                 iwconfig ${device} commit
550         fi
551 }
552
553 # returns
554 # 0 - no link
555 # 1 - link ok
556 # 2 - unsupported, unknown return
557 check_mii_tool ()
558 {
559         [ -x /sbin/mii-tool ] || return 2
560         local output=$(LC_ALL=C mii-tool $1 2>&1)
561         echo $output | grep -q "link ok" && return 1
562         echo $output | grep -q "no link" && return 0
563         return 2
564 }
565
566 # returns
567 # 0 - link off
568 # 1 - link on
569 # 2 - unsupported, unknown return
570 check_ethtool ()
571 {
572         [ -x /sbin/ethtool ] || return 2
573         local output=$(LC_ALL=C ethtool $1 2>&1)
574         echo $output | grep -q "Link detected: yes" && return 1
575         echo $output | grep -q "Link detected: no" && return 0
576         return 2
577 }
578
579 # returns
580 # 0 - radio off
581 # 1 - radio on
582 # 2 - unsupported
583 check_iwconfig ()
584 {
585         local output
586         # rfkill state (are there devices with multiple rfkill buttons?)
587         output=$(cat /sys/class/net/${1}/device/rfkill*/state 2> /dev/null)
588         # 1 is rfkill not active
589         [ "$output" = "1" ] && return 1
590         [ "$output" = "0" -o "$output" = "2" ] && return 0
591         [ -x /sbin/iwconfig ] || return 2
592         output=$(LC_ALL=C iwconfig "$1" 2>&1)
593         # "radio off" is ipwxxx only "feature" (and there is no "radio on")
594         echo "$output" | grep -q "radio off" && return 0
595         # XXX: need more generic checks for wifi
596         return 2
597 }
598
599 # returns
600 # 0 - link down
601 # 1 - link up
602 # 2 - unknown/unsupported
603 check_link_down ()
604 {
605         local e i m timeout device max_timeout
606         device="$1"
607         max_timeout="$2"
608
609         if [ ! -x /sbin/mii-tool -a ! -x /sbin/ethtool -a ! -x /sbin/iwconfig ]; then
610                 return 2
611         fi
612
613         [ -z "$max_timeout" ] && max_timeout=6
614
615         if ! LC_ALL=C ip link show dev $device 2>/dev/null | grep -q UP; then
616                 ip link set dev $device up >/dev/null 2>&1
617         fi
618         timeout=0
619         while [ $timeout -le $max_timeout ]; do
620                 check_ethtool $device
621                 e=$?
622                 check_iwconfig $device
623                 i=$?
624                 # trust ethtool and iwconfig
625                 if [ $i -eq 1 ] || [ $e -eq 1 ]; then
626                         return 1
627                 fi
628                 # use mii check only if all other check are unsupported
629                 # (mii check lies too often)
630                 check_mii_tool $device
631                 m=$?
632                 if [ $m -eq 1 ] && [ $i -eq 2 ] && [ $e -eq 2 ]; then
633                         return 1
634                 fi
635                 usleep 500000
636                 timeout=$((timeout+1))
637         done
638         # do not abort dhclient if all the checks are unsupported
639         if [ $m -eq 2 ] && [ $i -eq 2 ] && [ $e -eq 2 ]; then
640                 return 2
641         fi
642         return 0
643 }
This page took 0.06805 seconds and 4 git commands to generate.