From: Eric Pouech eric.pouech@gmail.com
Signed-off-by: Eric Pouech eric.pouech@gmail.com Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/nsiproxy.sys/tcp.c | 7 +++++-- dlls/nsiproxy.sys/udp.c | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/nsiproxy.sys/tcp.c b/dlls/nsiproxy.sys/tcp.c index 8e2d7e749a7..0dbee8418b9 100644 --- a/dlls/nsiproxy.sys/tcp.c +++ b/dlls/nsiproxy.sys/tcp.c @@ -534,6 +534,7 @@ static NTSTATUS tcp_conns_enumerate_all( UINT filter, struct nsi_tcp_conn_key *k FILE *fp; char buf[512], *ptr; int inode; + UINT laddr, raddr;
if (!(fp = fopen( "/proc/net/tcp", "r" ))) return ERROR_NOT_SUPPORTED;
@@ -547,15 +548,17 @@ static NTSTATUS tcp_conns_enumerate_all( UINT filter, struct nsi_tcp_conn_key *k while ((ptr = fgets( buf, sizeof(buf), fp ))) { if (sscanf( ptr, "%*x: %x:%hx %x:%hx %x %*s %*s %*s %*s %*s %d", - &key.local.Ipv4.sin_addr.WS_s_addr, &key.local.Ipv4.sin_port, - &key.remote.Ipv4.sin_addr.WS_s_addr, &key.remote.Ipv4.sin_port, + &laddr, &key.local.Ipv4.sin_port, + &raddr, &key.remote.Ipv4.sin_port, &dyn.state, &inode ) != 6) continue; dyn.state = tcp_state_to_mib_state( dyn.state ); if (filter && filter != dyn.state ) continue;
key.local.Ipv4.sin_family = key.remote.Ipv4.sin_family = WS_AF_INET; + key.local.Ipv4.sin_addr.WS_s_addr = laddr; key.local.Ipv4.sin_port = htons( key.local.Ipv4.sin_port ); + key.remote.Ipv4.sin_addr.WS_s_addr = raddr; key.remote.Ipv4.sin_port = htons( key.remote.Ipv4.sin_port );
if (num < *count) diff --git a/dlls/nsiproxy.sys/udp.c b/dlls/nsiproxy.sys/udp.c index 0ba2f835e44..2248d74234b 100644 --- a/dlls/nsiproxy.sys/udp.c +++ b/dlls/nsiproxy.sys/udp.c @@ -223,6 +223,7 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, UINT key_size, void FILE *fp; char buf[512], *ptr; int inode; + UINT addr;
if (!(fp = fopen( "/proc/net/udp", "r" ))) return ERROR_NOT_SUPPORTED;
@@ -235,10 +236,11 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, UINT key_size, void while ((ptr = fgets( buf, sizeof(buf), fp ))) { if (sscanf( ptr, "%*u: %x:%hx %*s %*s %*s %*s %*s %*s %*s %d", - &key.local.Ipv4.sin_addr.WS_s_addr, &key.local.Ipv4.sin_port, &inode ) != 3) + &addr, &key.local.Ipv4.sin_port, &inode ) != 3) continue;
key.local.Ipv4.sin_family = WS_AF_INET; + key.local.Ipv4.sin_addr.WS_s_addr = addr; key.local.Ipv4.sin_port = htons( key.local.Ipv4.sin_port );
stat.pid = find_owning_pid( pid_map, pid_map_size, inode );