All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH] fix network in stubdoms
Date: Fri, 17 Apr 2009 17:13:12 +0100	[thread overview]
Message-ID: <49E8AA98.4000807@eu.citrix.com> (raw)

Hi all,
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>

---

diff --git a/net.c b/net.c
index 983222e..5260369 100644
--- 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 */
diff --git a/xen-vl-extra.c b/xen-vl-extra.c
index 9be1acd..3d13583 100644
--- a/xen-vl-extra.c
+++ b/xen-vl-extra.c
@@ -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)
 {

                 reply	other threads:[~2009-04-17 16:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49E8AA98.4000807@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.