qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] net: Include the peer's information in VLANClientSt


From: Benjamin MARSILI
Subject: [Qemu-devel] [PATCH] net: Include the peer's information in VLANClientState->info_str when using the udp socket backend.
Date: Mon, 7 May 2012 00:21:07 +0900

Signed-off-by: Benjamin MARSILI <address@hidden>
---

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]