ia64/xen-unstable

view tools/hotplug/Linux/vif-route @ 19818:415505139333

Get rid of hardcoded pathes for stubdom and hotplug scripts

- Have the buid system generate a file which exports the install paths
for the hotplug scripts and stubdom / stubdom-dm
- Move file generation code from tools/python/Makefile into a gmake
macro
in Config.mk to avoid maintenance of three duplicates each with its
own
tweaks and bugs
- Export gmake variables into ioemu as shell variables
for upcoming ioemu patches
- Do above as a gmake macro to avoid maintenance of several duplicates
- Adjust hotplug scripts to find the right xen binaries from the
install directory
- Adjust stubdom-dm to use the install directories

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jun 23 17:25:51 2009 +0100 (2009-06-23)
parents 4bfc67b09e9c
children
line source
1 #!/bin/bash
2 #============================================================================
3 # ${XEN_SCRIPT_DIR}/vif-route
4 #
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 ${XEN_CONFIG_DIR}/xend-config.sxp. If the script is specified in
9 # neither of those places, then vif-bridge is the default.
10 #
11 # Usage:
12 # vif-route (add|remove|online|offline)
13 #
14 # Environment vars:
15 # vif vif interface name (required).
16 # XENBUS_PATH path to this device's details in the XenStore (required).
17 #
18 # Read from the store:
19 # ip list of IP networks for the vif, space-separated (default given in
20 # this script).
21 #============================================================================
23 dir=$(dirname "$0")
24 . "$dir/vif-common.sh"
26 main_ip=$(dom0_ip)
28 case "$command" in
29 online)
30 ifconfig ${vif} ${main_ip} netmask 255.255.255.255 up
31 echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp
32 ipcmd='add'
33 cmdprefix=''
34 ;;
35 offline)
36 do_without_error ifdown ${vif}
37 ipcmd='del'
38 cmdprefix='do_without_error'
39 ;;
40 esac
42 if [ "${ip}" ] ; then
43 # If we've been given a list of IP addresses, then add routes from dom0 to
44 # the guest using those addresses.
45 for addr in ${ip} ; do
46 ${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${main_ip}
47 done
48 fi
50 handle_iptable
52 log debug "Successful vif-route $command for $vif."
53 if [ "$command" = "online" ]
54 then
55 success
56 fi