debuggers.hg

view tools/internal/xi_vifinit @ 662:1449562d0ec4

bitkeeper revision 1.339.1.9 (3f12dd84Gykr1oP22loPEr0jPp3VJA)

Detect link-local addresses in xi_vifinit and route them via dom0, not the physical interface
author rac61@labyrinth.cl.cam.ac.uk
date Mon Jul 14 16:42:44 2003 +0000 (2003-07-14)
parents 9339f3942f4e
children a74ec9013abb
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.