[BACK]Return to ifconfig.sh CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / external / mpl / bind / dist / bin / tests / system

Annotation of src/external/mpl/bind/dist/bin/tests/system/ifconfig.sh, Revision 1.1.1.5

1.1       christos    1: #!/bin/sh
                      2: #
                      3: # Copyright (C) Internet Systems Consortium, Inc. ("ISC")
                      4: #
                      5: # This Source Code Form is subject to the terms of the Mozilla Public
                      6: # License, v. 2.0. If a copy of the MPL was not distributed with this
                      7: # file, You can obtain one at http://mozilla.org/MPL/2.0/.
                      8: #
                      9: # See the COPYRIGHT file distributed with this work for additional
                     10: # information regarding copyright ownership.
                     11:
                     12: #
                     13: # Set up interface aliases for bind9 system tests.
                     14: #
1.1.1.2   christos   15: # IPv4: 10.53.0.{1..10}                                RFC 1918
1.1.1.4   christos   16: #       10.53.1.{1..2}
                     17: #       10.53.2.{1..2}
1.1.1.2   christos   18: # IPv6: fd92:7065:b8e:ffff::{1..10}            ULA
1.1       christos   19: #       fd92:7065:b8e:99ff::{1..2}
                     20: #       fd92:7065:b8e:ff::{1..2}
                     21: #
                     22:
1.1.1.5 ! christos   23: SYSTEMTESTTOP="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
        !            24: . "$SYSTEMTESTTOP/conf.sh"
1.1       christos   25:
1.1.1.5 ! christos   26: export SYSTEMTESTTOP
        !            27:
        !            28: sys=$($SHELL "$TOP/config.guess")
1.1       christos   29:
                     30: use_ip=
                     31: case "$sys" in
                     32:         *-*-linux*)
                     33:                 if type ip > /dev/null; then
                     34:                         use_ip=yes
                     35:                 elif type ifconfig > /dev/null; then
                     36:                         :
                     37:                 else
                     38:                         echo "$0: can't find ip or ifconfig" >&2
                     39:                         exit 1
                     40:                 fi
                     41:                 ;;
                     42: esac
                     43:
                     44: case "$1" in
                     45:
                     46:     start|up)
                     47:        for i in 0 1 2
                     48:        do
                     49:                case $i in
                     50:                  0) ipv6="ff" ;;
                     51:                  1) ipv6="99" ;;
                     52:                  2) ipv6="00" ;;
                     53:                  *) ipv6="" ;;
                     54:                esac
1.1.1.2   christos   55:                for ns in 1 2 3 4 5 6 7 8 9 10
1.1       christos   56:                do
                     57:                        [ $i -gt 0 -a $ns -gt 2 ] && break
1.1.1.2   christos   58:                        int=`expr $i \* 10 + $ns`
1.1       christos   59:                        case "$sys" in
                     60:                            *-pc-solaris2.5.1)
                     61:                                ifconfig lo0:$int 10.53.$i.$ns \
                     62:                                        netmask 0xffffffff up
                     63:                                ;;
                     64:                            *-sun-solaris2.[6-7])
                     65:                                ifconfig lo0:$int 10.53.$i.$ns \
                     66:                                        netmask 0xffffffff up
                     67:                                ;;
                     68:                            *-*-solaris2.[8-9]|*-*-solaris2.1[0-9])
                     69:                                /sbin/ifconfig lo0:$int plumb
                     70:                                /sbin/ifconfig lo0:$int 10.53.$i.$ns up
                     71:                                /sbin/ifconfig lo0:$int inet6 plumb
                     72:                                [ "$ipv6" ] && /sbin/ifconfig lo0:$int \
                     73:                                        inet6 fd92:7065:b8e:${ipv6}ff::$ns up
                     74:                                ;;
                     75:                            *-*-linux*)
                     76:                                 if [ $use_ip ]; then
                     77:                                         ip address add 10.53.$i.$ns/24 \
                     78:                                             dev lo:$int
                     79:                                         [ "$ipv6" ] && ip address add \
                     80:                                             fd92:7065:b8e:${ipv6}ff::$ns/64 \
                     81:                                             dev lo
                     82:                                 else
                     83:                                         ifconfig lo:$int 10.53.$i.$ns up \
                     84:                                                 netmask 255.255.255.0
                     85:                                         [ "$ipv6" ] && ifconfig lo inet6 add \
                     86:                                                 fd92:7065:b8e:${ipv6}ff::$ns/64
                     87:                                 fi
                     88:                                ;;
                     89:                            *-unknown-freebsd*)
                     90:                                ifconfig lo0 10.53.$i.$ns alias \
                     91:                                        netmask 0xffffffff
                     92:                                [ "$ipv6" ] && ifconfig lo0 inet6 \
                     93:                                        fd92:7065:b8e:${ipv6}ff::$ns alias
                     94:                                ;;
1.1.1.4   christos   95:                            *-unknown-dragonfly*|*-unknown-netbsd*|*-unknown-openbsd*)
1.1       christos   96:                                ifconfig lo0 10.53.$i.$ns alias \
                     97:                                        netmask 255.255.255.0
                     98:                                [ "$ipv6" ] && ifconfig lo0 inet6 \
                     99:                                        fd92:7065:b8e:${ipv6}ff::$ns alias
                    100:                                ;;
                    101:                            *-*-bsdi[3-5].*)
                    102:                                ifconfig lo0 add 10.53.$i.$ns \
                    103:                                        netmask 255.255.255.0
                    104:                                ;;
                    105:                            *-dec-osf[4-5].*)
                    106:                                ifconfig lo0 alias 10.53.$i.$ns
                    107:                                ;;
                    108:                            *-sgi-irix6.*)
                    109:                                ifconfig lo0 alias 10.53.$i.$ns
                    110:                                ;;
                    111:                            *-*-sysv5uw7*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
                    112:                                ifconfig lo0 10.53.$i.$ns alias \
                    113:                                        netmask 0xffffffff
                    114:                                ;;
                    115:                            *-ibm-aix4.*|*-ibm-aix5.*)
                    116:                                ifconfig lo0 alias 10.53.$i.$ns
                    117:                                [ "$ipv6" ] && ifconfig lo0 inet6 alias -dad \
                    118:                                        fd92:7065:b8e:${ipv6}ff::$ns/64
                    119:                                ;;
                    120:                            hpux)
                    121:                                ifconfig lo0:$int 10.53.$i.$ns \
                    122:                                        netmask 255.255.255.0 up
                    123:                                [ "$ipv6" ] && ifconfig lo0:$int inet6 \
                    124:                                        fd92:7065:b8e:${ipv6}ff::$ns up
                    125:                                ;;
                    126:                            *-sco3.2v*)
                    127:                                ifconfig lo0 alias 10.53.$i.$ns
                    128:                                ;;
                    129:                            *-darwin*)
                    130:                                ifconfig lo0 alias 10.53.$i.$ns
                    131:                                [ "$ipv6" ] && ifconfig lo0 inet6 \
                    132:                                        fd92:7065:b8e:${ipv6}ff::$ns alias
                    133:                                ;;
                    134:                            *-cygwin*)
                    135:                                echo "Please run ifconfig.bat as Administrator."
                    136:                                exit 1
                    137:                                ;;
                    138:                            *)
                    139:                                echo "Don't know how to set up interface.  Giving up."
                    140:                                exit 1
                    141:                        esac
                    142:                done
                    143:        done
                    144:        ;;
                    145:
                    146:     stop|down)
                    147:        for i in 0 1 2
                    148:        do
                    149:                case $i in
                    150:                  0) ipv6="ff" ;;
                    151:                  1) ipv6="99" ;;
                    152:                  2) ipv6="00" ;;
                    153:                  *) ipv6="" ;;
                    154:                esac
1.1.1.2   christos  155:                for ns in 10 9 8 7 6 5 4 3 2 1
1.1       christos  156:                do
                    157:                        [ $i -gt 0 -a $ns -gt 2 ] && continue
                    158:                        int=`expr $i \* 10 + $ns - 1`
                    159:                        case "$sys" in
                    160:                            *-pc-solaris2.5.1)
                    161:                                ifconfig lo0:$int 0.0.0.0 down
                    162:                                ;;
                    163:                            *-sun-solaris2.[6-7])
                    164:                                ifconfig lo0:$int 10.53.$i.$ns down
                    165:                                ;;
                    166:                            *-*-solaris2.[8-9]|*-*-solaris2.1[0-9])
                    167:                                ifconfig lo0:$int 10.53.$i.$ns down
                    168:                                ifconfig lo0:$int 10.53.$i.$ns unplumb
                    169:                                ifconfig lo0:$int inet6 down
                    170:                                ifconfig lo0:$int inet6 unplumb
                    171:                                ;;
                    172:                            *-*-linux*)
                    173:                                 if [ $use_ip ]; then
                    174:                                         ip address del 10.53.$i.$ns/24 \
                    175:                                             dev lo:$int
                    176:                                         [ "$ipv6" ] && ip address del \
                    177:                                             fd92:7065:b8e:${ipv6}ff::$ns/64 \
                    178:                                             dev lo
                    179:                                 else
                    180:                                         ifconfig lo:$int 10.53.$i.$ns down
                    181:                                         [ "$ipv6" ] && ifconfig lo inet6 \
                    182:                                             del fd92:7065:b8e:${ipv6}ff::$ns/64
                    183:                                 fi
                    184:                                ;;
                    185:                            *-unknown-freebsd*)
                    186:                                ifconfig lo0 10.53.$i.$ns delete
                    187:                                [ "$ipv6" ] && ifconfig lo0 inet6 \
                    188:                                        fd92:7065:b8e:${ipv6}ff::$ns delete
                    189:                                ;;
                    190:                            *-unknown-netbsd*)
                    191:                                ifconfig lo0 10.53.$i.$ns delete
                    192:                                [ "$ipv6" ] && ifconfig lo0 inet6 \
                    193:                                        fd92:7065:b8e:${ipv6}ff::$ns delete
                    194:                                ;;
                    195:                            *-unknown-openbsd*)
                    196:                                ifconfig lo0 10.53.$i.$ns delete
                    197:                                [ "$ipv6" ] && ifconfig lo0 inet6 \
                    198:                                        fd92:7065:b8e:${ipv6}ff::$ns delete
                    199:                                ;;
                    200:                            *-*-bsdi[3-5].*)
                    201:                                ifconfig lo0 remove 10.53.$i.$ns
                    202:                                ;;
                    203:                            *-dec-osf[4-5].*)
                    204:                                ifconfig lo0 -alias 10.53.$i.$ns
                    205:                                ;;
                    206:                            *-sgi-irix6.*)
                    207:                                ifconfig lo0 -alias 10.53.$i.$ns
                    208:                                ;;
                    209:                            *-*-sysv5uw7*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
                    210:                                ifconfig lo0 -alias 10.53.$i.$ns
                    211:                                ;;
                    212:                            *-ibm-aix4.*|*-ibm-aix5.*)
                    213:                                ifconfig lo0 delete 10.53.$i.$ns
                    214:                                [ "$ipv6" ] && ifconfig lo0 delete inet6 \
                    215:                                        fd92:7065:b8e:${ipv6}ff::$ns/64
                    216:                                ;;
                    217:                            hpux)
                    218:                                ifconfig lo0:$int 0.0.0.0
                    219:                                ifconfig lo0:$int inet6 ::
                    220:                                ;;
                    221:                            *-sco3.2v*)
                    222:                                ifconfig lo0 -alias 10.53.$i.$ns
                    223:                                ;;
                    224:                            *darwin*)
                    225:                                ifconfig lo0 -alias 10.53.$i.$ns
                    226:                                [ "$ipv6" ] && ifconfig lo0 inet6 \
                    227:                                        fd92:7065:b8e:${ipv6}ff::$ns delete
                    228:                                ;;
                    229:                            *-cygwin*)
                    230:                                echo "Please run ifconfig.bat as Administrator."
                    231:                                exit 1
                    232:                                ;;
                    233:                            *)
                    234:                                echo "Don't know how to destroy interface.  Giving up."
                    235:                                exit 1
                    236:                        esac
                    237:                done
                    238:        done
                    239:        ;;
                    240:
                    241:        *)
                    242:                echo "Usage: $0 { up | down }"
                    243:                exit 1
                    244: esac

CVSweb <webmaster@jp.NetBSD.org>