Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / bind / dist / bin / tests / system / ifconfig.sh
blob58399d0cb71ae61a341292afa4d951ffe25c2188
1 #!/bin/sh
3 # Copyright (C) 2004, 2007-2009 Internet Systems Consortium, Inc. ("ISC")
4 # Copyright (C) 2000-2003 Internet Software Consortium.
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
10 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 # PERFORMANCE OF THIS SOFTWARE.
18 # Id: ifconfig.sh,v 1.57 2009/06/26 23:47:58 tbox Exp
21 # Set up interface aliases for bind9 system tests.
24 config_guess=""
25 for f in ./config.guess ../../../config.guess
27 if test -f $f
28 then
29 config_guess=$f
31 done
33 if test "X$config_guess" = "X"
34 then
35 cat <<EOF >&2
36 $0: must be run from the top level source directory or the
37 bin/tests/system directory
38 EOF
39 exit 1
42 # If running on hp-ux, don't even try to run config.guess.
43 # It will try to create a temporary file in the current directory,
44 # which fails when running as root with the current directory
45 # on a NFS mounted disk.
47 case `uname -a` in
48 *HP-UX*) sys=hpux ;;
49 *) sys=`sh $config_guess` ;;
50 esac
52 case "$2" in
53 [0-9]|[1-9][0-9]|[1-9][0-9][0-9]) base=$2;;
54 *) base=""
55 esac
57 case "$1" in
59 start|up)
60 for ns in 1 2 3 4 5 6 7
62 if test -n "$base"
63 then
64 int=`expr $ns + $base - 1`
65 else
66 int=$ns
68 case "$sys" in
69 *-pc-solaris2.5.1)
70 ifconfig lo0:$int 10.53.0.$ns netmask 0xffffffff up
72 *-sun-solaris2.[6-7])
73 ifconfig lo0:$int 10.53.0.$ns netmask 0xffffffff up
75 *-*-solaris2.[8-9]|*-*-solaris2.1[0-9])
76 /sbin/ifconfig lo0:$int plumb
77 /sbin/ifconfig lo0:$int 10.53.0.$ns up
79 *-*-linux*)
80 ifconfig lo:$int 10.53.0.$ns up netmask 255.255.255.0
82 *-unknown-freebsd*)
83 ifconfig lo0 10.53.0.$ns alias netmask 0xffffffff
85 *-unknown-netbsd*)
86 ifconfig lo0 10.53.0.$ns alias netmask 255.255.255.0
88 *-unknown-openbsd*)
89 ifconfig lo0 10.53.0.$ns alias netmask 255.255.255.0
91 *-*-bsdi[3-5].*)
92 ifconfig lo0 add 10.53.0.$ns netmask 255.255.255.0
94 *-dec-osf[4-5].*)
95 ifconfig lo0 alias 10.53.0.$ns
97 *-sgi-irix6.*)
98 ifconfig lo0 alias 10.53.0.$ns
100 *-*-sysv5uw7*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
101 ifconfig lo0 10.53.0.$ns alias netmask 0xffffffff
103 *-ibm-aix4.*|*-ibm-aix5.*)
104 ifconfig lo0 alias 10.53.0.$ns
106 hpux)
107 ifconfig lo0:$int 10.53.0.$ns up
109 *-sco3.2v*)
110 ifconfig lo0 alias 10.53.0.$ns
112 *-darwin*)
113 ifconfig lo0 alias 10.53.0.$ns
116 echo "Don't know how to set up interface. Giving up."
117 exit 1
118 esac
119 done
122 stop|down)
123 for ns in 7 6 5 4 3 2 1
125 if test -n "$base"
126 then
127 int=`expr $ns + $base - 1`
128 else
129 int=$ns
131 case "$sys" in
132 *-pc-solaris2.5.1)
133 ifconfig lo0:$int 0.0.0.0 down
135 *-sun-solaris2.[6-7])
136 ifconfig lo0:$int 10.53.0.$ns down
138 *-*-solaris2.[8-9]|*-*-solaris2.1[0-9])
139 ifconfig lo0:$int 10.53.0.$ns down
140 ifconfig lo0:$int 10.53.0.$ns unplumb
142 *-*-linux*)
143 ifconfig lo:$int 10.53.0.$ns down
145 *-unknown-freebsd*)
146 ifconfig lo0 10.53.0.$ns delete
148 *-unknown-netbsd*)
149 ifconfig lo0 10.53.0.$ns delete
151 *-unknown-openbsd*)
152 ifconfig lo0 10.53.0.$ns delete
154 *-*-bsdi[3-5].*)
155 ifconfig lo0 remove 10.53.0.$ns
157 *-dec-osf[4-5].*)
158 ifconfig lo0 -alias 10.53.0.$ns
160 *-sgi-irix6.*)
161 ifconfig lo0 -alias 10.53.0.$ns
163 *-*-sysv5uw7*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
164 ifconfig lo0 -alias 10.53.0.$ns
166 *-ibm-aix4.*|*-ibm-aix5.*)
167 ifconfig lo0 delete 10.53.0.$ns
169 hpux)
170 ifconfig lo0:$int 10.53.0.$ns down
172 *-sco3.2v*)
173 ifconfig lo0 -alias 10.53.0.$ns
175 *darwin*)
176 ifconfig lo0 -alias 10.53.0.$ns
179 echo "Don't know how to destroy interface. Giving up."
180 exit 1
181 esac
182 done
187 echo "Usage: $0 { up | down } [base]"
188 exit 1
189 esac