Changeset 15287 in vbox for trunk/src/VBox/Devices/Network/slirp
- Timestamp:
- Dec 11, 2008 7:31:54 AM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/debug.c
r15245 r15287 15 15 #endif 16 16 17 #define IP4_ADDR_PRINTF_DECOMP(ip) ((ip) >> 24), ((ip) >> 16) & 0xff, ((ip) >> 8) & 0xff, (ip) & 0xff 18 #define IP4_ADDR_PRINTF_FORMAT "%u.%u.%u.%u" 17 19 /* 18 20 * Dump a packet in the same format as tcpdump -x … … 229 231 230 232 ip = ntohl(*(uint32_t*)pvValue); 231 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%u.%u.%u.%u",232 (ip >> 24), (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff);233 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, IP4_ADDR_PRINTF_FORMAT, 234 IP4_ADDR_PRINTF_DECOMP(ip)); 233 235 } 234 236 … … 241 243 struct socket *so = (struct socket*)pvValue; 242 244 uint32_t ip; 245 struct sockaddr addr; 246 socklen_t socklen = sizeof(struct sockaddr); 247 int status = 0; 243 248 244 249 AssertReturn(strcmp(pszType, "natsock") == 0, 0); 245 250 251 status = getsockname(so->s, &addr, &socklen); 252 253 Assert(status == 0 && addr.sa_family == AF_INET); 254 246 255 ip = ntohl(so->so_faddr.s_addr); 247 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "socket %4d: state=%04x ip=%u.%u.%u.%u", 248 so->s, so->so_state, (ip >> 24), (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff); 256 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "socket %4d:(proto:%u) " 257 "state=%04x ip=" IP4_ADDR_PRINTF_FORMAT ":%d name=" IP4_ADDR_PRINTF_FORMAT ":%d", 258 so->s, so->so_type, so->so_state, IP4_ADDR_PRINTF_DECOMP(ip), so->so_fport, 259 IP4_ADDR_PRINTF_DECOMP(((struct sockaddr_in *)&addr)->sin_addr.s_addr), 260 ((struct sockaddr_in *)&addr)->sin_port); 249 261 } 250 262 … … 295 307 #endif 296 308 297 int 298 debug_init() 309 int 310 debug_init() 299 311 { 300 312 int rc = VINF_SUCCESS; -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r15286 r15287 106 106 #define CHECK_FD_SET(so, events, set) \ 107 107 (DO_CHECK_FD_SET((so), (events), set)) 108 109 /* 110 * Loging macros 111 */ 112 #if VBOX_WITH_DEBUG_NAT_SOCKETS 113 # if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 114 # define DO_LOG_NAT_SOCK(so, proto, winevent, r_fdset, w_fdset, x_fdset) \ 115 do { \ 116 LogRel((" " #proto "%R[natsock] %R[natwinnetevents]\n", (so), (winevent))); \ 117 } while (0) 118 # else 119 # define DO_LOG_NAT_SOCK(so, proto, winevent, r_fdset, w_fdset, x_fdset) \ 120 do { \ 121 LogRel((" " #proto " %R[natsock] %s %s %s\n", (so), FD_ISSET((so)->s, (r_fdset))?"READ":"",\ 122 FD_ISSET((so)->s, (w_fdset))?"WRITE":"", FD_ISSET((so)->s, (x_fdset))?"OOB":"")); \ 123 } while (0) 124 # endif /* VBOX_WITH_DEBUG_NAT_SOCKETS */ 125 #else 126 # define DO_LOG_NAT_SOCK(so, proto, winevent, r_fdset, w_fdset, x_fdset) do {} while (0) 127 #endif /* !VBOX_WITH_DEBUG_NAT_SOCKETS */ 128 129 #define LOG_NAT_SOCK(so, proto, winevent, r_fdset, w_fdset, x_fdset) DO_LOG_NAT_SOCK((so), proto, (winevent), (r_fdset), (w_fdset), (x_fdset)) 108 130 109 131 static const uint8_t special_ethaddr[6] = … … 730 752 731 753 POLL_TCP_EVENTS(rc, error, so, &NetworkEvents); 732 #if 0 733 # if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS) 734 LogRel((" %R[natsock] %R[natwinnetevents]\n", so, &NetworkEvents)); 735 # else 736 LogRel((" %R[natsock] %s %s %s\n", so, FD_ISSET(so->s, readfds)?"READ":"", 737 FD_ISSET(so->s, writefds)?"WRITE":"", FD_ISSET(so->s, xfds)?"OOB":"")); 738 # endif 739 #endif 754 755 LOG_NAT_SOCK(so, TCP, &NetworkEvents, readfds, writefds, xfds); 740 756 741 757 /* … … 906 922 POLL_UDP_EVENTS(rc, error, so, &NetworkEvents); 907 923 924 LOG_NAT_SOCK(so, UDP, &NetworkEvents, readfds, writefds, xfds); 925 908 926 if (so->s != -1 && CHECK_FD_SET(so, NetworkEvents, readfds)) 909 927 {
Note:
See TracChangeset
for help on using the changeset viewer.