summaryrefslogtreecommitdiffstats
path: root/sbin/init.d/network
blob: 266e1b0f5a366fb90d71c87adc94c9ad67029510 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
#!/bin/bash

# service network [<ifname>]       # interface name -> int_<ifname>=enable
#     ip address <ip/mask> [secondary]  # address for this interface 
#     media {auto|full|fdx|100full|100fdx|half|hdx|100half|100hdx>
#     speed {10|100|1000}
#     duplex {half|full}
#     auto {on|off}
#     slave <if> ...
#     modprobe [module [module_options]]
#     lladdr <mac_addr>
#     mtu <mtu>
#     [no] arp
#     [no] multicast
#     shutdown
#     ip route <ip/mask> <-|gw> [ip args...]
#     vrrp ... (ignored by this script)

# we want ALL instances to stop and restart at once
if [ "$1" = "restart" ]; then
  shift
  $0 stop  "$@"
  $0 start "$@"
  exit $?
elif [ "$1" = "reload" ]; then
  shift
  $0 flush "$@"
  $0 start "$@"
  exit $?
fi

. `dirname $0`/functions

option	ip		option_ip
option	usedhcphostname	boolean_option	0
option	dhcptimeout	standard_option	10
option	media		standard_option
option	duplex		standard_option
option	speed		standard_option
option	auto		standard_option
option  slave           multiple_option
option	modprobe 	multiple_option
option	lladdr		standard_option
option	mtu		standard_option
option	arp		boolean_option	1
option	multicast	boolean_option	1
option	shutdown	boolean_option
option	vrrp	 	multiple_option
option	load 		multiple_option
option	unload 		multiple_option

SVC_VARS="addr_list route_list arp_list addr_idx route_idx arp_idx"


function do_help {
    echo "Usage: ${0##*/} <status|start|stop|flush|reload|help>"
    echo "List of config.rc options (name, type, default value, current value) :"
    echo
    echo "   - ip addr <address>, arp <ip> <mac>|pub, dhcp, route <dest> <-|gw> [<args>]"
    echo "   - media auto|{full|fdx|100full|100fdx}|{half|hdx|100half|100hdx}"
    echo "   - duplex {half|full}"
    echo "   - speed  {10|100|1000}"
    echo "   - auto   {on|off}"
    echo "   - slave  <interface*>"
    echo "   - modprobe <module> <arg*>"
    echo "   - load|unload <command> <arg*>"
    echo "   - lladdr <mac_addr>"
    echo "   - mtu <mtu> ; arp {on|off} ; multicast {on|off} ; shutdown"
    echo "   - vrrp <id|prio|addr|auth_type|pass|garp>"
    echo
    exit 1 
}

# changes the negociation parameters for interface $1
# usage: set_media <interface> <media>
function set_media {
    case "$2" in
	auto)
	    /sbin/mii-diag -r $1 >/dev/null 2>&1 || \
		/sbin/ethtool -s $1 autoneg on
	    ;;
	full|fdx|100full|100fdx)
	    /sbin/mii-diag -F 100baseTx-FD $1 >/dev/null 2>&1 || \
		/sbin/ethtool -s $1 autoneg off speed 100 duplex full
	    ;;
	half|hdx|100half|100hdx)
	    /sbin/mii-diag -F 100baseTx-HD $1 >/dev/null 2>&1 || \
		/sbin/ethtool -s $1 autoneg off speed 100 duplex half
	    ;;
	*) /sbin/mii-diag -F $opt_media $1 >/dev/null ;;
    esac
}

# changes the negociation parameters for interface $1
# $2=speed(10|100|1000) or "" if unchanged
# $3=duplex(half|full) or "" if unchanged
# $4=auto(on|off) or "" if unchanged
function set_media2 {
    local miistr
    if [ "$4" = "on" ]; then
	/sbin/mii-diag -r $1 >/dev/null 2>&1 || \
	    /sbin/ethtool -s $1 autoneg on
    fi

    [ "$3" = "half" ] && miistr="HD" || miistr="FD"
    if [ "$2" = "10" ]; then
	miistr=10baseT-$miistr
    else
	miistr=${2:-100}baseTx-$miistr
    fi

    # warning: with ethtool, it's important to set auto, then speed and duplex
    # in this exact order.
    /sbin/mii-diag -F $miistr $1 >/dev/null 2>&1 || \
	/sbin/ethtool -s $1 ${4:+autoneg $4} ${2:+speed $2} ${3:+duplex $3}
}

function fct_begin_section {
    addr_list=( )
    arp_list=( )
    route_list=( )
    addr_idx=0
    arp_idx=0
    route_idx=0
}

# usage: ip <ip> {addr|route} ...
function option_ip {
    shift
    local cmd=$1
    shift
    case "$cmd" in
	addr|address)
	    addr_list[$addr_idx]="$*"
	    addr_idx=$[$addr_idx+1]
	    ;;
	arp|neigh*)
	    arp_list[$arp_idx]="$*"
	    arp_idx=$[$arp_idx+1]
	    ;;
	route)
	    route_list[$route_idx]="$*"
	    route_idx=$[$route_idx+1]
	    ;;
	dhcp)
	    addr_list[$addr_idx]="dhcp"
	    addr_idx=$[$addr_idx+1]
	    ;;
	--disable)
	    ;;
	*)
	    echo "Unknown ip command : $cmd $*"
	    return 1
    esac
}

function do_start {
    local svcname=$1
    local instname=$2
    local arg

    if [ -z "$instname" ]; then
	echo "# Starting $svcname ..."
	arg=0
	while [ $arg -lt ${#opt_modprobe[*]} ]; do
	    if [ "${opt_modprobe[$arg]}" != "#" ]; then
		if ! modprobe ${opt_modprobe[$arg]}; then
		    echo "  ==> start $svcname : modprobe ${opt_modprobe[$arg]} failed. Trying anyway."
		fi
	    fi
	    arg=$[$arg+1]
	done
	arg=0
	while [ $arg -lt ${#opt_load[*]} ]; do
	    if [ "${opt_load[$arg]}" != "#" ]; then
		if ! sh -c "${opt_load[$arg]}"; then
		    echo "  ==> start $svcname : load ${opt_load[$arg]} failed. Trying anyway."
		fi
	    fi
	    arg=$[$arg+1]
	done
	arg=0
	while [ $arg -lt $route_idx ]; do
	    local dest gw
	    dest=${route_list[$arg]%%[ 	]*}
	    gw=${route_list[$arg]#*[ 	]}	# gw and potentially other ip args
	    if [ -n "${gw##connected*}" ]; then
		ip route add $dest via $gw
	    else
		ip route add $dest ${gw#connected}
	    fi
	    arg=$[$arg+1]
	done
	echo "  ==> start $svcname : Done."
	return $?
    fi

    if [ "$opt_shutdown" = 1 ]; then
	return 0
    fi

    echo "# Starting $svcname${instname:+[$instname]} ..."
    # we only check running instances when an interface is defined
    do_status $svcname $instname > /dev/null 2>&1
    if [ $? = 0 -a "$instname" != "lo" -a $FORCE_START_STOP -eq 0 ] ; then
	echo "  ==> Service $svcname${instname:+[$instname]} already running.";
	[ $SVC_AUTO_START -eq 0 ] && echo "  ==> please use '--force' or 'restart' instead or check with 'status'."
	return 0
    fi

    arg=0
    while [ $arg -lt ${#opt_modprobe[*]} ]; do
	if [ "${opt_modprobe[$arg]}" != "#" ]; then
	    if ! modprobe ${opt_modprobe[$arg]}; then
		echo "  ==> start $svcname${instname:+[$instname]} : modprobe ${opt_modprobe[$arg]} failed. Trying anyway."
		# return 1
	    fi
	else
	    local err	# do not merge the assignment here, local sets $? to 0 !
	    err=`modprobe $instname 2>&1`
	    if [ $? -gt 0 ]; then
		if ! grep -q "^[ 	]*$instname:" /proc/net/dev >/dev/null 2>&1; then
		    echo "  ==> start $svcname[$instname] : modprobe $instname failed : $err. Trying anyway."
		    # return 1
		fi
	    fi
	fi
	arg=$[$arg+1]
    done
    arg=0
    while [ $arg -lt ${#opt_load[*]} ]; do
        if [ "${opt_load[$arg]}" != "#" ]; then
	    if ! sh -c "${opt_load[$arg]}"; then
	        echo "  ==> start $svcname : load ${opt_load[$arg]} failed. Trying anyway."
	    fi
        fi
        arg=$[$arg+1]
    done
    arg=0
	
    # a dot in an interface name means physical_if.vlanid
    # We have to create the interface now.
    if [ -z "${instname//*.*/}" ]; then
	arg=${instname%%.*}
	if ! do_status $svcname $arg && ! do_start $svcname $arg >/dev/null 2>&1; then
	    echo "  ==> FAILED! could not start slave $arg before $instname"
	fi
	vconfig add $arg ${instname#*.} >/dev/null
	if [ $? -gt 0 ]; then
	    echo "  ==> start $svcname${instname:+[$instname]} : Failed."
	    return 1
	fi
    fi

    ip link set $instname down >/dev/null 2>&1
    ip addr flush dev $instname >/dev/null 2>&1

    if [ "$opt_lladdr" ]; then
	ip link set $instname address $opt_lladdr
    fi

    if [ "$opt_mtu" ]; then
	ip link set $instname mtu $opt_mtu
    fi

    if [ "$opt_multicast" != 1 ]; then
	ip link set $instname multicast off
    #else
	#ip link set $instname multicast on
    fi

    if [ "$opt_arp" != 1 ]; then
	ip link set $instname arp off
    fi

    if ! ip link set $instname up; then
	echo "  ==> start $svcname${instname:+[$instname]} : Failed."
	return 1
    fi

    if [ "$opt_media" ]; then
	if [ -n "$opt_speed" -o -n "$opt_duplex" -o -n "$opt_auto" ]; then
	    echo " ==> Warning: option 'media' inhibits 'speed','duplex' and 'auto'."
	fi
	set_media $instname "$opt_media"
	echo "  ==> Link set to $opt_media for interface $instname"
    elif [ -n "$opt_speed" -o -n "$opt_duplex" -o -n "$opt_auto" ]; then
	set_media2 $instname "${opt_speed:--}" "${opt_duplex:--}" "${opt_auto:--}"
	echo "  ==> Link configuration changed for interface $instname"
    fi

    if [ ${#opt_slave[*]} -gt 0 ]; then
	for arg in ${opt_slave[*]}; do
	    if ! do_status $svcname $arg && ! do_start $svcname $arg >/dev/null 2>&1; then
		    echo "  ==> FAILED! need to start slave $arg before $instname"
	    else
		ifenslave $instname $arg >/dev/null 2>&1
		ip addr flush dev $arg >/dev/null 2>&1
	    fi
	done
    fi

    arg=0
    while [ $arg -lt $addr_idx ]; do
	if [ "${addr_list[$arg]}" = "dhcp" ]; then
	    echo "  ==> Waiting for ip address with DHCP request ... "
	    # on some cards (eg: tg3), we need to wait a bit before
	    # using the link.
	    ethtool $instname 2>/dev/null | grep -qF 'Link detected: yes' || sleep 1
	    if [ "$opt_usedhcphostname" = 0 ]; then
	        dhcpcd -t ${opt_dhcptimeout:-10} $instname
	    else
	        dhcpcd -H -t ${opt_dhcptimeout:-10} $instname
	    fi
	    set -- $(ip addr show dev $instname | grep ' inet ')
	    if [ -n "$2" ]; then
		echo "      Device $instname has IP address $2"
	    else
		echo "      Device $instname has no IP address"
	    fi
	else
	    ip addr add dev $instname ${addr_list[$arg]}
	fi
	arg=$[$arg+1]
    done

    arg=0
    while [ $arg -lt $arp_idx ]; do
	local ip mac
	ip=${arp_list[$arg]%%[ 	]*}
	mac=${arp_list[$arg]#*[ 	]}

	# delete annoying pub entries if it exists. We don't use ip neigh here
	# because it cannot create anything if an incomplete entry exists.
	arp -i $instname -d $ip pub >/dev/null 2>&1

	if [ "$mac" = "pub" ]; then
	    arp -i $instname -Ds $ip $instname pub
	else
	    arp -i $instname -s $ip $mac
	fi
	arg=$[$arg+1]
    done

    arg=0
    while [ $arg -lt $route_idx ]; do
	local dest gw
	dest=${route_list[$arg]%%[ 	]*}
	gw=${route_list[$arg]#*[ 	]}	# gw and potentially other ip args
	if [ -n "${gw##connected*}" ]; then
	    ip route add $dest dev $instname via $gw
	else
	    ip route add $dest dev $instname ${gw#connected}
	fi
	arg=$[$arg+1]
    done
    echo "  ==> start $svcname${instname:+[$instname]} : Done."
}

function do_status {
    local instname=$2
    if [ "$instname" ]; then
	if ip link show $instname | grep -q UP; then
	    echo "Interface $instname is up."
	    return 0
	else
	    echo "Interface $instname is down."
	    return 1
	fi
    #else
    #	 if ip route list | grep -q dev; then
    #	     echo "Network is up."
    #	     return 0
    #	 else
    #	     echo "Network is down."
    #	     return 1
    #	 fi
    fi
    REPLY=
    return 0
}


function do_stop {
    local svcname=$1
    local instname=$2
    local arg

    if [ -z "$instname" ]; then
	echo "# Stopping $svcname ..."

	arg=0
	while [ $arg -lt ${#opt_unload[*]} ]; do
	    if [ "${opt_unload[$arg]}" != "#" ]; then
		if ! sh -c "${opt_unload[$arg]}"; then
		    echo "  ==> stop $svcname : unload ${opt_unload[$arg]} failed. Trying anyway."
		fi
	    fi
	    arg=$[$arg+1]
	done

	arg=${#opt_modprobe[*]}
	while [ $arg -gt 0 ]; do
	    arg=$[$arg-1]
	    if [ "${opt_modprobe[$arg]}" != "#" ]; then
		rmmod -r ${opt_modprobe[$arg]} >/dev/null 2>&1
	    fi
	done

	arg=0
	while [ $arg -lt $route_idx ]; do
	    ip route del ${route_list[$arg]} >/dev/null 2>&1
	    arg=$[$arg+1]
	done
	return $?
    fi

    echo "# Stopping $svcname${instname:+[$instname]} ..."

    if ! do_status $svcname $instname > /dev/null 2>&1; then
	# vlan interfaces must disappear
	if [ -n "${instname//*.*/}" ] || ! ip link show $instname >/dev/null 2>&1; then
	    echo "  ==> stop $svcname${instname:+[$instname]} : already stopped."
	    return 0
        fi
    fi

    # we may have to kill dhcpcd
    arg=0
    while [ $arg -lt $addr_idx ]; do
	if [ "${addr_list[$arg]}" = "dhcp" ]; then
	    local proc
	    for proc in $(svc_pidof dhcpcd) ; do 
		if grep -qs $instname /proc/$proc/cmdline ; then kill $proc ; fi
	    done   
	fi
	arg=$[$arg+1]
    done

    ip link set $instname down >/dev/null 2>&1
    ip addr flush dev $instname >/dev/null 2>&1

    arg=0
    while [ $arg -lt ${#opt_unload[*]} ]; do
        if [ "${opt_unload[$arg]}" != "#" ]; then
	    if ! sh -c "${opt_unload[$arg]}"; then
	        echo "  ==> stop $svcname : unload ${opt_unload[$arg]} failed. Trying anyway."
	    fi
        fi
        arg=$[$arg+1]
    done

    # a dot in an interface name means physical_if.vlanid
    # We have to remove the interface now.
    [ -z "${instname//*.*/}" ] && vconfig rem $instname >/dev/null

    arg=${#opt_modprobe[*]}
    while [ $arg -gt 0 ]; do
	arg=$[$arg-1]
	if [ "${opt_modprobe[$arg]}" != "#" ]; then
	    rmmod -r ${opt_modprobe[$arg]} >/dev/null 2>&1
	else
	    rmmod -r $instname >/dev/null 2>&1
	fi
    done
    echo "  ==> stop $svcname${instname:+[$instname]} : Done."
}


# only flushes addresses, routes routes and sets if down. doesn't remove any module
function do_flush {
    local svcname=$1
    local instname=$2
    local arg

    if [ -z "$instname" ]; then
	echo "# Flushing $svcname ..."

	arg=0
	while [ $arg -lt $route_idx ]; do
	    ip route del ${route_list[$arg]} >/dev/null 2>&1
	    arg=$[$arg+1]
	done
	return $?
    fi

    echo "# Flushing $svcname${instname:+[$instname]} ..."

    if ! do_status $svcname $instname > /dev/null 2>&1; then
	# vlan interfaces must disappear
	if [ -n "${instname//*.*/}" ] || ! ip link show $instname >/dev/null 2>&1; then
	    echo "  ==> flush $svcname${instname:+[$instname]} : already flushed."
	    return 0
        fi
    fi

    # we may have to kill dhcpcd
    arg=0
    while [ $arg -lt $addr_idx ]; do
	if [ "${addr_list[$arg]}" = "dhcp" ]; then
	    local proc
	    for proc in $(svc_pidof dhcpcd) ; do 
		if grep -qs $instname /proc/$proc/cmdline ; then kill $proc ; fi
	    done   
	fi
	arg=$[$arg+1]
    done

    ip link set $instname down >/dev/null 2>&1
    ip addr flush dev $instname >/dev/null 2>&1

    # a dot in an interface name means physical_if.vlanid
    # We have to remove the interface now.
    [ -z "${instname//*.*/}" ] && vconfig rem $instname >/dev/null

    echo "  ==> flush $svcname${instname:+[$instname]} : Done."
}

#### these are the old versions. The slave mechanism should be checked.

_start_if() {
  local eth=$1
  local temp=`eval echo \\$int_${eth}_modprobe`
  ip link show $eth >/dev/null 2>&1
  if [ "$temp" -a $? -ne 0 ] ; then
    if [ "$temp" = modprobe ] ; then
      modprobe $eth
    else
      modprobe $temp
    fi
  fi

  ip link show $eth | grep -q UP 
  if [ $? = 0 ] ; then 
    echo "Interface $eth already configured"
    continue
  fi

  if [ "`eval echo \\$int_${eth}_slave`" ]; then
    # the slaves should be up before continuing
    for int in `eval echo \\$int_${eth}_slave`; do
      start_if $int
    done
  fi

  if [ "`eval echo \\$int_${eth}_media`" ]; then
    media=`eval echo \\$int_${eth}_media`
    case "$media" in
      auto) /sbin/mii-diag -r $eth >/dev/null ;;
      full|fdx|100full|100fdx) /sbin/mii-diag -F 100baseTx-FD $eth >/dev/null ;;
      half|hdx|100half|100hdx) /sbin/mii-diag -F 100baseTx-HD $eth >/dev/null ;;
      *) /sbin/mii-diag -F $media $eth >/dev/null ;;
    esac
    echo "Link set to $media for interface $eth"
  fi

  ip link set $eth up
  ip addr flush dev $eth >/dev/null 2>&1
  if [ "`eval echo \\$ip_dhcp_$eth`" = enable ] ; then
    echo "Waiting for ip address with DHCP request ... "
    dhcpcd -t 10 $eth
  elif [ "`eval echo \\$ip_address_$eth`" ]; then
    ip_address=`eval echo \\$ip_address_$eth`
    ip_address_sec=`eval echo \\$ip_address_sec_$eth`
    echo "Setting ip address $ip_address to interface $eth"
    ip addr add $ip_address dev $eth
    for addr in $ip_address_sec ; do
      echo "Setting secondary ip address $addr to interface $eth"
      ip addr add $addr dev $eth
    done
  fi

  if [ "`eval echo \\$int_${eth}_slave`" ]; then
    ifenslave $eth `eval echo \\$int_${eth}_slave`
    # we prefer no ip address on the slaves
    for int in `eval echo \\$int_${eth}_slave`; do
      ip addr flush dev $int
    done
  fi

  addr=`ip addr show $eth  | grep "inet " | sed 's/^.*inet \([^ ]\+\) .*$/\1/'`
  if [ ! -z "$addr" ]; then
     if [ ! -z "$display_addr_in_issue" ]; then
        echo "  -> $eth has address $addr"
        echo "$eth has address $addr" >> /etc/issue
     fi
  else
     if [ ! -z "$display_addr_in_issue" ]; then
        echo "  -> $eth has no address"
        echo "$eth has no address" >> /etc/issue
     fi
  fi
}

_do_start()
{
 # set hostname
 if [ "$hostname" ] ; then
  echo "Setting hostname '$hostname'"
  hostname $hostname
  domainname `echo $hostname | cut -f2- -d.`
 fi 

 # set ip address for each interface
 for eth in `set|grep -a '^int_[a-zA-Z0-9:-_]*=enable$'|\
            sed -e 's/.*_\(.*\)=.*/\1/'` ; do
 	start_if $eth
 done

 # set ip route
 for route in `echo $ip_route` ; do
  way=`echo $route | cut -f1 -d:`
  if [ -z "$way" ] ; then way=default ; fi
  gateway=`echo $route | cut -f2 -d":"`
  echo "Setting route $way via $gateway"
  /sbin/ip route add $way via $gateway
 done
}

_do_stop()
{
 for eth in `set|grep -a '^int_[a-zA-Z0-9:-_]*=enable$'|\
            sed -e 's/.*_\(.*\)=.*/\1/'` ; do
  echo "Shutting down $eth"
  if [ "`eval echo \\$ip_dhcp_$eth`" = enable ] ; then
    for proc in `pidof dhcpcd` ; do 
      if grep -qs $eth /proc/$proc/cmdline ; then kill $proc ; fi
    done   
  fi
  ip link set $eth down
  ip addr flush dev $eth >/dev/null 2>&1
  if [ ! -z `eval echo \\$int_"$eth"_slave` ]; then
    for slave in `eval echo \\$int_"$eth"_slave`; do
	ip link set $slave down arp on
	ip addr flush dev $slave >/dev/null 2>&1
    done
  fi
  if [ ! -z "$display_addr_in_issue" ]; then
     grep -v "$eth " /etc/issue > /etc/issue- && mv /etc/issue- /etc/issue
  fi
 done
}

_do_status() 
{
    echo "'ip addr show' give:"
    ip addr show
    echo "'ip route show' give:"
    ip route show
} 

load_config