2 #============================================================================
5 # Script for configuring a vif in routed mode.
6 # The hotplugging system will call this script if it is specified either in
7 # the device configuration given to Xend, or the default Xend configuration
8 # in /etc/xen/xend-config.sxp. If the script is specified in neither of those
9 # places, then vif-bridge is the default.
12 # vif-route (add|remove|online|offline)
15 # vif vif interface name (required).
16 # XENBUS_PATH path to this device's details in the XenStore (required).
18 # Read from the store:
19 # ip list of IP networks for the vif, space-separated (default given in
21 #============================================================================
23 case $0 in */*) dir=${0%/*};; *) dir=.;; esac
24 . "$dir/vif-common.sh"
27 mac=$(xenstore_read "$XENBUS_PATH/mac")
31 ifconfig ${vif} ${main_ip} netmask 255.255.255.255 \
32 broadcast ${main_ip} up
33 ip -f inet6 addr delete dev $vif local fe80::fcff:ffff:feff:ffff/64 ||:
43 cmdprefix='do_without_error'
49 # If we've been given a list of IP addresses, then add routes from dom0 to
50 # the guest using those addresses.
51 for addr in ${ip} ; do
52 ${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${main_ip}
53 ${add_only} ip -f inet neigh add to ${addr} dev ${vif} lladdr ${mac} nud permanent
54 ${add_only} arp -i ${vif} -s ${addr} ${mac} pub
58 iptables "$iptcmd" INPUT -i "$vif" -j AdtXenIn
59 iptables "$iptcmd" FORWARD -i "$vif" -j AdtXenFwd
61 log debug "Successful vif-route $command for $vif."
62 if [ "$command" == "online" ]