ia64/xen-unstable

annotate tools/hotplug/Linux/vif-route @ 19497:2f6ed9318c03

network-bridge: Fix do_ifup in the case of ${bridge} != ${netdev}

On RHEL5.2, ifup ${bridge} fails if ${bridge} != ${netdev},
because RHEL5.2's ifup ${bridge} runs the following sequence:

1. Search CONFIG that has the same mac address of ${bridge}.=20
ifcfg-${netdev} is found.
2. Run "ip link set dev ${netdev} up".
# ${bridge} is expected.
3. Output "Failed to bring up ${netdev}."
Because ${netdev} does not exist.

Thus, do_ifup() should not use ifup if ${bridge} != ${netdev}.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Apr 02 11:48:10 2009 +0100 (2009-04-02)
parents 4bfc67b09e9c
children 415505139333
rev   line source
keir@18770 1 #!/bin/bash
keir@18770 2 #============================================================================
keir@18770 3 # /etc/xen/vif-route
keir@18770 4 #
keir@18770 5 # Script for configuring a vif in routed mode.
keir@18770 6 # The hotplugging system will call this script if it is specified either in
keir@18770 7 # the device configuration given to Xend, or the default Xend configuration
keir@18770 8 # in /etc/xen/xend-config.sxp. If the script is specified in neither of those
keir@18770 9 # places, then vif-bridge is the default.
keir@18770 10 #
keir@18770 11 # Usage:
keir@18770 12 # vif-route (add|remove|online|offline)
keir@18770 13 #
keir@18770 14 # Environment vars:
keir@18770 15 # vif vif interface name (required).
keir@18770 16 # XENBUS_PATH path to this device's details in the XenStore (required).
keir@18770 17 #
keir@18770 18 # Read from the store:
keir@18770 19 # ip list of IP networks for the vif, space-separated (default given in
keir@18770 20 # this script).
keir@18770 21 #============================================================================
keir@18770 22
keir@18770 23 dir=$(dirname "$0")
keir@18770 24 . "$dir/vif-common.sh"
keir@18770 25
keir@18770 26 main_ip=$(dom0_ip)
keir@18770 27
keir@18770 28 case "$command" in
keir@18770 29 online)
keir@18770 30 ifconfig ${vif} ${main_ip} netmask 255.255.255.255 up
keir@18770 31 echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp
keir@18770 32 ipcmd='add'
keir@18770 33 cmdprefix=''
keir@18770 34 ;;
keir@18770 35 offline)
keir@18770 36 do_without_error ifdown ${vif}
keir@18770 37 ipcmd='del'
keir@18770 38 cmdprefix='do_without_error'
keir@18770 39 ;;
keir@18770 40 esac
keir@18770 41
keir@18770 42 if [ "${ip}" ] ; then
keir@18770 43 # If we've been given a list of IP addresses, then add routes from dom0 to
keir@18770 44 # the guest using those addresses.
keir@18770 45 for addr in ${ip} ; do
keir@18770 46 ${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${main_ip}
keir@18770 47 done
keir@18770 48 fi
keir@18770 49
keir@18770 50 handle_iptable
keir@18770 51
keir@18770 52 log debug "Successful vif-route $command for $vif."
keir@18770 53 if [ "$command" = "online" ]
keir@18770 54 then
keir@18770 55 success
keir@18770 56 fi