From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQuqH-0004rJ-1A for qemu-devel@nongnu.org; Sun, 06 May 2012 02:21:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SQuqF-0006MO-5g for qemu-devel@nongnu.org; Sun, 06 May 2012 02:21:12 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:50529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQuqE-0006M2-Ti for qemu-devel@nongnu.org; Sun, 06 May 2012 02:21:11 -0400 Received: by pbbro12 with SMTP id ro12so7334158pbb.4 for ; Sat, 05 May 2012 23:21:08 -0700 (PDT) From: Benjamin MARSILI Date: Mon, 7 May 2012 00:21:07 +0900 Message-Id: <1336317667-3484-1-git-send-email-mlspirat42@gmail.com> Subject: [Qemu-devel] [PATCH] net: Include the peer's information in VLANClientState->info_str when using the udp socket backend. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Benjamin MARSILI Signed-off-by: Benjamin MARSILI --- 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