/etc/xen/scripts/vif-route-adt is in autopkgtest-xenlvm 2.0.1ubuntu4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | #!/bin/bash -e
#============================================================================
# /etc/xen/vif-route
#
# Script for configuring a vif in routed mode.
# The hotplugging system will call this script if it is specified either in
# the device configuration given to Xend, or the default Xend configuration
# in /etc/xen/xend-config.sxp. If the script is specified in neither of those
# places, then vif-bridge is the default.
#
# Usage:
# vif-route (add|remove|online|offline)
#
# Environment vars:
# vif vif interface name (required).
# XENBUS_PATH path to this device's details in the XenStore (required).
#
# Read from the store:
# ip list of IP networks for the vif, space-separated (default given in
# this script).
#============================================================================
case $0 in */*) dir=${0%/*};; *) dir=.;; esac
. "$dir/vif-common.sh"
main_ip=$(dom0_ip)
mac=$(xenstore_read "$XENBUS_PATH/mac")
case "$command" in
online)
ifconfig ${vif} ${main_ip} netmask 255.255.255.255 \
broadcast ${main_ip} up
ip -f inet6 addr delete dev $vif local fe80::fcff:ffff:feff:ffff/64 ||:
ipcmd='add'
iptcmd='-A'
cmdprefix=''
add_only=''
;;
offline)
ifdown ${vif}
ipcmd='del'
iptcmd='-D'
cmdprefix='do_without_error'
add_only=:
;;
esac
if [ "${ip}" ] ; then
# If we've been given a list of IP addresses, then add routes from dom0 to
# the guest using those addresses.
for addr in ${ip} ; do
${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${main_ip}
${add_only} ip -f inet neigh add to ${addr} dev ${vif} lladdr ${mac} nud permanent
${add_only} arp -i ${vif} -s ${addr} ${mac} pub
done
fi
iptables "$iptcmd" INPUT -i "$vif" -j AdtXenIn
iptables "$iptcmd" FORWARD -i "$vif" -j AdtXenFwd
log debug "Successful vif-route $command for $vif."
if [ "$command" == "online" ]
then
success
fi
|