From a44ef0ab0184ca00545e293427430608470fbee9 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Sun, 26 Aug 2007 18:58:22 -0400 Subject: [PATCH 1/1] * Add qemu-ifup script that depends on the device model script and invokes vif-sipbroute. As a consequence, we don't really support bridged hvms any more. It's not clear how to get enough information out of qemu to do this. * Call arpspoof with 18.181.0.1's address. This is unfortunate in two ways. First, if we renumber we'll need to update the script. Second, it is possible that someone on 18.181 besides the router may have an address cached. Unfortunately, it doesn't work right if we don't send the spoofed arp directly to the router. svn path=/trunk/packages/sipb-xen-dom0/sipb-xen-dom0/; revision=95 --- debian/changelog | 14 ++++++++++++ files/etc/xen/scripts/qemu-ifup | 13 +++++++++++ files/etc/xen/scripts/vif-sipbroute | 43 +++++++++++++++++++---------------- 3 files changed, 51 insertions(+), 19 deletions(-) create mode 100755 files/etc/xen/scripts/qemu-ifup diff --git a/debian/changelog b/debian/changelog index f2e46c4..6afb7c9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,17 @@ +sipb-xen-dom0 (2.2) unstable; urgency=low + + * Add qemu-ifup script that depends on the device model script and + invokes vif-sipbroute. As a consequence, we don't really support + bridged hvms any more. It's not clear how to get enough information + out of qemu to do this. + * Call arpspoof with 18.181.0.1's address. This is unfortunate in two + ways. First, if we renumber we'll need to update the script. Second, + it is possible that someone on 18.181 besides the router may have an + address cached. Unfortunately, it doesn't work right if we don't + send the spoofed arp directly to the router. + + -- Sam Hartman Sun, 26 Aug 2007 18:57:17 -0400 + sipb-xen-dom0 (2.1) unstable; urgency=low * Fix typo in init script diff --git a/files/etc/xen/scripts/qemu-ifup b/files/etc/xen/scripts/qemu-ifup new file mode 100755 index 0000000..2602f63 --- /dev/null +++ b/files/etc/xen/scripts/qemu-ifup @@ -0,0 +1,13 @@ +#!/bin/sh + + +echo -c 'config qemu network with xen bridge for ' +echo $* + +dev=$1 +qemu_online=yes +XENBUS_PATH=/local/domain/0/backend/vif/${domid}/0 +vif=vif${domid}.0 +export vif qemu_online XENBUS_PATH dev + +exec /etc/xen/scripts/vif-sipbroute online diff --git a/files/etc/xen/scripts/vif-sipbroute b/files/etc/xen/scripts/vif-sipbroute index be2b93e..5cd0a88 100755 --- a/files/etc/xen/scripts/vif-sipbroute +++ b/files/etc/xen/scripts/vif-sipbroute @@ -3,6 +3,7 @@ + #============================================================================ # /etc/xen/vif-route # @@ -24,6 +25,7 @@ # V6PREFIX prefix of v6 address to use # Note that the v6 support is kind of broken because there's not really a way to populate the v6 prefix # This script will set up proxy arp for any ip addresses that are being routed +# type read to determine if the device is ioemu #============================================================================ @@ -31,12 +33,13 @@ dir=$(dirname "$0") . "$dir/vif-common.sh" main_ip=$(dom0_ip) +dev=${dev:-${vif}} case "$command" in online) - ifconfig ${vif} ${main_ip} netmask 255.255.255.255 up - echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp - echo 1 >/proc/sys/net/ipv4/conf/${vif}/rp_filter + ifconfig ${dev} ${main_ip} netmask 255.255.255.255 up + echo 1 >/proc/sys/net/ipv4/conf/${dev}/proxy_arp + echo 1 >/proc/sys/net/ipv4/conf/${dev}/rp_filter ipcmd='add' cmdprefix='' ;; @@ -52,26 +55,28 @@ esac v6prefix=${v6prefix:-} v6prefix=$(xenstore_read_default "$XENBUS_PATH/v6prefix" "$v6prefix") - -if [ "${ip}" ] ; then +vif_type=$(xenstore_read_default "$XENBUS_PATH/type" "viffront") +if [ ${vif_type} != "ioemu" -o x${qemu_online} = xyes ] ; then + 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} - arpspoof -i eth0 ${addr}& - sleep 5 - kill %arpspoof - done -fi - -if [ x${v6prefix} != x ] ; then - sed -e "s/@interface@/${vif}/" -e "s+@prefix@+${v6prefix}+" /etc/xen/radvd.conf.template >/var/run/radvd.conf.${vif} - ${cmdprefix} ip -6 addr ${ipcmd} fe80::/64 scope link dev ${vif} - if [ $1 = online ] ; then - radvd -u radvd -C /var/run/radvd.conf.${vif} -p /var/run/radvd/radvd.pid.${vif} + for addr in ${ip} ; do + ${cmdprefix} ip route ${ipcmd} ${addr} dev ${dev} src ${main_ip} + arpspoof -i eth0 -t 18.181.0.1 ${addr}& + sleep 5 + kill %arpspoof + done fi - ${cmdprefix} ip -6 route ${ipcmd} ${v6prefix} dev ${vif} + + if [ x${v6prefix} != x ] ; then + sed -e "s/@interface@/${dev}/" -e "s+@prefix@+${v6prefix}+" /etc/xen/radvd.conf.template >/var/run/radvd.conf.${vif} + ${cmdprefix} ip -6 addr ${ipcmd} fe80::/64 scope link dev ${dev} + if [ $1 = online ] ; then + radvd -u radvd -C /var/run/radvd.conf.${vif} -p /var/run/radvd/radvd.pid.${vif} + fi + ${cmdprefix} ip -6 route ${ipcmd} ${v6prefix} dev ${dev} fi +fi handle_iptable -- 1.7.9.5