Index: package_tags/invirt-xen-config/0.0.21/config.todo
===================================================================
--- package_tags/invirt-xen-config/0.0.21/config.todo	(revision 2078)
+++ package_tags/invirt-xen-config/0.0.21/config.todo	(revision 2078)
@@ -0,0 +1,4 @@
+sysvms/*: MAC addresses
+vif-sipbroute: isolate patch
+vif-sipbroute: gateway, interface (for arpspoof)
+invirt-database: interface
Index: package_tags/invirt-xen-config/0.0.21/debian/changelog
===================================================================
--- package_tags/invirt-xen-config/0.0.21/debian/changelog	(revision 2078)
+++ package_tags/invirt-xen-config/0.0.21/debian/changelog	(revision 2078)
@@ -0,0 +1,236 @@
+invirt-xen-config (0.0.21) unstable; urgency=low
+
+  * Move sysvms/* into xvm-prodconfig from invirt-xen-config
+  * genericize sysvm startup to glob /etc/xen/sysvms/s_*
+  * eth2 -> config.xen.network.iface
+
+ -- Greg Price <price@mit.edu>  Sat, 31 Jan 2009 18:40:20 -0500
+
+invirt-xen-config (0.0.20) unstable; urgency=low
+
+  * Add Provides and Conflicts lines to debian/control for
+    config-package-dev
+
+ -- Evan Broder <broder@mit.edu>  Sat, 24 Jan 2009 20:16:06 -0500
+
+invirt-xen-config (0.0.19) unstable; urgency=low
+
+  * prune tempfile, subprocess imports from invirt-database
+    (subprocess!  wow, that was a hack.  that was also over a year ago, r223.)
+
+ -- Greg Price <price@mit.edu>  Tue, 09 Dec 2008 00:25:56 -0500
+
+invirt-xen-config (0.0.18) unstable; urgency=low
+
+  * Explicitly grab the short form of the hostname to assemble the backend
+    hostname
+
+ -- Evan Broder <broder@mit.edu>  Wed, 26 Nov 2008 01:27:07 -0500
+
+invirt-xen-config (0.0.17) unstable; urgency=low
+
+  * Pin libxen3 to the hardy repository so it doesn't get pulled from
+    hardy-backports until we're ready to upgrade to Xen 3.3
+
+ -- Evan Broder <broder@mit.edu>  Sat, 22 Nov 2008 19:19:07 -0500
+
+invirt-xen-config (0.0.16) unstable; urgency=low
+
+  * Pick the kernel and initrd for the autoinstaller based on the kernel
+    the dom0 is currently running
+
+ -- Evan Broder <broder@mit.edu>  Sat, 15 Nov 2008 23:45:30 -0500
+
+invirt-xen-config (0.0.15) unstable; urgency=low
+
+  * Set the max memory to a really high number so we can bump it for users
+  * Pass the correct networking device to vif-invirtroute
+
+ -- Evan Broder <broder@mit.edu>  Fri, 14 Nov 2008 00:03:47 -0500
+
+invirt-xen-config (0.0.14) unstable; urgency=low
+
+  * Throw away any output from LVM commands while starting sysvms
+  * Correctly delete the lock LVs
+
+ -- Evan Broder <broder@mit.edu>  Mon, 10 Nov 2008 03:57:09 -0500
+
+invirt-xen-config (0.0.13) unstable; urgency=low
+
+  * Use a lock LV when attempting to start sysvms since exclusive LV
+    activation has useless semantics
+
+ -- Evan Broder <broder@mit.edu>  Mon, 10 Nov 2008 03:15:31 -0500
+
+invirt-xen-config (0.0.12) unstable; urgency=low
+
+  * Add missing close paren to init script
+
+ -- Evan Broder <broder@mit.edu>  Fri, 31 Oct 2008 09:50:47 -0400
+
+invirt-xen-config (0.0.11) unstable; urgency=low
+
+  * Automatically startup sysvms if they're not running already
+
+ -- Evan Broder <broder@mit.edu>  Fri, 31 Oct 2008 09:47:15 -0400
+
+invirt-xen-config (0.0.10) unstable; urgency=low
+
+  * Generate config files for sysvms
+
+ -- Evan Broder <broder@mit.edu>  Fri, 31 Oct 2008 07:40:13 -0400
+
+invirt-xen-config (0.0.9) unstable; urgency=low
+
+  * don't try to disable tx checksums for HVMs; it errors out
+
+ -- Greg Price <price@mit.edu>  Wed, 29 Oct 2008 01:26:07 -0400
+
+invirt-xen-config (0.0.8) unstable; urgency=low
+
+  * sipb-xen-base -> invirt-base
+
+ -- Evan Broder <broder@mit.edu>  Tue, 28 Oct 2008 04:23:38 -0400
+
+invirt-xen-config (0.0.7) unstable; urgency=low
+
+  * Clarify description to distinguish from invirt-host-master
+
+ -- Greg Price <price@mit.edu>  Sat, 25 Oct 2008 21:16:51 -0400
+
+invirt-xen-config (0.0.6) unstable; urgency=low
+
+  * sipb-xen-database-common -> invirt-database
+
+ -- Evan Broder <broder@mit.edu>  Sat, 25 Oct 2008 21:03:33 -0400
+
+invirt-xen-config (0.0.5) unstable; urgency=low
+
+  * Give the init script a less weird sounding description
+
+ -- Evan Broder <broder@mit.edu>  Sat, 25 Oct 2008 19:11:28 -0400
+
+invirt-xen-config (0.0.4) unstable; urgency=low
+
+  * Another typo in the init script
+
+ -- Evan Broder <broder@mit.edu>  Sat, 25 Oct 2008 19:07:32 -0400
+
+invirt-xen-config (0.0.3) unstable; urgency=low
+
+  * Some small fixes in the init script
+
+ -- Evan Broder <broder@mit.edu>  Sat, 25 Oct 2008 19:03:12 -0400
+
+invirt-xen-config (0.0.2) unstable; urgency=low
+
+  * Whoops - add the dependencies for the old sipb-xen-database-client
+
+ -- Evan Broder <broder@mit.edu>  Sat, 25 Oct 2008 18:38:56 -0400
+
+invirt-xen-config (0.0.1) unstable; urgency=low
+
+  * Rename sipb-xen-dom0 -> invirt-xen-config
+  * Rearrange the source package
+  * Divert /etc/xen/qemu-ifup, since it existed and we've been scribbling
+    over it
+  * Generate /etc/xen/xend-config.sxp
+  * Move the invirt-database Xen config script into this package
+
+ -- Evan Broder <broder@mit.edu>  Sat, 25 Oct 2008 17:52:39 -0400
+
+sipb-xen-dom0 (2.10) unstable; urgency=low
+
+  * Fix DHCP checksum error for ParaVMs
+
+ -- Evan Broder <broder@mit.edu>  Sun, 19 Oct 2008 22:12:09 -0400
+
+sipb-xen-dom0 (2.9.1) unstable; urgency=low
+
+  * Whoops - was slightly too vicious with the cuts to qemu-dm-sipb
+
+ -- Evan Broder <broder@mit.edu>  Sun, 19 Oct 2008 01:55:41 -0400
+
+sipb-xen-dom0 (2.9) unstable; urgency=low
+
+  * Move the qemu-ifup script to the location where it's now expected to
+    be.
+  * Clear out some debugging code from qemu-dm-sipb
+
+ -- Evan Broder <broder@mit.edu>  Sun, 19 Oct 2008 01:39:43 -0400
+
+sipb-xen-dom0 (2.8) unstable; urgency=low
+
+  * Apply Sam's fix to vif-sipbroute for the prod cluster (the interface
+    should eventually be configurized)
+
+ -- Evan Broder <broder@mit.edu>  Tue, 07 Oct 2008 01:18:37 -0400
+
+sipb-xen-dom0 (2.7) unstable; urgency=low
+
+  * Update qemu-dm-sipb to reflect the new location of qemu-dm
+
+ -- Evan Broder <broder@mit.edu>  Mon, 06 Oct 2008 18:55:59 -0400
+
+sipb-xen-dom0 (2.6) unstable; urgency=low
+
+  * depend on sipb-xen-base
+
+ -- Greg Price <price@mit.edu>  Wed, 01 Oct 2008 20:28:21 -0400
+
+sipb-xen-dom0 (2.5) unstable; urgency=low
+
+  * Don't rely on exported ROOT.
+
+ -- Anders Kaseorg <andersk@mit.edu>  Fri, 02 May 2008 02:41:43 -0400
+
+sipb-xen-dom0 (2.4) unstable; urgency=low
+
+  * Add sipb-xen-losetup, a half-sane wrapper around the insane losetup.
+
+ -- Greg Price <price@mit.edu>  Thu,  1 May 2008 01:13:28 -0400
+
+sipb-xen-dom0 (2.3) unstable; urgency=low
+
+  * Depend on generic metapackages/provides instead of particular 
+    versions.
+
+ -- Anders Kaseorg <andersk@sipb-xen.mit.edu>  Sat, 27 Oct 2007 21:23:00 -0400
+
+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 <hartmans@debian.org>  Sun, 26 Aug 2007 18:57:17 -0400
+
+sipb-xen-dom0 (2.1) unstable; urgency=low
+
+  * Fix typo in init script 
+  * depend  on dsniff for arpspoof
+
+ -- Sam Hartman <hartmans@debian.org>  Fri, 24 Aug 2007 17:22:20 -0400
+
+sipb-xen-dom0 (2) unstable; urgency=low
+
+  * Add qemu-dm-sipb written by andersk to get us the  domain ID in qemu-ifup 
+  * Add vif-sipbroute, a version of vif-route that does better netwwork
+    isolation and has initial but useless ipv6 support.  This version also
+    uses arpspoof to take over an address for domain migrations.   
+  * Add init script to enable rp_filter, proxy_arp and forwarding for the network config.
+
+ -- Sam Hartman <hartmans@debian.org>  Fri, 24 Aug 2007 17:17:23 -0400
+
+sipb-xen-dom0 (1) unstable; urgency=low
+
+  *  First version
+
+ -- Sam Hartman <hartmans@debian.org>  Sat,  4 Aug 2007 20:20:32 -0400
+
Index: package_tags/invirt-xen-config/0.0.21/debian/compat
===================================================================
--- package_tags/invirt-xen-config/0.0.21/debian/compat	(revision 2078)
+++ package_tags/invirt-xen-config/0.0.21/debian/compat	(revision 2078)
@@ -0,0 +1,1 @@
+4
Index: package_tags/invirt-xen-config/0.0.21/debian/control
===================================================================
--- package_tags/invirt-xen-config/0.0.21/debian/control	(revision 2078)
+++ package_tags/invirt-xen-config/0.0.21/debian/control	(revision 2078)
@@ -0,0 +1,16 @@
+Source: invirt-xen-config
+Section: base
+Priority: extra
+Maintainer: Invirt project <invirt@mit.edu>
+Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 4.1.0), config-package-dev, xen-utils-3.2
+Standards-Version: 3.8.0
+
+Package: invirt-xen-config
+Architecture: all
+Depends: ${misc:Depends}, dsniff, lvm2, grub, ubuntu-xen-server,
+ invirt-base, python-sqlalchemy, python-psycopg2,
+ invirt-database
+Provides: ${diverted-files}
+Conflicts: ${diverted-files}
+Description: Xen configuration for Invirt host
+ This package configures Xen for an Invirt host.
Index: package_tags/invirt-xen-config/0.0.21/debian/copyright
===================================================================
--- package_tags/invirt-xen-config/0.0.21/debian/copyright	(revision 2078)
+++ package_tags/invirt-xen-config/0.0.21/debian/copyright	(revision 2078)
@@ -0,0 +1,16 @@
+This software was written as part of the Invirt project <invirt@mit.edu>.
+
+Copyright :
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+On Debian systems, the complete text of the GNU General Public License
+can be found in the file /usr/share/common-licenses/GPL.
Index: package_tags/invirt-xen-config/0.0.21/debian/invirt-xen-config.init
===================================================================
--- package_tags/invirt-xen-config/0.0.21/debian/invirt-xen-config.init	(revision 2078)
+++ package_tags/invirt-xen-config/0.0.21/debian/invirt-xen-config.init	(revision 2078)
@@ -0,0 +1,96 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides:          invirt-xen-config
+# Required-Start:    $local_fs $remote_fs
+# Required-Stop:     $local_fs $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Startup script for the Invirt Xen host
+# Description:       
+### END INIT INFO
+
+PACKAGE=invirt-xen-config
+NAME="$PACKAGE"
+DESC="Invirt Xen host"
+PARENTPACKAGE=xend
+SYSVM_FILES=(/etc/xen/sysvms/s_*)
+SYSVMS=("${SYSVM_FILES[@]/#\/etc\/xen\/sysvms\/}")
+GEN_FILES=(/etc/xen/xend-config.sxp.invirt)
+
+dpkg -s "$PACKAGE" >/dev/null 2>/dev/null || exit 0
+
+. /lib/init/gen-files.sh
+. /lib/init/std-init.sh
+
+start_sysvm() {
+    # Attempt to start a sysvm, but only if it's not running already
+    # somewhere on the cluster
+    
+    VM="$1"
+    LV="${VM}_hda"
+    DISK="/dev/xenvg/$LV"
+    
+    # Don't bother trying to start the VM if it's already running
+    if xm list "$VM" >/dev/null 2>&1; then
+        return 1
+    fi
+    
+    RET=1
+    # To keep multiple hosts from trying to start a VM at the same
+    # time, lock VM creation at startup-time with a lock LV, since LV
+    # creation is atomic
+    if lvcreate -L 1K -n "lock_${LV}" xenvg >/dev/null 2>&1; then
+        # If we can disable the LV, then the VM isn't already running
+        # somewhere else
+        if lvchange -a n "$DISK" >/dev/null 2>&1; then
+            lvchange -a y "$DISK" >/dev/null 2>&1
+            
+            [ "$VERBOSE" != no ] && log_daemon_msg "Starting sysvm $VM"
+            xm create "sysvms/$VM" >/dev/null
+            [ "$VERBOSE" != no ] && log_end_msg $?
+            RET=0
+        fi
+        
+        # Regardless of whether we could get the lock or not, the
+        # lvchange -a n probably disabled the LV somewhere; be sure we
+        # clean up
+        lvchange -a y "$DISK" >/dev/null 2>&1
+    
+        # Cleanup the lock, regardless of whether we started the LV
+        lvchange -a n "/dev/xenvg/lock_${LV}" >/dev/null 2>&1
+        lvchange -a ey "/dev/xenvg/lock_${LV}" >/dev/null 2>&1
+        lvremove -f "/dev/xenvg/lock_${LV}" >/dev/null 2>&1
+    fi
+    
+    return $RET
+}
+
+do_startup() {
+    gen_files
+    
+    for vm in "${SYSVMS[@]}"; do
+        start_sysvm "$vm"
+    done
+    
+    echo 1 >/proc/sys/net/ipv4/ip_forward
+    for i in all default; do
+        echo 1 >/proc/sys/net/ipv4/conf/$i/rp_filter
+        echo 1 >/proc/sys/net/ipv4/conf/$i/proxy_arp
+    done
+    
+    invoke-rc.d "$PARENTPACKAGE" "$1"
+}
+
+do_start() {
+    do_startup "start"
+}
+
+do_reload() {
+    do_startup "reload"
+}
+
+do_stop() {
+    invoke-rc.d "$PARENTPACKAGE" stop
+}
+
+std_init "$1"
Index: package_tags/invirt-xen-config/0.0.21/debian/invirt-xen-config.install
===================================================================
--- package_tags/invirt-xen-config/0.0.21/debian/invirt-xen-config.install	(revision 2078)
+++ package_tags/invirt-xen-config/0.0.21/debian/invirt-xen-config.install	(revision 2078)
@@ -0,0 +1,7 @@
+qemu-dm-invirt usr/sbin
+qemu-ifup.invirt etc/xen
+invirt-database etc/xen
+vif-invirtroute etc/xen/scripts
+preferences.invirt etc/apt
+
+debian/xend-config.sxp.invirt.mako etc/xen
Index: package_tags/invirt-xen-config/0.0.21/debian/rules
===================================================================
--- package_tags/invirt-xen-config/0.0.21/debian/rules	(revision 2078)
+++ package_tags/invirt-xen-config/0.0.21/debian/rules	(revision 2078)
@@ -0,0 +1,19 @@
+#!/usr/bin/make -f
+
+DEB_DIVERT_EXTENSION = .invirt
+
+DEB_DIVERT_FILES_invirt-xen-config += \
+	/etc/xen/qemu-ifup.invirt \
+	/etc/xen/xend-config.sxp.invirt \
+	/etc/apt/preferences.invirt
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/rules/config-package.mk
+
+common-build-indep:: debian/xend-config.sxp.invirt.mako
+
+debian/xend-config.sxp.invirt.mako: $(call debian_check_files,/etc/xen/xend-config.sxp)
+	debian/transform_xend-config.sxp.invirt.mako < $< > $@
+
+clean::
+	rm -f debian/xend-config.sxp.invirt.mako
Index: package_tags/invirt-xen-config/0.0.21/debian/transform_xend-config.sxp.invirt.mako
===================================================================
--- package_tags/invirt-xen-config/0.0.21/debian/transform_xend-config.sxp.invirt.mako	(revision 2078)
+++ package_tags/invirt-xen-config/0.0.21/debian/transform_xend-config.sxp.invirt.mako	(revision 2078)
@@ -0,0 +1,13 @@
+#!/usr/bin/perl -0n
+print <<'EOF';
+<%
+from invirt.config import structs as cfg
+import os
+hostname = os.uname()[1].split('.')[0]
+%>
+EOF
+
+s/^\#?\(xend-relocation-address ''\)/(xend-relocation-address '\${hostname}-internal')/m or die;
+s/^\(xend-relocation-hosts-allow '[^']*'\)/(xend-relocation-hosts-allow '')/m or die;
+s/^\(dom0-min-mem [0-9]*\)/(dom0-min-mem 1536)/m or die;
+print;
Index: package_tags/invirt-xen-config/0.0.21/invirt-database
===================================================================
--- package_tags/invirt-xen-config/0.0.21/invirt-database	(revision 2078)
+++ package_tags/invirt-xen-config/0.0.21/invirt-database	(revision 2078)
@@ -0,0 +1,103 @@
+# -*- mode: python; -*-
+from invirt.database import models, connect
+from invirt.config import structs as config
+import re
+
+connect()
+prefix = "d_"
+
+# 'machine_name', and optionally 'cdrom_image', should get passed in
+# from the xm create call
+
+def check(b):
+    if not b:
+        import sys
+        sys.exit(1)
+
+machine = models.Machine.query().filter_by(name=machine_name).one()
+check(machine is not None)
+machine_type = machine.type
+cdrom = None
+if 'cdrom_image' in locals():
+    cdrom = models.CDROM.query().filter_by(cdrom_id=cdrom_image).one()
+    check(cdrom is not None)
+
+memory = machine.memory
+maxmem = '2048'
+check(re.match('^[A-Za-z0-9][A-Za-z0-9._-]*$', machine.name))
+name = prefix + machine.name
+check(re.match('^[0-9a-f-]+$', machine.uuid))
+uuid = machine.uuid
+
+vcpus = machine.cpus
+
+diskioemu = ""
+viftype = ""
+
+pae = machine_type.pae
+acpi = machine_type.acpi
+apic = machine_type.apic
+
+vif = []
+
+disk = []
+
+if machine_type.hvm:
+    codepath = 'hvm'
+else:
+    codepath = 'paravm'
+
+if 'installer_options' in locals(): #Installer
+    disk.append('phy:/dev/xenvg/s_install_hda,hdb,r')
+
+    import os
+    release = os.uname()[2]
+    kernel = '/boot/vmlinuz-%s' % release
+    ramdisk = '/boot/initrd.img-%s' % release
+
+    if not machine.nics:
+        raise RuntimeError('You must have a nic to autoinstall')
+    n = machine.nics[0]
+    extra = 'ro noresume'
+    extra += (' ip=%s::%s:%s:%s:eth0:off'
+         % (n.ip, config.dhcp.gateway, config.dhcp.netmask, machine.name))
+    extra += ' %s' % installer_options
+    root = '/dev/hdb1'
+    codepath = None
+elif cdrom is not None:
+    disk.append('phy:/dev/xenvg/image_' + cdrom.cdrom_id + ',hdc:cdrom,r')
+    boot = 'd'
+    codepath = 'hvm'
+
+if codepath == 'hvm':
+    ioemu = "ioemu:"
+    viftype = "type=ioemu, "
+    kernel = '/usr/lib/xen/boot/hvmloader'
+    builder = 'hvm'
+    vnc = 1
+    vncpasswd = 'moocow'
+    device_model = '/usr/sbin/qemu-dm-invirt'
+    serial = "pty"
+elif codepath == 'paravm':
+    bootloader = '/usr/bin/pygrub'
+
+
+for n in machine.nics:
+    check(re.match('^[0-9a-fA-F:]+$', n.mac_addr) and re.match('^[0-9.]*$', n.ip))
+    d = ('%smac=%s, ip=%s, script=vif-invirtroute netdev=%s'
+         % (viftype, n.mac_addr, n.ip, config.xen.network.iface))
+    vif.append(d)
+
+for d in machine.disks:
+    check(re.match('^[A-Za-z0-9]+$', d.guest_device_name))
+    device = '/dev/xenvg/' + prefix + machine.name + '_' + d.guest_device_name
+    dspec = 'phy:%s,%s%s,w' % (device, diskioemu, d.guest_device_name)
+    disk.append(dspec)
+
+usbdevice = 'tablet'
+
+on_poweroff = 'destroy'
+on_reboot = 'restart'
+on_crash = 'destroy'
+if machine.autorestart:
+    on_crash = 'restart'
Index: package_tags/invirt-xen-config/0.0.21/preferences.invirt
===================================================================
--- package_tags/invirt-xen-config/0.0.21/preferences.invirt	(revision 2078)
+++ package_tags/invirt-xen-config/0.0.21/preferences.invirt	(revision 2078)
@@ -0,0 +1,3 @@
+Package: libxen3
+Pin: release a=hardy
+Pin-Priority: 700
Index: package_tags/invirt-xen-config/0.0.21/qemu-dm-invirt
===================================================================
--- package_tags/invirt-xen-config/0.0.21/qemu-dm-invirt	(revision 2078)
+++ package_tags/invirt-xen-config/0.0.21/qemu-dm-invirt	(revision 2078)
@@ -0,0 +1,12 @@
+#!/bin/sh
+domid=
+for i; do
+    if [ "$domid" = "_NEXT_" ]; then
+	domid=$i
+	break
+    elif [ "$i" = "-d" ]; then
+	domid=_NEXT_
+    fi
+done
+export domid
+exec "/usr/lib/xen/bin/qemu-dm" "$@"
Index: package_tags/invirt-xen-config/0.0.21/qemu-ifup.invirt
===================================================================
--- package_tags/invirt-xen-config/0.0.21/qemu-ifup.invirt	(revision 2078)
+++ package_tags/invirt-xen-config/0.0.21/qemu-ifup.invirt	(revision 2078)
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+echo "config qemu network with xen bridge for $@"
+
+if [ -z "$domid" ]; then
+    echo "domid is not set!!!" >&2
+    exit 1
+fi
+
+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-invirtroute online
Index: package_tags/invirt-xen-config/0.0.21/vif-invirtroute
===================================================================
--- package_tags/invirt-xen-config/0.0.21/vif-invirtroute	(revision 2078)
+++ package_tags/invirt-xen-config/0.0.21/vif-invirtroute	(revision 2078)
@@ -0,0 +1,90 @@
+#!/bin/bash
+
+
+
+
+
+#============================================================================
+# /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).
+# 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
+
+#============================================================================
+
+dir=$(dirname "$0")
+. "$dir/vif-common.sh"
+
+main_ip=$(dom0_ip)
+dev=${dev:-${vif}}
+
+case "$command" in
+    online)
+        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 
+        if [ x${qemu_online} != xyes ]; then
+          ethtool -K ${dev} tx off
+        fi
+        ipcmd='add'
+        cmdprefix=''
+        ;;
+    offline)
+        do_without_error ifdown ${vif}
+	if [ -f /var/run/radvd/radvd.pid.${vif} ] ; then
+	    do_without_error kill `cat /var/run/radvd/radvd.pid.${vif}`
+	    fi
+        ipcmd='del'
+        cmdprefix='do_without_error'
+        ;;
+esac
+
+v6prefix=${v6prefix:-}
+v6prefix=$(xenstore_read_default "$XENBUS_PATH/v6prefix" "$v6prefix")
+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 ${dev} src ${main_ip}
+	    arpspoof -i $(invirt-getconf xen.network.iface) -t 18.181.0.1 ${addr}&
+	    sleep 5
+	    kill %arpspoof
+	done 
+    fi
+
+    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
+
+log debug "Successful vif-route $command for $vif."
+if [ "$command" == "online" ]
+then
+  success
+fi
