aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2020-11-25 16:47:00 +0000
committerNeale Ranns <nranns@cisco.com>2020-11-26 10:29:38 +0000
commit78ef61e4a081b8bad57f06d34d66ccb9f7d39848 (patch)
tree40d3a44c38be7ddfe3de1ece4f0adf3ee00941f4 /src
parent87866037c44be7dd7467981757d3206835901996 (diff)
ip: trace icmp echo request/reply id
Type: improvement Change-Id: Ie3a5b182e446c407f258c043c22d1cf25eb7ee59 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/ip/icmp4.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vnet/ip/icmp4.c b/src/vnet/ip/icmp4.c
index 48bcf67ac4e..05262e6f8e4 100644
--- a/src/vnet/ip/icmp4.c
+++ b/src/vnet/ip/icmp4.c
@@ -101,6 +101,12 @@ format_ip4_icmp_header (u8 * s, va_list * args)
format_ip4_icmp_type_and_code, icmp->type, icmp->code,
clib_net_to_host_u16 (icmp->checksum));
+ if ((ICMP4_echo_request == icmp->type || ICMP4_echo_reply == icmp->type)
+ && sizeof (icmp[0]) + sizeof (u16) < max_header_bytes)
+ {
+ s = format (s, " id %u", clib_net_to_host_u16 (*(u16 *) (icmp + 1)));
+ }
+
return s;
}