Hi,

Patch below makes qemu -net nic -net tap work when you don't specify an
ifname, ie stops it always printing garbage like:

$ ../qemu -hda test.img -net nic -net tap
warning: could not open
                         NL@
: no virtual network emulation
Could not initialize device 'tap'

I sent this to the maintainer a few weeks ago but no response.

It doesn't seem to be fixed (at least if it is, not in the same way) in
qemu cvs, so I'm going to file a bug report with them too.

-- Nicholas.

Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/qemu/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- Makefile    17 Feb 2006 12:43:32 -0000      1.13
+++ Makefile    25 Mar 2006 10:52:13 -0000
@@ -5,7 +5,7 @@

  COMMENT=              "multi system emulator"
  DISTNAME=             qemu-0.8.0
-PKGNAME=               ${DISTNAME}p3
+PKGNAME=               ${DISTNAME}p4
  CATEGORIES=           emulators

  HOMEPAGE=             http://fabrice.bellard.free.fr/qemu/
Index: patches/patch-vl_c
===================================================================
RCS file: /cvs/ports/emulators/qemu/patches/patch-vl_c,v
retrieving revision 1.7
diff -u -r1.7 patch-vl_c
--- patches/patch-vl_c  16 Feb 2006 16:27:44 -0000      1.7
+++ patches/patch-vl_c  25 Mar 2006 10:52:13 -0000
@@ -1,5 +1,5 @@
---- vl.c.orig  Mon Dec 19 16:51:53 2005
-+++ vl.c       Tue Feb 14 14:52:26 2006
+--- vl.c.orig  Mon Dec 19 22:51:53 2005
++++ vl.c       Sat Mar 25 10:21:38 2006
  @@ -43,7 +43,8 @@
   #include <netdb.h>
   #ifdef _BSD
@@ -213,7 +213,23 @@
       snprintf(s->vc->info_str, sizeof(s->vc->info_str),
                "socket: fd=%d", fd);
       if (is_connected) {
-@@ -3986,6 +4095,7 @@ void help(void)
+@@ -2642,11 +2751,13 @@ int net_client_init(const char *str)
+             if (net_tap_fd_init(vlan, fd))
+                 ret = 0;
+         } else {
+-            get_param_value(ifname, sizeof(ifname), "ifname", p);
+             if (get_param_value(setup_script, sizeof(setup_script), "script", 
p) == 0) {
+                 pstrcpy(setup_script, sizeof(setup_script), 
DEFAULT_NETWORK_SCRIPT);
+             }
+-            ret = net_tap_init(vlan, ifname, setup_script);
++            if (get_param_value(ifname, sizeof(ifname), "ifname", p) == 0)
++                ret = net_tap_init(vlan, NULL, setup_script); 
++            else
++                ret = net_tap_init(vlan, ifname, setup_script);
+         }
+     } else
+     if (!strcmp(device, "socket")) {
+@@ -3986,6 +4097,7 @@ void help(void)
   #if defined(TARGET_PPC) || defined(TARGET_SPARC)
              "-g WxH[xDEPTH]  Set the initial graphical resolution and depth\n"
   #endif
@@ -221,7 +237,7 @@
              "\n"
              "Network options:\n"
              "-net nic[,vlan=n][,macaddr=addr]\n"
-@@ -4093,6 +4203,7 @@ enum {
+@@ -4093,6 +4205,7 @@ enum {
       QEMU_OPTION_audio_help,
       QEMU_OPTION_soundhw,
   #endif
@@ -229,7 +245,7 @@

       QEMU_OPTION_net,
       QEMU_OPTION_tftp,
-@@ -4195,6 +4306,7 @@ const QEMUOption qemu_options[] = {
+@@ -4195,6 +4308,7 @@ const QEMUOption qemu_options[] = {

       /* temporary options */
       { "usb", 0, QEMU_OPTION_usb },
@@ -237,7 +253,7 @@
       { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
       { NULL },
   };
-@@ -4441,7 +4553,7 @@ int main(int argc, char **argv)
+@@ -4441,7 +4555,7 @@ int main(int argc, char **argv)
           serial_devices[i][0] = '\0';
       serial_device_index = 0;

@@ -246,7 +262,7 @@
       for(i = 1; i < MAX_PARALLEL_PORTS; i++)
           parallel_devices[i][0] = '\0';
       parallel_device_index = 0;
-@@ -4601,6 +4713,9 @@ int main(int argc, char **argv)
+@@ -4601,6 +4715,9 @@ int main(int argc, char **argv)
                           optarg);
                   nb_net_clients++;
                   break;

Reply via email to