- Timestamp:
- Nov 16, 2010 11:18:55 AM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 67804
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/cksum.c
r28800 r34103 154 154 #ifdef DEBUG 155 155 if (len) 156 { 157 DEBUG_ERROR((dfd, "cksum: out of data\n")); 158 DEBUG_ERROR((dfd, " len = %d\n", len)); 159 } 156 Log(("cksum: out of data: len = %d\n", len)); 160 157 #endif 161 158 if (mlen == -1) -
trunk/src/VBox/Devices/Network/slirp/debug.c
r30045 r34103 61 61 ipstats(PNATState pData) 62 62 { 63 lprint(" 63 lprint("\n"); 64 64 65 65 lprint("IP stats:\n"); … … 85 85 tcpstats(PNATState pData) 86 86 { 87 lprint(" 87 lprint("\n"); 88 88 89 89 lprint("TCP stats:\n"); … … 152 152 udpstats(PNATState pData) 153 153 { 154 lprint(" 154 lprint("\n"); 155 155 156 156 lprint("UDP stats:\n"); … … 166 166 icmpstats(PNATState pData) 167 167 { 168 lprint(" 168 lprint("\n"); 169 169 lprint("ICMP stats:\n"); 170 170 lprint(" %6d ICMP packets received\n", icmpstat.icps_received); … … 192 192 struct socket *so, *so_next; 193 193 194 lprint(" 194 lprint("\n"); 195 195 196 196 lprint( -
trunk/src/VBox/Devices/Network/slirp/debug.h
r28800 r34103 25 25 */ 26 26 27 #define PRN_STDERR 1 28 #define PRN_SPRINTF 2 29 30 /* Unused anyway, using VBox Log facility. */ 31 #define dfd NULL 32 33 #define DBG_CALL 0x1 34 #define DBG_MISC 0x2 35 #define DBG_ERROR 0x4 36 #define DEBUG_DEFAULT DBG_CALL|DBG_MISC|DBG_ERROR 27 #ifndef _DEBUG_H_ 28 #define _DEBUG_H_ 37 29 38 30 #include <VBox/log.h> 39 31 /* we've excluded stdio.h */ 40 # define FILE void 41 42 #ifdef LOG_ENABLED 43 #define DEBUG_CALL(x) LogFlow(("%s:\n", x)) 44 #define DEBUG_ARG(x, y) do { LogFlow((x, y)); LogFlow(("\n")); } while (0) 45 #define DEBUG_ARGS(x) __debug_flow x 46 #define DEBUG_MISC(x) __debug_log2 x 47 #define DEBUG_ERROR(x) __debug_log x 48 49 DECLINLINE(void) __debug_flow(FILE *pIgnore, const char *pszFormat, ...) 50 { 51 va_list args; 52 va_start(args, pszFormat); 53 LogFlow(("%Nv\n", pszFormat, &args)); 54 va_end(args); 55 } 56 57 DECLINLINE(void) __debug_log2(FILE *pIgnore, const char *pszFormat, ...) 58 { 59 va_list args; 60 va_start(args, pszFormat); 61 Log2(("%Nv\n", pszFormat, &args)); 62 va_end(args); 63 } 64 65 DECLINLINE(void) __debug_log(FILE *pIgnore, const char *pszFormat, ...) 66 { 67 va_list args; 68 va_start(args, pszFormat); 69 Log(("%Nv\n", pszFormat, &args)); 70 va_end(args); 71 } 72 73 #else /* !LOG_ENABLED */ 74 75 #define DEBUG_CALL(x) do {} while (0) 76 #define DEBUG_ARG(x, y) do {} while (0) 77 #define DEBUG_ARGS(x) do {} while (0) 78 #define DEBUG_MISC(x) do {} while (0) 79 #define DEBUG_ERROR(x) do {} while (0) 80 81 #endif /* !LOG_ENABLED */ 32 #define FILE void 82 33 83 34 int debug_init (void); … … 89 40 void sockstats (PNATState); 90 41 42 #endif -
trunk/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c
r30016 r34103 124 124 if (so1 == NULL) 125 125 { 126 LogRel(("NAT: can't create DNS socket 126 LogRel(("NAT: can't create DNS socket\n")); 127 127 return; 128 128 } … … 214 214 if ((byte = recvfrom(fd, buf, sizeof(buf), 0, 215 215 (struct sockaddr *)&fromaddr, &fromlen)) == -1) { 216 LogRel(("recvfrom failed: %s ", strerror(errno)));216 LogRel(("recvfrom failed: %s\n", strerror(errno))); 217 217 ++dropped_queries; 218 218 return; … … 234 234 /* check for minimum dns packet length */ 235 235 if (byte < 12) { 236 LogRel(("query too short from %s", 237 inet_ntoa(fromaddr.sin_addr))); 236 LogRel(("query too short from %s\n", inet_ntoa(fromaddr.sin_addr))); 238 237 ++dropped_queries; 239 238 return; … … 243 242 /* allocate new request */ 244 243 if ((req = calloc(1, sizeof(struct request))) == NULL) { 245 LogRel(("calloc : %s", strerror(errno)));244 LogRel(("calloc failed\n")); 246 245 ++dropped_queries; 247 246 return; … … 257 256 { 258 257 if ((req = RTMemAllocZ(sizeof(struct request) + byte)) == NULL) { 259 LogRel(("calloc : %s", strerror(errno)));258 LogRel(("calloc failed\n")); 260 259 ++dropped_queries; 261 260 return; … … 328 327 (struct sockaddr *)&recursive_addr, 329 328 sizeof(struct sockaddr_in))) == -1) { 330 LogRel(("sendto failed: %s ", strerror(errno)));329 LogRel(("sendto failed: %s\n", strerror(errno))); 331 330 ++dropped_queries; 332 331 return; … … 346 345 (struct sockaddr *)&authoritative_addr, 347 346 sizeof(struct sockaddr_in))) == -1) { 348 LogRel(("sendto failed: %s ", strerror(errno)));347 LogRel(("sendto failed: %s\n", strerror(errno))); 349 348 ++dropped_queries; 350 349 return; … … 363 362 (struct sockaddr *)&addr, 364 363 sizeof(struct sockaddr_in))) == -1) { 365 LogRel(("sendto failed: %s ", strerror(errno)));364 LogRel(("sendto failed: %s\n", strerror(errno))); 366 365 ++dropped_queries; 367 366 return; … … 403 402 /* read packet from socket */ 404 403 if ((byte = recvfrom(fd, buf, sizeof(buf), 0, NULL, NULL)) == -1) { 405 LogRel(("recvfrom failed: %s ", strerror(errno)));404 LogRel(("recvfrom failed: %s\n", strerror(errno))); 406 405 ++dropped_answers; 407 406 return; … … 417 416 /* check for minimum dns packet length */ 418 417 if (byte < 12) { 419 LogRel(("answer too short "));418 LogRel(("answer too short\n")); 420 419 ++dropped_answers; 421 420 return; … … 452 451 (struct sockaddr *)&query->client, 453 452 sizeof(struct sockaddr_in)) == -1) { 454 LogRel(("sendto failed: %s ", strerror(errno)));453 LogRel(("sendto failed: %s\n", strerror(errno))); 455 454 ++dropped_answers; 456 455 } else -
trunk/src/VBox/Devices/Network/slirp/ip_icmp.c
r33978 r34103 120 120 if (pData->pfGetAdaptersAddresses == NULL) 121 121 { 122 LogRel(("NAT: Can't find GetAdapterAddresses in Iphlpapi.dll "));122 LogRel(("NAT: Can't find GetAdapterAddresses in Iphlpapi.dll\n")); 123 123 } 124 124 } … … 335 335 /* int code; */ 336 336 337 DEBUG_CALL("icmp_input"); 338 DEBUG_ARG("m = %lx", (long )m); 339 DEBUG_ARG("m_len = %d", m ? m->m_len : 0); 337 LogFlow(("icmp_input: m = %lx, m_len = %d\n", (long)m, m ? m->m_len : 0)); 340 338 341 339 icmpstat.icps_received++; … … 381 379 /* code = icp->icmp_code; */ 382 380 383 DEBUG_ARG("icmp_type = %d", icp->icmp_type);381 LogFlow(("icmp_type = %d\n", icp->icmp_type)); 384 382 switch (icp->icmp_type) 385 383 { … … 442 440 if (!fIcmpSocketErrorReported) 443 441 { 444 LogRel(( dfd,"icmp_input udp sendto tx errno = %d-%s\n",442 LogRel(("icmp_input udp sendto tx errno = %d (%s)\n", 445 443 errno, strerror(errno))); 446 444 fIcmpSocketErrorReported = true; … … 552 550 int size = 0; 553 551 554 DEBUG_CALL("icmp_error"); 555 DEBUG_ARG("msrc = %lx", (long )msrc); 556 DEBUG_ARG("msrc_len = %d", msrc ? msrc->m_len : 0); 552 LogFlow(("icmp_error: msrc = %lx, msrc_len = %d\n", (long)msrc, msrc ? msrc->m_len : 0)); 557 553 if (msrc != NULL) 558 554 M_ASSERTPKTHDR(msrc); … … 573 569 strcpy(bufa, inet_ntoa(ip->ip_src)); 574 570 strcpy(bufb, inet_ntoa(ip->ip_dst)); 575 DEBUG_MISC((dfd," %.16s to %.16s\n", bufa, bufb));571 Log2((" %.16s to %.16s\n", bufa, bufb)); 576 572 } 577 573 #endif … … 626 622 /* make the header of the reply packet */ 627 623 ip = mtod(m, struct ip *); 628 hlen = sizeof(struct ip 624 hlen = sizeof(struct ip); /* no options in reply */ 629 625 630 626 /* fill in icmp */ … … 682 678 ip->ip_src = alias_addr; 683 679 684 (void 680 (void) ip_output0(pData, (struct socket *)NULL, m, 1); 685 681 686 682 icmpstat.icps_reflect++; … … 712 708 register struct ip *ip = mtod(m, struct ip *); 713 709 int hlen = ip->ip_hl << 2; 714 int optlen = hlen - sizeof(struct ip 710 int optlen = hlen - sizeof(struct ip); 715 711 register struct icmp *icp; 716 712 … … 729 725 m->m_len += hlen; 730 726 731 (void 727 (void) ip_output(pData, (struct socket *)NULL, m); 732 728 733 729 icmpstat.icps_reflect++; -
trunk/src/VBox/Devices/Network/slirp/ip_input.c
r34087 r34103 111 111 STAM_PROFILE_START(&pData->StatIP_input, a); 112 112 113 DEBUG_CALL("ip_input"); 114 DEBUG_ARG("m = %lx", (long)m); 113 LogFlow(("ip_input: m = %lx\n", (long)m)); 115 114 ip = mtod(m, struct ip *); 116 115 Log2(("ip_dst=%R[IP4](len:%d) m_len = %d\n", &ip->ip_dst, RT_N2H_U16(ip->ip_len), m->m_len)); … … 579 578 */ 580 579 int i; 581 DEBUG_CALL("ip_slowtimo");580 LogFlow(("ip_slowtimo:\n")); 582 581 for (i = 0; i < IPREASS_NHASH; i++) 583 582 { -
trunk/src/VBox/Devices/Network/slirp/ip_output.c
r34037 r34103 111 111 register struct ip *ip; 112 112 register struct mbuf *m = m0; 113 register int hlen = sizeof(struct ip 113 register int hlen = sizeof(struct ip); 114 114 int len, off, error = 0; 115 115 extern uint8_t zerro_ethaddr[ETH_ALEN]; … … 120 120 STAM_PROFILE_START(&pData->StatIP_output, a); 121 121 122 DEBUG_CALL("ip_output"); 123 DEBUG_ARG("so = %lx", (long)so); 124 DEBUG_ARG("m0 = %lx", (long)m0); 122 LogFlow(("ip_output: so = %lx, m0 = %lx\n", (long)so, (long)m0)); 125 123 126 124 M_ASSERTPKTHDR(m); -
trunk/src/VBox/Devices/Network/slirp/sbuf.c
r32431 r34103 114 114 115 115 STAM_PROFILE_START(&pData->StatIOSBAppend_pf, a); 116 DEBUG_CALL("sbappend"); 117 DEBUG_ARG("so = %lx", (long)so); 118 DEBUG_ARG("m = %lx", (long)m); 119 DEBUG_ARG("m->m_len = %d", m ? m->m_len : 0); 116 LogFlow(("sbappend: so = %lx, m = %lx, m->m_len = %d\n", (long)so, (long)m, m ? m->m_len : 0)); 120 117 121 118 STAM_COUNTER_INC(&pData->StatIOSBAppend); … … 287 284 288 285 STAM_PROFILE_START(&pData->StatIOSBAppend_pf, a); 289 DEBUG_CALL("sbappend"); 290 DEBUG_ARG("so = %lx", (long)so); 291 DEBUG_ARG("m = %lx", (long)m); 292 DEBUG_ARG("m->m_len = %d", m ? m->m_len : 0); 286 LogFlow(("sbappend: so = %lx, m = %lx, m->m_len = %d\n", (long)so, (long)m, m ? m->m_len : 0)); 293 287 294 288 STAM_COUNTER_INC(&pData->StatIOSBAppend); -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r34043 r34103 298 298 if (!pAdapterAddr) 299 299 { 300 Log(("NAT: No memory available 300 Log(("NAT: No memory available\n")); 301 301 return -1; 302 302 } … … 1196 1196 else 1197 1197 { 1198 Log2(("%R[natsock] errno %d :%s\n", so, errno, strerror(errno)));1198 Log2(("%R[natsock] errno %d (%s)\n", so, errno, strerror(errno))); 1199 1199 break; 1200 1200 } … … 1570 1570 if (m->m_next) 1571 1571 { 1572 Log(("NAT: if_encap's recived the chain, dropping... "));1572 Log(("NAT: if_encap's recived the chain, dropping...\n")); 1573 1573 m_freem(pData, m); 1574 1574 goto done; … … 1864 1864 void slirp_set_dhcp_TFTP_prefix(PNATState pData, const char *tftpPrefix) 1865 1865 { 1866 Log2(("tftp_prefix: %s\n", tftpPrefix));1866 Log2(("tftp_prefix: %s\n", tftpPrefix)); 1867 1867 tftp_prefix = tftpPrefix; 1868 1868 } … … 1870 1870 void slirp_set_dhcp_TFTP_bootfile(PNATState pData, const char *bootFile) 1871 1871 { 1872 Log2(("bootFile: %s\n", bootFile));1872 Log2(("bootFile: %s\n", bootFile)); 1873 1873 bootp_filename = bootFile; 1874 1874 } … … 1876 1876 void slirp_set_dhcp_next_server(PNATState pData, const char *next_server) 1877 1877 { 1878 Log2(("next_server: %s\n", next_server));1878 Log2(("next_server: %s\n", next_server)); 1879 1879 if (next_server == NULL) 1880 1880 pData->tftp_server.s_addr = RT_H2N_U32(RT_N2H_U32(pData->special_addr.s_addr) | CTL_TFTP); -
trunk/src/VBox/Devices/Network/slirp/slirp.h
r34036 r34103 389 389 390 390 # define ip_next(ip) (void *)((uint8_t *)(ip) + ((ip)->ip_hl << 2)) 391 # define udp_next(udp) (void *)((uint8_t *)&((struct udphdr *)(udp))[1] 391 # define udp_next(udp) (void *)((uint8_t *)&((struct udphdr *)(udp))[1]) 392 392 # define bcopy(src, dst, len) memcpy((dst), (src), (len)) 393 393 # define bcmp(a1, a2, len) memcmp((a1), (a2), (len)) -
trunk/src/VBox/Devices/Network/slirp/socket.c
r34042 r34103 152 152 QSOCKET_UNLOCK(tcb); 153 153 154 DEBUG_CALL("soread"); 155 DEBUG_ARG("so = %lx", (long)so); 154 LogFlow(("soread: so = %lx\n", (long)so)); 156 155 157 156 /* … … 217 216 #ifdef HAVE_READV 218 217 nn = readv(so->s, (struct iovec *)iov, n); 219 DEBUG_MISC((dfd," ... read nn = %d bytes\n", nn));218 Log2((" ... read nn = %d bytes\n", nn)); 220 219 #else 221 220 nn = recv(so->s, iov[0].iov_base, iov[0].iov_len, (so->so_tcpcb->t_force? MSG_OOB:0)); … … 253 252 { 254 253 /* nn == 0 means peer has performed an orderly shutdown */ 255 DEBUG_MISC((dfd, " --- soread() disconnected, nn = %d, errno = %d-%s\n",256 254 Log2((" --- soread() disconnected, nn = %d, errno = %d (%s)\n", 255 nn, errno, strerror(errno))); 257 256 sofcantrcvmore(so); 258 257 tcp_sockclosed(pData, sototcpcb(so)); … … 300 299 } 301 300 302 DEBUG_MISC((dfd," ... read nn = %d bytes\n", nn));301 Log2((" ... read nn = %d bytes\n", nn)); 303 302 #endif 304 303 … … 330 329 QSOCKET_UNLOCK(tcb); 331 330 332 DEBUG_CALL("soread"); 333 DEBUG_ARG("so = %lx", (long)so); 331 LogFlow(("soread: so = %lx\n", (long)so)); 334 332 335 333 if (len > mss) … … 376 374 else 377 375 { 378 DEBUG_MISC((dfd, " --- soread() disconnected, n = %d, errno = %d-%s\n",379 376 Log2((" --- soread() disconnected, n = %d, errno = %d (%s)\n", 377 n, errno, strerror(errno))); 380 378 sofcantrcvmore(so); 381 379 tcp_sockclosed(pData, sototcpcb(so)); … … 406 404 ssize_t ret; 407 405 408 DEBUG_CALL("sorecvoob"); 409 DEBUG_ARG("so = %lx", (long)so); 406 LogFlow(("sorecvoob: so = %lx\n", (long)so)); 410 407 411 408 /* … … 436 433 int n, len; 437 434 438 DEBUG_CALL("sosendoob"); 439 DEBUG_ARG("so = %lx", (long)so); 435 LogFlow(("sosendoob so = %lx\n", (long)so)); 440 436 441 437 if (so->so_urgc > sizeof(buff)) … … 448 444 so->so_urgc -= n; 449 445 450 DEBUG_MISC((dfd," --- sent %d bytes urgent data, %d urgent bytes left\n",451 446 Log2((" --- sent %d bytes urgent data, %d urgent bytes left\n", 447 n, so->so_urgc)); 452 448 } 453 449 else … … 475 471 #ifdef DEBUG 476 472 if (n != len) 477 DEBUG_ERROR((dfd,"Didn't send all data urgently XXXXX\n"));478 #endif 479 DEBUG_MISC((dfd," ---2 sent %d bytes urgent data, %d urgent bytes left\n",480 473 Log(("Didn't send all data urgently XXXXX\n")); 474 #endif 475 Log2((" ---2 sent %d bytes urgent data, %d urgent bytes left\n", 476 n, so->so_urgc)); 481 477 } 482 478 … … 510 506 STAM_COUNTER_RESET(&pData->StatIOWrite_rest); 511 507 STAM_COUNTER_RESET(&pData->StatIOWrite_rest_bytes); 512 DEBUG_CALL("sowrite"); 513 DEBUG_ARG("so = %lx", (long)so); 508 LogFlow(("sowrite: so = %lx\n", (long)so)); 514 509 QSOCKET_LOCK(tcb); 515 510 SOCKET_LOCK(so); … … 577 572 #ifdef HAVE_READV 578 573 nn = writev(so->s, (const struct iovec *)iov, n); 579 DEBUG_MISC((dfd," ... wrote nn = %d bytes\n", nn));574 Log2((" ... wrote nn = %d bytes\n", nn)); 580 575 #else 581 576 nn = send(so->s, iov[0].iov_base, iov[0].iov_len, 0); … … 594 589 if (nn < 0 || (nn == 0 && iov[0].iov_len > 0)) 595 590 { 596 DEBUG_MISC((dfd," --- sowrite disconnected, so->so_state = %x, errno = %d\n",597 591 Log2((" --- sowrite disconnected, so->so_state = %x, errno = %d\n", 592 so->so_state, errno)); 598 593 sofcantsendmore(so); 599 594 tcp_sockclosed(pData, sototcpcb(so)); … … 618 613 }); 619 614 } 620 DEBUG_MISC((dfd," ... wrote nn = %d bytes\n", nn));615 Log2((" ... wrote nn = %d bytes\n", nn)); 621 616 #endif 622 617 … … 646 641 int n, len; 647 642 648 DEBUG_CALL("sosendoob"); 649 DEBUG_ARG("so = %lx", (long)so); 643 LogFlow(("sosendoob: so = %lx\n", (long)so)); 650 644 651 645 len = sbuf_len(sb); … … 702 696 socklen_t addrlen = sizeof(struct sockaddr_in); 703 697 704 DEBUG_CALL("sorecvfrom"); 705 DEBUG_ARG("so = %lx", (long)so); 698 LogFlow(("sorecvfrom: so = %lx\n", (long)so)); 706 699 707 700 if (so->so_type == IPPROTO_ICMP) … … 793 786 */ 794 787 if(ret < slirp_size(pData) && !m->m_next) 795 Log(("NAT:udp: Expected size(%d) lesser than real(%d) and less minimal mbuf size(%d) 788 Log(("NAT:udp: Expected size(%d) lesser than real(%d) and less minimal mbuf size(%d)\n", 796 789 n, ret, slirp_size(pData))); 797 790 } … … 880 873 int mlen; 881 874 882 DEBUG_CALL("sosendto"); 883 DEBUG_ARG("so = %lx", (long)so); 884 DEBUG_ARG("m = %lx", (long)m); 875 LogFlow(("sosendto: so = %lx, m = %lx\n", (long)so, (long)m)); 885 876 886 877 memset(&addr, 0, sizeof(struct sockaddr)); … … 926 917 paddr->sin_port = so->so_fport; 927 918 928 DEBUG_MISC((dfd," sendto()ing, addr.sin_port=%d, addr.sin_addr.s_addr=%.16s\n",929 919 Log2((" sendto()ing, addr.sin_port=%d, addr.sin_addr.s_addr=%.16s\n", 920 RT_N2H_U16(paddr->sin_port), inet_ntoa(paddr->sin_addr))); 930 921 931 922 /* Don't care what port we get */ … … 968 959 int status; 969 960 970 DEBUG_CALL("solisten"); 971 DEBUG_ARG("port = %d", port); 972 DEBUG_ARG("laddr = %x", laddr); 973 DEBUG_ARG("lport = %d", lport); 974 DEBUG_ARG("flags = %x", flags); 961 LogFlow(("solisten: port = %d, laddr = %x, lport = %d, flags = %x\n", port, laddr, lport, flags)); 975 962 976 963 if ((so = socreate()) == NULL) … … 1490 1477 code = ICMP_UNREACH_NET; 1491 1478 1492 LogRel((" udp icmp rx errno = %d-%s\n", 1493 errno, strerror(errno))); 1479 LogRel((" udp icmp rx errno = %d (%s)\n", errno, strerror(errno))); 1494 1480 icmp_error(pData, so->so_m, ICMP_UNREACH, code, 0, strerror(errno)); 1495 1481 m_freem(pData, so->so_m); 1496 1482 so->so_m = NULL; 1497 Log(("sorecvfrom_icmp_unix: 1 - step can't read IP datagramm 1483 Log(("sorecvfrom_icmp_unix: 1 - step can't read IP datagramm\n")); 1498 1484 return; 1499 1485 } … … 1505 1491 ) 1506 1492 { 1507 Log(("sorecvfrom_icmp_unix: 1 - step IP isn't IPv4 1493 Log(("sorecvfrom_icmp_unix: 1 - step IP isn't IPv4\n")); 1508 1494 return; 1509 1495 } -
trunk/src/VBox/Devices/Network/slirp/tcp_input.c
r30355 r34103 296 296 STAM_PROFILE_START(&pData->StatTCP_input, counter_input); 297 297 298 DEBUG_CALL("tcp_input"); 299 DEBUG_ARGS((dfd," m = %8lx iphlen = %2d inso = %lx\n", 300 (long )m, iphlen, (long )inso )); 298 LogFlow(("tcp_input: m = %8lx, iphlen = %2d, inso = %lx\n", 299 (long)m, iphlen, (long)inso)); 301 300 302 301 if (inso != NULL) … … 342 341 */ 343 342 ti = mtod(m, struct tcpiphdr *); 344 if (iphlen > sizeof(struct ip 343 if (iphlen > sizeof(struct ip)) 345 344 { 346 345 ip_stripoptions(m, (struct mbuf *)0); 347 iphlen = sizeof(struct ip 346 iphlen = sizeof(struct ip); 348 347 } 349 348 /* XXX Check if too short */ … … 369 368 memset(ti->ti_x1, 0, 9); 370 369 ti->ti_len = RT_H2N_U16((u_int16_t)tlen); 371 len = sizeof(struct ip 370 len = sizeof(struct ip) + tlen; 372 371 /* keep checksum for ICMP reply 373 372 * ti->ti_sum = cksum(m, len); … … 772 771 { 773 772 u_char code = ICMP_UNREACH_NET; 774 DEBUG_MISC((dfd," tcp fconnect errno = %d-%s\n", 775 errno, strerror(errno))); 773 Log2((" tcp fconnect errno = %d (%s)\n", errno, strerror(errno))); 776 774 if (errno == ECONNREFUSED) 777 775 { … … 927 925 tp->snd_wl1 = ti->ti_seq - 1; 928 926 tp->rcv_up = ti->ti_seq; 929 Log2(("hit6 "));927 Log2(("hit6\n")); 930 928 goto step6; 931 929 } /* switch tp->t_state */ … … 1212 1210 { 1213 1211 tcpstat.tcps_rcvdupack++; 1214 DEBUG_MISC((dfd," dup ack m = %lx so = %lx \n", 1215 (long )m, (long )so)); 1212 Log2((" dup ack m = %lx, so = %lx\n", (long)m, (long)so)); 1216 1213 /* 1217 1214 * If we have outstanding data (other than … … 1337 1334 tp->snd_wnd -= SBUF_LEN(&so->so_snd); 1338 1335 #ifndef VBOX_WITH_SLIRP_BSD_SBUF 1339 sbdrop(&so->so_snd, (int 1336 sbdrop(&so->so_snd, (int)so->so_snd.sb_cc); 1340 1337 #else 1341 1338 sbuf_clear(&so->so_snd); … … 1695 1692 int opt, optlen; 1696 1693 1697 DEBUG_CALL("tcp_dooptions"); 1698 DEBUG_ARGS((dfd," tp = %lx cnt=%i \n", (long )tp, cnt)); 1694 LogFlow(("tcp_dooptions: tp = %lx, cnt=%i\n", (long)tp, cnt)); 1699 1695 1700 1696 for (; cnt > 0; cnt -= optlen, cp += optlen) … … 1807 1803 register short delta; 1808 1804 1809 DEBUG_CALL("tcp_xmit_timer"); 1810 DEBUG_ARG("tp = %lx", (long)tp); 1811 DEBUG_ARG("rtt = %d", rtt); 1805 LogFlow(("tcp_xmit_timer: tp = %lx rtt = %d\n", (long)tp, rtt)); 1812 1806 1813 1807 tcpstat.tcps_rttupdated++; … … 1899 1893 int mss; 1900 1894 1901 DEBUG_CALL("tcp_mss"); 1902 DEBUG_ARG("tp = %lx", (long)tp); 1903 DEBUG_ARG("offer = %d", offer); 1895 LogFlow(("tcp_mss: tp = %lx, offet = %d\n", (long)tp, offer)); 1904 1896 1905 1897 mss = min(if_mtu, if_mru) - sizeof(struct tcpiphdr); … … 1920 1912 #endif 1921 1913 1922 DEBUG_MISC((dfd," returning mss = %d\n", mss));1914 Log2((" returning mss = %d\n", mss)); 1923 1915 1924 1916 return mss; -
trunk/src/VBox/Devices/Network/slirp/tcp_output.c
r30045 r34103 102 102 int size; 103 103 104 DEBUG_CALL("tcp_output"); 105 DEBUG_ARG("tp = %lx", (long )tp); 104 LogFlow(("tcp_output: tp = %lx\n", (long)tp)); 106 105 107 106 /* … … 127 126 flags = tcp_outflags[tp->t_state]; 128 127 129 DEBUG_MISC((dfd, " --- tcp_output flags = 0x%x\n",flags));128 Log2((" --- tcp_output flags = 0x%x\n", flags)); 130 129 131 130 /* -
trunk/src/VBox/Devices/Network/slirp/tcp_subr.c
r30045 r34103 129 129 int win = 0; 130 130 131 DEBUG_CALL("tcp_respond"); 132 DEBUG_ARG("tp = %lx", (long)tp); 133 DEBUG_ARG("ti = %lx", (long)ti); 134 DEBUG_ARG("m = %lx", (long)m); 135 DEBUG_ARG("ack = %u", ack); 136 DEBUG_ARG("seq = %u", seq); 137 DEBUG_ARG("flags = %x", flags); 131 LogFlow(("tcp_respond: tp = %lx, ti = %lx, m = %lx, ack = %u, seq = %u, flags = %x\n", 132 (long)tp, (long)ti, (long)m, ack, seq, flags)); 138 133 139 134 if (tp) … … 249 244 { 250 245 */ 251 DEBUG_CALL("tcp_drop"); 252 DEBUG_ARG("tp = %lx", (long)tp); 253 DEBUG_ARG("errno = %d", errno); 246 LogFlow(("tcp_drop: tp = %lx, errno = %d\n", (long)tp, errno)); 254 247 255 248 if (TCPS_HAVERCVDSYN(tp->t_state)) … … 283 276 284 277 struct tseg_qent *te = NULL; 285 DEBUG_CALL("tcp_close"); 286 DEBUG_ARG("tp = %lx", (long )tp); 278 LogFlow(("tcp_close: tp = %lx\n", (long)tp)); 287 279 so_next = so_prev = NULL; 288 280 /*XXX: freeing the reassembly queue */ … … 361 353 tcp_sockclosed(PNATState pData, struct tcpcb *tp) 362 354 { 363 DEBUG_CALL("tcp_sockclosed"); 364 DEBUG_ARG("tp = %lx", (long)tp); 355 LogFlow(("tcp_sockclosed: tp = %lx\n", (long)tp)); 365 356 366 357 switch (tp->t_state) … … 412 403 int ret = 0; 413 404 414 DEBUG_CALL("tcp_fconnect"); 415 DEBUG_ARG("so = %lx", (long )so); 405 LogFlow(("tcp_fconnect: so = %lx\n", (long)so)); 416 406 417 407 if ((ret = so->s = socket(AF_INET, SOCK_STREAM, 0)) >= 0) … … 443 433 addr.sin_port = so->so_fport; 444 434 445 DEBUG_MISC((dfd, " connect()ing, addr.sin_port=%d, " 446 "addr.sin_addr.s_addr=%.16s\n", 447 RT_N2H_U16(addr.sin_port), inet_ntoa(addr.sin_addr))); 435 Log2((" connect()ing, addr.sin_port=%d, addr.sin_addr.s_addr=%.16s\n", 436 RT_N2H_U16(addr.sin_port), inet_ntoa(addr.sin_addr))); 448 437 /* We don't care what port we get */ 449 438 ret = connect(s,(struct sockaddr *)&addr,sizeof (addr)); … … 483 472 static int cVerbose = 1; 484 473 485 DEBUG_CALL("tcp_connect"); 486 DEBUG_ARG("inso = %lx", (long)inso); 474 LogFlow(("tcp_connect: inso = %lx\n", (long)inso)); 487 475 488 476 /* -
trunk/src/VBox/Devices/Network/slirp/tcp_timer.c
r28800 r34103 66 66 register struct tcpcb *tp; 67 67 68 DEBUG_CALL("tcp_fasttimo");68 LogFlow(("tcp_fasttimo:\n")); 69 69 70 70 so = tcb.so_next; … … 96 96 register int i; 97 97 98 DEBUG_CALL("tcp_slowtimo");98 LogFlow(("tcp_slowtimo:\n")); 99 99 100 100 /* … … 159 159 register int rexmt; 160 160 161 DEBUG_CALL("tcp_timers");161 LogFlow(("tcp_timers:\n")); 162 162 163 163 switch (timer) -
trunk/src/VBox/Devices/Network/slirp/udp.c
r34034 r34103 95 95 int ttl; 96 96 97 DEBUG_CALL("udp_input"); 98 DEBUG_ARG("m = %lx", (long)m); 97 LogFlow(("udp_input: m = %lx, iphlen = %d\n", (long)m, iphlen)); 99 98 ip = mtod(m, struct ip *); 100 DEBUG_ARG("iphlen = %d", iphlen);101 99 Log2(("%R[IP4] iphlen = %d\n", &ip->ip_dst, iphlen)); 102 100 … … 247 245 if (udp_attach(pData, so, 0) == -1) 248 246 { 249 Log2(("NAT: IP(id: %hd) udp_attach errno = %d -%s\n",247 Log2(("NAT: IP(id: %hd) udp_attach errno = %d (%s)\n", 250 248 ip->ip_id, errno, strerror(errno))); 251 249 sofree(pData, so); … … 297 295 m->m_data -= iphlen; 298 296 *ip = save_ip; 299 DEBUG_MISC((dfd,"NAT: UDP tx errno = %d-%s (on sent to %R[IP4])\n", errno,300 297 Log2(("NAT: UDP tx errno = %d (%s) on sent to %R[IP4]\n", 298 errno, strerror(errno), &ip->ip_dst)); 301 299 icmp_error(pData, m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno)); 302 300 /* in case we receive ICMP on this socket we'll aware that ICMP has been already sent to host*/ … … 340 338 int mlen = 0; 341 339 342 DEBUG_CALL("udp_output"); 343 DEBUG_ARG("so = %lx", (long)so); 344 DEBUG_ARG("m = %lx", (long)m); 345 DEBUG_ARG("saddr = %lx", (long)saddr->sin_addr.s_addr); 346 DEBUG_ARG("daddr = %lx", (long)daddr->sin_addr.s_addr); 340 LogFlow(("udp_output: so = %lx, m = %lx, saddr = %lx, daddr = %lx\n", 341 (long)so, (long)m, (long)saddr->sin_addr.s_addr, (long)daddr->sin_addr.s_addr)); 347 342 348 343 /*
Note:
See TracChangeset
for help on using the changeset viewer.