6 #============================================================================
9 # Script for configuring a vif in routed mode.
10 # The hotplugging system will call this script if it is specified either in
11 # the device configuration given to Xend, or the default Xend configuration
12 # in /etc/xen/xend-config.sxp. If the script is specified in neither of those
13 # places, then vif-bridge is the default.
16 # vif-route (add|remove|online|offline)
19 # vif vif interface name (required).
20 # XENBUS_PATH path to this device's details in the XenStore (required).
21 # Read from the store:
22 # ip list of IP networks for the vif, space-separated (default given in
24 # V6PREFIX prefix of v6 address to use
25 # Note that the v6 support is kind of broken because there's not really a way to populate the v6 prefix
26 # This script will set up proxy arp for any ip addresses that are being routed
28 #============================================================================
31 . "$dir/vif-common.sh"
37 ifconfig ${vif} ${main_ip} netmask 255.255.255.255 up
38 echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp
39 echo 1 >/proc/sys/net/ipv4/conf/${vif}/rp_filter
44 do_without_error ifdown ${vif}
45 if [ -f /var/run/radvd/radvd.pid.${vif} ] ; then
46 do_without_error kill `cat /var/run/radvd/radvd.pid.${vif}`
49 cmdprefix='do_without_error'
53 v6prefix=${v6prefix:-}
54 v6prefix=$(xenstore_read_default "$XENBUS_PATH/v6prefix" "$v6prefix")
57 # If we've been given a list of IP addresses, then add routes from dom0 to
58 # the guest using those addresses.
59 for addr in ${ip} ; do
60 ${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${main_ip}
61 arpspoof -i eth0 ${addr}&
67 if [ x${v6prefix} != x ] ; then
68 sed -e "s/@interface@/${vif}/" -e "s+@prefix@+${v6prefix}+" /etc/xen/radvd.conf.template >/var/run/radvd.conf.${vif}
69 ${cmdprefix} ip -6 addr ${ipcmd} fe80::/64 scope link dev ${vif}
70 if [ $1 = online ] ; then
71 radvd -u radvd -C /var/run/radvd.conf.${vif} -p /var/run/radvd/radvd.pid.${vif}
73 ${cmdprefix} ip -6 route ${ipcmd} ${v6prefix} dev ${vif}
78 log debug "Successful vif-route $command for $vif."
79 if [ "$command" == "online" ]