qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] net: Include the peer's information in VLANClientState->info_str when using the udp socket backend.
@ 2012-05-06 15:21 Benjamin MARSILI
  0 siblings, 0 replies; only message in thread
From: Benjamin MARSILI @ 2012-05-06 15:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Benjamin MARSILI


Signed-off-by: Benjamin MARSILI <mlspirat42@gmail.com>
---

It makes it easier to debug and figure out what's going on behind the scene.

When using this syntax:
-device DEVICE,netdev=ID -netdev socket,id=ID,udp=LHOST:LPORT,localaddr=RHOST:RPORT

Before:

(qemu) info network
Devices not on any VLAN:
  rtl8139.0: type=nic,model=rtl8139,macaddr=00:ab:29:8c:3e:00
   \ gns3-0: type=socket,socket: udp=127.0.0.1:20003
  rtl8139.1: type=nic,model=rtl8139,macaddr=00:ab:29:8c:3e:01
   \ gns3-1: type=socket,socket: udp=127.0.0.1:20002

After:

(qemu) info network
Devices not on any VLAN:
  rtl8139.0: type=nic,model=rtl8139,macaddr=00:ab:29:8c:3e:00
   \ gns3-0: type=socket,socket: udp=127.0.0.1:20003, localaddr=127.0.0.1,20004
  rtl8139.1: type=nic,model=rtl8139,macaddr=00:ab:29:8c:3e:01
   \ gns3-1: type=socket,socket: udp=127.0.0.1:20002, localaddr=127.0.0.1,10000

 net/socket.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 0bcf229..7613990 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -580,8 +580,9 @@ static int net_socket_udp_init(VLANState *vlan,
     s->dgram_dst = raddr;

     snprintf(s->nc.info_str, sizeof(s->nc.info_str),
-             "socket: udp=%s:%d",
-             inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port));
+             "socket: udp=%s:%d, localaddr=%s,%d",
+             inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port),
+             inet_ntoa(laddr.sin_addr), ntohs(laddr.sin_port));
     return 0;
 }

--
1.7.6

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-06  6:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-06 15:21 [Qemu-devel] [PATCH] net: Include the peer's information in VLANClientState->info_str when using the udp socket backend Benjamin MARSILI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).