OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / pluto / test / bin / ifconfigs
1 #!/bin/sh
2 # Set up or tear down virtual interfaces needed for testing.
3 # Only "check" can work without superuser privileges.
4
5 . CONFIG
6
7 for i
8 do
9         case "$i" in
10         up)
11                 /sbin/ifconfig $EASTIF $EASTIP netmask 255.255.255.255
12                 /sbin/ifconfig $WESTIF $WESTIP netmask 255.255.255.255
13                 /sbin/ifconfig $NORTHIF $NORTHIP netmask 255.255.255.255
14                 /sbin/ifconfig $SOUTHIF $SOUTHIP netmask 255.255.255.255
15                 ;;
16         down)
17                 /sbin/ifconfig $EASTIF down
18                 /sbin/ifconfig $WESTIF down
19                 /sbin/ifconfig $NORTHIF down
20                 /sbin/ifconfig $SOUTHIF down
21                 ;;
22         check)
23                 ( /sbin/ifconfig $EASTIF | grep 'inet addr' >/dev/null ) &&
24                 ( /sbin/ifconfig $WESTIF | grep 'inet addr' >/dev/null ) &&
25                 ( /sbin/ifconfig $NORTHIF | grep 'inet addr' >/dev/null ) &&
26                 ( /sbin/ifconfig $SOUTHIF | grep 'inet addr' >/dev/null )
27                 ;;
28         show)
29                 /sbin/ifconfig $EASTIF
30                 /sbin/ifconfig $WESTIF
31                 /sbin/ifconfig $NORTHIF
32                 /sbin/ifconfig $SOUTHIF
33                 ;;
34         *)
35                 echo "$0: \"up\", \"down\", or \"check\" expected, not \"$i\"" >&2
36                 exit 1
37                 ;;
38         esac
39 done