Skip to contentSkip to conversation

Add -net dump option

PATCH New Tristan Gingold 1 participant 1 message Mar 5, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add -net dump option

Hi,

latest version of the patch inlined.

Thanks,
Tristan.

vl.c +2 -0
Index: vl.c
===================================================================
@@ -3987,6 +3987,8 @@
            "                Use group 'groupname' and mode 'octalmode' to change default\n"
            "                ownership and permissions for communication port.\n"
 #endif
+           "-net dump[,vlan=n][,file=f][,len=n]\n"
+           "                dump traffic on vlan 'n' to file 'f' (max n bytes per packet)\n"
            "-net none       use it alone to have zero network devices; if no -net option\n"
            "                is provided, the default is '-net nic -net user'\n"
 #ifdef CONFIG_SLIRP
net.c +155 -11

209 lines not on this page · raw message

net.h +3 -0
Index: net.h
===================================================================
@@ -19,6 +19,9 @@
     IOCanRWHandler *fd_can_read;
     LinkStatusChanged *link_status_changed;
     int link_down;
+    /* If set this client must be the last in the VLAN (currently set only
+       by slirp).  */
+    int last_client;
     void *opaque;
     struct VLANClientState *next;
     struct VLANState *vlan;
qemu-doc.texi +5 -0
Index: qemu-doc.texi
===================================================================
@@ -742,6 +742,11 @@
 qemu linux.img -net nic -net vde,sock=/tmp/myswitch
 @end example
 
+@item -net dump[,vlan=@var{n}][,file=@var{file}][,len=@var{len}]
+Dump network traffic on VLAN @var{n} to file @var{file} (@file{qemu.tcpdump} by
+default).  At most @var{len} bytes (64 by default) by packet are stored.  The
+dump can be analyzed with tools such as tcpdump.
+
 @item -net none
 Indicate that no network devices should be configured. It is used to
 override the default configuration (@option{-net nic -net user}) which