Commit fa035091 authored by William Pitcock's avatar William Pitcock

main/xen: implement hotplug script adding vTRILL support for situations where dom0 is an RBridge

parent ea6864c4
......@@ -3,7 +3,7 @@
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=xen
pkgver=4.3.0
pkgrel=3
pkgrel=4
pkgdesc="Xen hypervisor"
url="http://www.xen.org/"
arch="x86_64"
......@@ -32,6 +32,8 @@ source="http://bits.xensource.com/oss-xen/release/$pkgver/$pkgname-$pkgver.tar.g
qemu-coroutine-gthread.patch
qemu-xen-websocket-plain-hack.patch
hotplug-vif-vtrill.patch
xenstored.initd
xenstored.confd
xenconsoled.initd
......@@ -193,6 +195,7 @@ a4097e06a7e000ed00f4607db014d277 qemu-xen-websocket.patch
35bdea1d4e3ae2565edc7e40906efdd5 qemu-xen-tls-websockets.patch
9cf9b155dfa6cd473554aa0f25181c1c qemu-coroutine-gthread.patch
f8ea5786b0a6157b9cb3e67e323b592c qemu-xen-websocket-plain-hack.patch
e449bb3359b490804ffc7b0ae08d62a0 hotplug-vif-vtrill.patch
a90c36642f0701a8aaa4ebe4dde430f5 xenstored.initd
b017ccdd5e1c27bbf1513e3569d4ff07 xenstored.confd
ed262f15fb880badb53575539468646c xenconsoled.initd
......@@ -217,6 +220,7 @@ e9f6c482fc449e0b540657a8988ad31f2e680b8933e50e6486687a52f6a9ed04 qemu-xen-webso
435dd428d83acdfde58888532a1cece1e9075b2a2460fe3f6cd33c7d400f2715 qemu-xen-tls-websockets.patch
7477c5acfc756f6498858e4a3eb250b3db84ee491a9d4ae38dddbc27275a370c qemu-coroutine-gthread.patch
6c4c184462d47e7fd00e8d8f6bf12b33f6cf486f00415c1934ecf6c2b62f69c1 qemu-xen-websocket-plain-hack.patch
dd1e784bc455eb62cb85b3fa24bfc34f575ceaab9597ef6a2f1ee7ff7b3cae0a hotplug-vif-vtrill.patch
868c77d689ae54b7041da169bfaa01868503337d4105a071eb771f4ec5a0543d xenstored.initd
ea9171e71ab3d33061979bcf3bb737156192aa4b0be4d1234438ced75b6fdef3 xenstored.confd
93bea2eb90ea1b4628854c8141dd351bbd1fbc5959b12795447ea933ad025f01 xenconsoled.initd
......@@ -241,6 +245,7 @@ bda9105793f2327e1317991762120d0668af0e964076b18c9fdbfd509984b2e88d85df95702c46b2
11eaccc346440ff285552f204d491e3b31bda1665c3219ecae3061b5d55db9dec885af0c031fa19c67e87bbe238002b1911bbd5bfea2f2ba0d61e6b3d0c952c9 qemu-xen-tls-websockets.patch
8b8df4f57ab725f54cfe44fb6b8d271ee22e94873f168e452293dd53955854b171b8311209133e5d825f9ce985219818803182b3451708a3452bc699b7b1dda1 qemu-coroutine-gthread.patch
692e29205fa3d0a6e4d1be69a242d55c44a1fee26c594e6e46d8809339f93dcdc31c0735723a46f63ae0a727741bdc8a899bb1ce9103a2cd701b236f63a17fa2 qemu-xen-websocket-plain-hack.patch
f095ea373f36381491ad36f0662fb4f53665031973721256b23166e596318581da7cbb0146d0beb2446729adfdb321e01468e377793f6563a67d68b8b0f7ffe3 hotplug-vif-vtrill.patch
880584e0866b1efcf3b7a934f07072ec84c13c782e3e7a15848d38ba8af50259d46db037dca1e037b15274989f2c22acd1134954dd60c59f4ee693b417d03e0d xenstored.initd
100cf4112f401f45c1e4e885a5074698c484b40521262f6268fad286498e95f4c51e746f0e94eb43a590bb8e813a397bb53801ccacebec9541020799d8d70514 xenstored.confd
12f981b2459c65d66e67ec0b32d0d19b95a029bc54c2a79138cfe488d3524a22e51860f755abfe25ddcdaf1b27f2ded59b6e350b9d5f8791193d00e2d3673137 xenconsoled.initd
......
--- xen-4.3.0/tools/hotplug/Linux/Makefile
+++ xen-4.3.0.mod/tools/hotplug/Linux/Makefile
@@ -14,6 +14,7 @@
XEN_SCRIPTS += network-route vif-route
XEN_SCRIPTS += network-nat vif-nat
XEN_SCRIPTS += vif-openvswitch
+XEN_SCRIPTS += vif-vtrill
XEN_SCRIPTS += vif2
XEN_SCRIPTS += vif-setup
XEN_SCRIPTS += block
--- xen-4.3.0/tools/hotplug/Linux/vif-common.sh
+++ xen-4.3.0.mod/tools/hotplug/Linux/vif-common.sh
@@ -213,3 +213,31 @@
fi
echo "$result"
}
+
+ip6_of()
+{
+ ip -6 -o addr show scope global dev "$1" | awk '$3 == "inet6" { split($4,i,"/"); print i[1]; exit }'
+}
+
+dom0_ip6_gateway()
+{
+ ip -6 -o route show "default" | awk '$1 == "default" { print $3; exit }'
+}
+
+dom0_ip6()
+{
+ local nd=${netdev:-eth0}
+ local result=$(ip6_of "$nd")
+ if [ -z "$result" ]
+ then
+ echo ""
+ else
+ echo "$result"
+ fi
+}
+
+is_ipv6()
+{
+ echo "${1}" | grep -q ':' && echo "ipv6"
+}
+
--- /dev/null
+++ xen-4.3.0.mod/tools/hotplug/Linux/vif-vtrill
@@ -0,0 +1,91 @@
+#!/bin/bash
+#============================================================================
+# ${XEN_SCRIPT_DIR}/vif-vtrill
+# Based on ${XEN_SCRIPT_DIR}/vif-openvswitch
+#
+# Script for configuring a vif in routed + bridged 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 ${XEN_CONFIG_DIR}/xend-config.sxp. If the script is specified in
+# neither of those places, then this script is the default.
+#
+# Usage:
+# vif-openvswitch (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 (optional).
+#
+# up:
+# Enslaves the vif interface to a VM-specific bridge and adds iptables rules
+# for its ip addresses (if any).
+#
+# down:
+# Removes the vif interface from the VM-bridge bridge and removes the iptables
+# rules for its ip addresses (if any).
+#============================================================================
+
+dir=$(dirname "$0")
+. "${dir}/vif-common.sh"
+
+main_ip=$(dom0_ip)
+main_ip6=$(dom0_ip6)
+gateway_ip6=$(dom0_ip6_gateway)
+vlanname=$(echo ${dev} | cut -d'.' -f1)
+
+case "${command}" in
+ online)
+ create_bridge ${vlanname}
+ add_to_bridge ${vlanname} ${dev}
+ ifconfig ${vlanname} ${main_ip} netmask 255.255.255.255 up
+ if [ ! -z "${main_ip6}" ]
+ then
+ ip -6 addr add ${main_ip6} dev ${vlanname}
+ ip -6 neighbor add proxy ${gateway_ip6} dev ${vlanname}
+ echo 1 >/proc/sys/net/ipv6/conf/${vlanname}/proxy_ndp
+ fi
+ echo 1 >/proc/sys/net/ipv4/conf/${vlanname}/proxy_arp
+ ipcmd='add'
+ cmdprefix=''
+ ;;
+ offline)
+ ifconfig ${vlanname} down
+ brctl delbr ${vlanname}
+ ipcmd='del'
+ cmdprefix='do_without_error'
+ ;;
+ add)
+ create_bridge ${vlanname}
+ add_to_bridge ${vlanname} ${dev}
+ ;;
+ remove)
+ ;;
+esac
+
+if [ "${ip}" -a "$type_if" != "tap" ] ; 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
+ do_without_error ip route del ${addr}
+ if [ "$(is_ipv6 ${addr})" = "ipv6" ]; then
+ ${cmdprefix} ip -6 route ${ipcmd} ${addr} dev ${vlanname} src ${main_ip6}
+ ${cmdprefix} ip -6 neighbor ${ipcmd} proxy ${addr} dev ${netdev:-eth0}
+ else
+ do_without_error ip route ${ipcmd} ${addr} dev ${vlanname} src ${main_ip}
+ fi
+ done
+fi
+
+log "iptable"
+handle_iptable
+
+call_hooks vif post
+
+log debug "Successful vif-vtrill ${command} for ${dev}."
+if [ "${command}" = "online" ]
+then
+ success
+fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment