]> xenbits.xen.org Git - xenclient/ioemu.git/commitdiff
stubdom: fix network
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 17 Apr 2009 16:41:32 +0000 (17:41 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 17 Apr 2009 16:41:32 +0000 (17:41 +0100)
Date: Fri, 17 Apr 2009 16:14:50 GMT

this patch fixes network support in ioemu stubdoms.
At the moment in order to provide a working network interface to the
guest you still need to specify a vif in both the guest and stubdom
config files.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
net.c
xen-vl-extra.c

diff --git a/net.c b/net.c
index 983222edb4d12a519e7645a6b6919464a23d91d6..52603693da7d2a2320d4d4cb9cb78c7a6bc26413 100644 (file)
--- a/net.c
+++ b/net.c
@@ -977,6 +977,20 @@ static int tap_open(char *ifname, int ifname_size)
     fcntl(fd, F_SETFL, O_NONBLOCK);
     return fd;
 }
+#elif defined(CONFIG_STUBDOM)
+#include <netfront.h>
+static int tap_open(char *ifname, int ifname_size)
+{
+    char nodename[64];
+    static int num = 1; // 0 is for our own TCP/IP networking
+    snprintf(nodename, sizeof(nodename), "device/vif/%d", num++);
+    return netfront_tap_open(nodename);
+}
+
+#undef DEFAULT_NETWORK_SCRIPT
+#define DEFAULT_NETWORK_SCRIPT ""
+#undef DEFAULT_NETWORK_DOWN_SCRIPT
+#define DEFAULT_NETWORK_DOWN_SCRIPT ""
 #endif
 
 static int launch_script(const char *setup_script, const char *ifname,
@@ -1023,10 +1037,6 @@ static int net_tap_init(VLANState *vlan, const char *model,
                         const char *setup_script, const char *down_script,
                         const char *script_arg)
 {
-#ifdef CONFIG_STUBDOM
-    errno = ENOSYS;
-    return -1;
-#else
     TAPState *s;
     int fd;
     char ifname[128];
@@ -1060,7 +1070,6 @@ static int net_tap_init(VLANState *vlan, const char *model,
     else
         s->script_arg[0] = '\0';
     return 0;
-#endif
 }
 
 #endif /* !_WIN32 */
index 9be1acd03d5379c2102240dface31fcbe757beae..3d1358348a0ddeda370d98e5204b56f75439f5e5 100644 (file)
@@ -99,22 +99,6 @@ void do_loadvm(const char *name)
 
 struct qemu_alarm_timer;
 
-#ifdef CONFIG_STUBDOM
-#include <netfront.h>
-static int tap_open(char *ifname, int ifname_size)
-{
-    char nodename[64];
-    static int num = 1; // 0 is for our own TCP/IP networking
-    snprintf(nodename, sizeof(nodename), "device/vif/%d", num++);
-    return netfront_tap_open(nodename);
-}
-
-#undef DEFAULT_NETWORK_SCRIPT
-#define DEFAULT_NETWORK_SCRIPT ""
-#undef DEFAULT_NETWORK_DOWN_SCRIPT
-#define DEFAULT_NETWORK_DOWN_SCRIPT ""
-#endif
-
 #ifdef CONFIG_PASSTHROUGH
 void do_pci_del(char *devname)
 {