I'd wish to get something like this included to debian hping3 package
[ytti@sci ~/hping3-3.a2.ds2/debian/patches]% cat 170_unidirectional_latency.diff
Added support for printing unidirectional latencies
[ytti@sci ~/hping3-3.a2.ds2]% ./hping3 -1 --icmp-ts ns.anylayer.com
HPING ns.anylayer.com (eth0 194.150.168.86): icmp mode set, 28 headers + 0 data bytes
len=46 ip=194.150.168.86 ttl=56 id=997 icmp_seq=0 rtt=38.8 ms
ICMP timestamp: Originate=35412743 Receive=35412758 Transmit=35412758
ICMP timestamp RTT tsrtt=39 src->dst=15 dst->src=24
len=46 ip=194.150.168.86 ttl=56 id=998 icmp_seq=1 rtt=38.6 ms
ICMP timestamp: Originate=35413743 Receive=35413758 Transmit=35413758
ICMP timestamp RTT tsrtt=38 src->dst=15 dst->src=23
--- a/waitpacket.c
+++ b/waitpacket.c
@@ -185,15 +185,17 @@
void log_icmp_ts(void *ts)
{
struct icmp_tstamp_data icmp_tstamp;
+ long unsigned int timestamp = get_midnight_ut_ms();
memcpy(&icmp_tstamp, ts, sizeof(icmp_tstamp));
printf("ICMP timestamp: Originate=%u Receive=%u Transmit=%u\n",
(unsigned int) ntohl(icmp_tstamp.orig),
(unsigned int) ntohl(icmp_tstamp.recv),
(unsigned int) ntohl(icmp_tstamp.tran));
- printf("ICMP timestamp RTT tsrtt=%lu\n\n",
- (long unsigned int) (get_midnight_ut_ms()
- - ntohl(icmp_tstamp.orig)));
+ printf("ICMP timestamp RTT tsrtt=%lu src->dst=%lu dst->src=%lu\n\n",
+ (long unsigned int) (timestamp - ntohl(icmp_tstamp.orig)),
+ (long unsigned int) (ntohl(icmp_tstamp.recv) - ntohl(icmp_tstamp.orig)),
+ (long unsigned int) (timestamp - ntohl(icmp_tstamp.tran)));
}
void log_icmp_addr(void *addrptr)
[ytti@sci ~/hping3-3.a2.ds2/debian/patches]%