Annotation of src/external/mpl/bind/dist/bin/tests/system/ifconfig.sh, Revision 1.1.1.1.2.2
1.1.1.1.2.2! pgoyette 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: #
! 15: # IPv4: 10.53.0.{1..8} RFC 1918
! 16: # 10.53.1.{0..2}
! 17: # 10.53.2.{0..2}
! 18: # IPv6: fd92:7065:b8e:ffff::{1..8} ULA
! 19: # fd92:7065:b8e:99ff::{1..2}
! 20: # fd92:7065:b8e:ff::{1..2}
! 21: #
! 22:
! 23: config_guess=""
! 24: for f in ./config.guess ../../../config.guess
! 25: do
! 26: if test -f $f
! 27: then
! 28: config_guess=$f
! 29: fi
! 30: done
! 31:
! 32: if test "X$config_guess" = "X"
! 33: then
! 34: cat <<EOF >&2
! 35: $0: must be run from the top level source directory or the
! 36: bin/tests/system directory
! 37: EOF
! 38: exit 1
! 39: fi
! 40:
! 41: # If running on hp-ux, don't even try to run config.guess.
! 42: # It will try to create a temporary file in the current directory,
! 43: # which fails when running as root with the current directory
! 44: # on a NFS mounted disk.
! 45:
! 46: case `uname -a` in
! 47: *HP-UX*) sys=hpux ;;
! 48: *) sys=`sh $config_guess` ;;
! 49: esac
! 50:
! 51: use_ip=
! 52: case "$sys" in
! 53: *-*-linux*)
! 54: if type ip > /dev/null; then
! 55: use_ip=yes
! 56: elif type ifconfig > /dev/null; then
! 57: :
! 58: else
! 59: echo "$0: can't find ip or ifconfig" >&2
! 60: exit 1
! 61: fi
! 62: ;;
! 63: esac
! 64:
! 65: case "$1" in
! 66:
! 67: start|up)
! 68: for i in 0 1 2
! 69: do
! 70: case $i in
! 71: 0) ipv6="ff" ;;
! 72: 1) ipv6="99" ;;
! 73: 2) ipv6="00" ;;
! 74: *) ipv6="" ;;
! 75: esac
! 76: for ns in 1 2 3 4 5 6 7 8
! 77: do
! 78: [ $i -gt 0 -a $ns -gt 2 ] && break
! 79: int=`expr $i \* 10 + $ns - 1`
! 80: case "$sys" in
! 81: *-pc-solaris2.5.1)
! 82: ifconfig lo0:$int 10.53.$i.$ns \
! 83: netmask 0xffffffff up
! 84: ;;
! 85: *-sun-solaris2.[6-7])
! 86: ifconfig lo0:$int 10.53.$i.$ns \
! 87: netmask 0xffffffff up
! 88: ;;
! 89: *-*-solaris2.[8-9]|*-*-solaris2.1[0-9])
! 90: /sbin/ifconfig lo0:$int plumb
! 91: /sbin/ifconfig lo0:$int 10.53.$i.$ns up
! 92: /sbin/ifconfig lo0:$int inet6 plumb
! 93: [ "$ipv6" ] && /sbin/ifconfig lo0:$int \
! 94: inet6 fd92:7065:b8e:${ipv6}ff::$ns up
! 95: ;;
! 96: *-*-linux*)
! 97: if [ $use_ip ]; then
! 98: ip address add 10.53.$i.$ns/24 \
! 99: dev lo:$int
! 100: [ "$ipv6" ] && ip address add \
! 101: fd92:7065:b8e:${ipv6}ff::$ns/64 \
! 102: dev lo
! 103: else
! 104: ifconfig lo:$int 10.53.$i.$ns up \
! 105: netmask 255.255.255.0
! 106: [ "$ipv6" ] && ifconfig lo inet6 add \
! 107: fd92:7065:b8e:${ipv6}ff::$ns/64
! 108: fi
! 109: ;;
! 110: *-unknown-freebsd*)
! 111: ifconfig lo0 10.53.$i.$ns alias \
! 112: netmask 0xffffffff
! 113: [ "$ipv6" ] && ifconfig lo0 inet6 \
! 114: fd92:7065:b8e:${ipv6}ff::$ns alias
! 115: ;;
! 116: *-unknown-netbsd*)
! 117: ifconfig lo0 10.53.$i.$ns alias \
! 118: netmask 255.255.255.0
! 119: [ "$ipv6" ] && ifconfig lo0 inet6 \
! 120: fd92:7065:b8e:${ipv6}ff::$ns alias
! 121: ;;
! 122: *-unknown-openbsd*)
! 123: ifconfig lo0 10.53.$i.$ns alias \
! 124: netmask 255.255.255.0
! 125: [ "$ipv6" ] && ifconfig lo0 inet6 \
! 126: fd92:7065:b8e:${ipv6}ff::$ns alias
! 127: ;;
! 128: *-*-bsdi[3-5].*)
! 129: ifconfig lo0 add 10.53.$i.$ns \
! 130: netmask 255.255.255.0
! 131: ;;
! 132: *-dec-osf[4-5].*)
! 133: ifconfig lo0 alias 10.53.$i.$ns
! 134: ;;
! 135: *-sgi-irix6.*)
! 136: ifconfig lo0 alias 10.53.$i.$ns
! 137: ;;
! 138: *-*-sysv5uw7*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
! 139: ifconfig lo0 10.53.$i.$ns alias \
! 140: netmask 0xffffffff
! 141: ;;
! 142: *-ibm-aix4.*|*-ibm-aix5.*)
! 143: ifconfig lo0 alias 10.53.$i.$ns
! 144: [ "$ipv6" ] && ifconfig lo0 inet6 alias -dad \
! 145: fd92:7065:b8e:${ipv6}ff::$ns/64
! 146: ;;
! 147: hpux)
! 148: ifconfig lo0:$int 10.53.$i.$ns \
! 149: netmask 255.255.255.0 up
! 150: [ "$ipv6" ] && ifconfig lo0:$int inet6 \
! 151: fd92:7065:b8e:${ipv6}ff::$ns up
! 152: ;;
! 153: *-sco3.2v*)
! 154: ifconfig lo0 alias 10.53.$i.$ns
! 155: ;;
! 156: *-darwin*)
! 157: ifconfig lo0 alias 10.53.$i.$ns
! 158: [ "$ipv6" ] && ifconfig lo0 inet6 \
! 159: fd92:7065:b8e:${ipv6}ff::$ns alias
! 160: ;;
! 161: *-cygwin*)
! 162: echo "Please run ifconfig.bat as Administrator."
! 163: exit 1
! 164: ;;
! 165: *)
! 166: echo "Don't know how to set up interface. Giving up."
! 167: exit 1
! 168: esac
! 169: done
! 170: done
! 171: ;;
! 172:
! 173: stop|down)
! 174: for i in 0 1 2
! 175: do
! 176: case $i in
! 177: 0) ipv6="ff" ;;
! 178: 1) ipv6="99" ;;
! 179: 2) ipv6="00" ;;
! 180: *) ipv6="" ;;
! 181: esac
! 182: for ns in 8 7 6 5 4 3 2 1
! 183: do
! 184: [ $i -gt 0 -a $ns -gt 2 ] && continue
! 185: int=`expr $i \* 10 + $ns - 1`
! 186: case "$sys" in
! 187: *-pc-solaris2.5.1)
! 188: ifconfig lo0:$int 0.0.0.0 down
! 189: ;;
! 190: *-sun-solaris2.[6-7])
! 191: ifconfig lo0:$int 10.53.$i.$ns down
! 192: ;;
! 193: *-*-solaris2.[8-9]|*-*-solaris2.1[0-9])
! 194: ifconfig lo0:$int 10.53.$i.$ns down
! 195: ifconfig lo0:$int 10.53.$i.$ns unplumb
! 196: ifconfig lo0:$int inet6 down
! 197: ifconfig lo0:$int inet6 unplumb
! 198: ;;
! 199: *-*-linux*)
! 200: if [ $use_ip ]; then
! 201: ip address del 10.53.$i.$ns/24 \
! 202: dev lo:$int
! 203: [ "$ipv6" ] && ip address del \
! 204: fd92:7065:b8e:${ipv6}ff::$ns/64 \
! 205: dev lo
! 206: else
! 207: ifconfig lo:$int 10.53.$i.$ns down
! 208: [ "$ipv6" ] && ifconfig lo inet6 \
! 209: del fd92:7065:b8e:${ipv6}ff::$ns/64
! 210: fi
! 211: ;;
! 212: *-unknown-freebsd*)
! 213: ifconfig lo0 10.53.$i.$ns delete
! 214: [ "$ipv6" ] && ifconfig lo0 inet6 \
! 215: fd92:7065:b8e:${ipv6}ff::$ns delete
! 216: ;;
! 217: *-unknown-netbsd*)
! 218: ifconfig lo0 10.53.$i.$ns delete
! 219: [ "$ipv6" ] && ifconfig lo0 inet6 \
! 220: fd92:7065:b8e:${ipv6}ff::$ns delete
! 221: ;;
! 222: *-unknown-openbsd*)
! 223: ifconfig lo0 10.53.$i.$ns delete
! 224: [ "$ipv6" ] && ifconfig lo0 inet6 \
! 225: fd92:7065:b8e:${ipv6}ff::$ns delete
! 226: ;;
! 227: *-*-bsdi[3-5].*)
! 228: ifconfig lo0 remove 10.53.$i.$ns
! 229: ;;
! 230: *-dec-osf[4-5].*)
! 231: ifconfig lo0 -alias 10.53.$i.$ns
! 232: ;;
! 233: *-sgi-irix6.*)
! 234: ifconfig lo0 -alias 10.53.$i.$ns
! 235: ;;
! 236: *-*-sysv5uw7*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
! 237: ifconfig lo0 -alias 10.53.$i.$ns
! 238: ;;
! 239: *-ibm-aix4.*|*-ibm-aix5.*)
! 240: ifconfig lo0 delete 10.53.$i.$ns
! 241: [ "$ipv6" ] && ifconfig lo0 delete inet6 \
! 242: fd92:7065:b8e:${ipv6}ff::$ns/64
! 243: ;;
! 244: hpux)
! 245: ifconfig lo0:$int 0.0.0.0
! 246: ifconfig lo0:$int inet6 ::
! 247: ;;
! 248: *-sco3.2v*)
! 249: ifconfig lo0 -alias 10.53.$i.$ns
! 250: ;;
! 251: *darwin*)
! 252: ifconfig lo0 -alias 10.53.$i.$ns
! 253: [ "$ipv6" ] && ifconfig lo0 inet6 \
! 254: fd92:7065:b8e:${ipv6}ff::$ns delete
! 255: ;;
! 256: *-cygwin*)
! 257: echo "Please run ifconfig.bat as Administrator."
! 258: exit 1
! 259: ;;
! 260: *)
! 261: echo "Don't know how to destroy interface. Giving up."
! 262: exit 1
! 263: esac
! 264: done
! 265: done
! 266: ;;
! 267:
! 268: *)
! 269: echo "Usage: $0 { up | down }"
! 270: exit 1
! 271: esac
CVSweb <webmaster@jp.NetBSD.org>