mirror of
https://git.openwrt.org/feed/packages.git
synced 2024-06-17 12:53:54 +02:00
688a5413d0
The new package would help measuring one-way delays using ICMP type 13 packets. This is important for various scripts that automatically adjust CAKE shaper bandwidth based on the observed bufferbloat. They need to understand whether the delay is on the way up or on the way down, so that they can adjust the bandwidth of the proper part of the shaper. https://forum.openwrt.org/t/cake-w-adaptive-bandwidth-historic/108848 https://forum.openwrt.org/t/cake-w-adaptive-bandwidth/135379 V2: refreshed patches Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
35 lines
1.0 KiB
Diff
35 lines
1.0 KiB
Diff
Subject: Add RTT handling for ICMP destination unreachable packets.
|
|
Author: Baruch Even <baruch@debian.org>
|
|
Bug-Debian: http://bugs.debian.org/248273
|
|
Last-Update: 2009-09-04
|
|
|
|
--- a/waitpacket.c
|
|
+++ b/waitpacket.c
|
|
@@ -229,6 +229,7 @@ int recv_icmp(void *packet, size_t size)
|
|
{
|
|
struct myicmphdr icmp;
|
|
struct myiphdr quoted_ip;
|
|
+ struct myudphdr quoted_udp;
|
|
|
|
/* Check if the packet can contain the ICMP header */
|
|
if (size < ICMPHDR_SIZE) {
|
|
@@ -286,6 +287,18 @@ int recv_icmp(void *packet, size_t size)
|
|
case 3:
|
|
if (!opt_quiet)
|
|
log_icmp_unreach(inet_ntoa(src), icmp.code);
|
|
+ if (quoted_ip.protocol == IPPROTO_UDP)
|
|
+ {
|
|
+ int sequence = 0, status;
|
|
+ float ms_delay = 0.0;
|
|
+ unsigned short port;
|
|
+
|
|
+ /* Get RTT for UDP packet */
|
|
+ memcpy("ed_udp, packet+ICMPHDR_SIZE+(quoted_ip.ihl<<2), sizeof(quoted_udp));
|
|
+ port = ntohs(quoted_udp.uh_sport);
|
|
+ status = rtt(&sequence, port, &ms_delay);
|
|
+ printf("status=%d port=%d seq=%d\n", status, port, sequence);
|
|
+ }
|
|
return 1;
|
|
case 11:
|
|
if (opt_traceroute)
|