Skip to contentSkip to conversation

net: Include the peer's information in VLANClientState->info_str when using the udp socket backend.

PATCH New Benjamin MARSILI 1 participant 1 message May 6, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Include the peer's information in VLANClientState->info_str when using the udp socket backend.

---

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(-)
net/socket.c +3 -2
index 0bcf229..7613990 100644
@@ -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