You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.0 KiB

  1. Subject: Add RTT handling for ICMP destination unreachable packets.
  2. Author: Baruch Even <baruch@debian.org>
  3. Bug-Debian: http://bugs.debian.org/248273
  4. Last-Update: 2009-09-04
  5. --- a/waitpacket.c
  6. +++ b/waitpacket.c
  7. @@ -229,6 +229,7 @@ int recv_icmp(void *packet, size_t size)
  8. {
  9. struct myicmphdr icmp;
  10. struct myiphdr quoted_ip;
  11. + struct myudphdr quoted_udp;
  12. /* Check if the packet can contain the ICMP header */
  13. if (size < ICMPHDR_SIZE) {
  14. @@ -286,6 +287,18 @@ int recv_icmp(void *packet, size_t size)
  15. case 3:
  16. if (!opt_quiet)
  17. log_icmp_unreach(inet_ntoa(src), icmp.code);
  18. + if (quoted_ip.protocol == IPPROTO_UDP)
  19. + {
  20. + int sequence = 0, status;
  21. + float ms_delay = 0.0;
  22. + unsigned short port;
  23. +
  24. + /* Get RTT for UDP packet */
  25. + memcpy(&quoted_udp, packet+ICMPHDR_SIZE+(quoted_ip.ihl<<2), sizeof(quoted_udp));
  26. + port = ntohs(quoted_udp.uh_sport);
  27. + status = rtt(&sequence, port, &ms_delay);
  28. + printf("status=%d port=%d seq=%d\n", status, port, sequence);
  29. + }
  30. return 1;
  31. case 11:
  32. if (opt_traceroute)