debuggers.hg

view tools/internal/xi_vifinit @ 665:a74ec9013abb

bitkeeper revision 1.349 (3f132695Orgv2nzuhXag1iNmNOy53Q)

Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into labyrinth.cl.cam.ac.uk:/auto/anfs/scratch/labyrinth/iap10/xeno-clone/xeno.bk
author iap10@labyrinth.cl.cam.ac.uk
date Mon Jul 14 21:54:29 2003 +0000 (2003-07-14)
parents cda951fc1bef 1449562d0ec4
children
line source
1 #!/bin/bash
2 #
3 # vifinit
4 #
5 # This is a silly little script to dump a couple of simple rules down to
6 # the hypervisor to assign a full static IP to a given virtual interface.
7 #
8 # Usage is:
9 #
10 # vifinit [vif dom] [vif idx] [dotted decimal ip address]
11 #
12 if [ $# -ne 3 ] ;
13 then
14 echo "usage: $0 <domain_id> <vid_ifx> <dotted_decimal_ip_address>"
15 exit
16 fi
18 #outbound rule:
19 echo $3 | grep -q "^169\\.254\\."
20 if [ $? -eq 0 ];
21 then
22 # If this is a link local address, send to dom0
23 echo "ADD ACCEPT srcaddr=$3 srcaddrmask=255.255.255.255 srcdom=$1 srcidx=$2 dstdom=0 dstidx=0 proto=any" > /proc/xeno/vfr
24 else
25 # If this is not, send to wire
26 echo "ADD ACCEPT srcaddr=$3 srcaddrmask=255.255.255.255 srcdom=$1 srcidx=$2 dst=PHYS proto=any" > /proc/xeno/vfr
27 fi
29 #inbound rule:
30 echo "ADD ACCEPT dstaddr=$3 dstaddrmask=255.255.255.255 src=ANY dstdom=$1 dstidx=$2 proto=any" > /proc/xeno/vfr
32 #----] done.