From: Francois-Xavier Le Bail Date: Thu, 10 Sep 2020 13:49:09 +0000 (+0200) Subject: RT6: Update some printings for coherency X-Git-Tag: tcpdump-4.99-bp~235 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/8a776c2410fb4ff349d982fcf187924351c4b9b0 RT6: Update some printings for coherency s/srcrt/RT6/ In upper case (like 'IP6'), via a nd_print_protocol_caps() call. Before: srcrt (len=48, type=0, segleft=48 [|rt6] After: RT6 (len=48, type=0, segleft=48 [|rt6] rt6 choosen because it's in file name (print-rt6.c), function name (rt6_print) and set in ndo->ndo_protocol ("rt6"). Moreover: Print the protocol name even if the packet is truncated at the beginning. Use nd_print_trunc(). --- diff --git a/print-rt6.c b/print-rt6.c index 980d675f..a83ea379 100644 --- a/print-rt6.c +++ b/print-rt6.c @@ -45,12 +45,14 @@ rt6_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2 _U_) const u_char *p; ndo->ndo_protocol = "rt6"; + + nd_print_protocol_caps(ndo); dp = (const struct ip6_rthdr *)bp; ND_TCHECK_1(dp->ip6r_segleft); len = GET_U_1(dp->ip6r_len); - ND_PRINT("srcrt (len=%u", len); /*)*/ + ND_PRINT(" (len=%u", len); /*)*/ type = GET_U_1(dp->ip6r_type); ND_PRINT(", type=%u", type); ND_PRINT(", segleft=%u", GET_U_1(dp->ip6r_segleft)); @@ -106,6 +108,6 @@ rt6_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2 _U_) } trunc: - ND_PRINT("[|srcrt]"); + nd_print_trunc(ndo); return -1; } diff --git a/tests/hoobr_rt6_print.out b/tests/hoobr_rt6_print.out index 4a62bba2..e0e2a6e1 100644 --- a/tests/hoobr_rt6_print.out +++ b/tests/hoobr_rt6_print.out @@ -1,3 +1,3 @@ 1 05:27:12.808464432 unknown ip 3 2 05:27:12.808464432 unknown ip 3 - 3 05:27:12.808464432 IP6 3030:3030:3030:3030:3030:3030:3030:3030 > 3030:3030:3030:3030:3030:3030:3030:3030: [|srcrt] + 3 05:27:12.808464432 IP6 3030:3030:3030:3030:3030:3030:3030:3030 > 3030:3030:3030:3030:3030:3030:3030:3030: RT6 [|rt6] diff --git a/tests/ipv6-routing-header.out b/tests/ipv6-routing-header.out index dc57aef5..d9b26a97 100644 --- a/tests/ipv6-routing-header.out +++ b/tests/ipv6-routing-header.out @@ -1,4 +1,4 @@ - 1 16:51:31.766766 IP6 (hlim 4, next-header Routing (43) payload length: 32) 2200::244:212:3fff:feae:22f7 > 2200::240:2:0:0:4: srcrt (len=2, type=0, segleft=1, rsv=0x0, [0]2200::210:2:0:0:4) [icmp6 sum ok] ICMP6, echo request, id 0, seq 0 - 2 16:51:32.803243 IP6 (hlim 5, next-header Routing (43) payload length: 48) 2200::244:212:3fff:feae:22f7 > 2200::211:2:0:0:2: srcrt (len=4, type=0, segleft=2, rsv=0x0, [0]2200::210:2:0:0:4, [1]2200::240:2:0:0:4) [icmp6 sum ok] ICMP6, echo request, id 0, seq 0 - 3 16:51:33.575585 IP6 (hlim 4, next-header Routing (43) payload length: 32) 2200::244:212:3fff:feae:22f7 > 2200::240:2:0:0:4: srcrt (len=2, type=0, segleft=1, rsv=0x0, [0]2200::210:2:0:0:4) 5645 > 5642: [udp sum ok] UDP, length 0 - 4 16:51:34.608086 IP6 (hlim 5, next-header Routing (43) payload length: 48) 2200::244:212:3fff:feae:22f7 > 2200::211:2:0:0:2: srcrt (len=4, type=0, segleft=2, rsv=0x0, [0]2200::210:2:0:0:4, [1]2200::240:2:0:0:4) 5645 > 5642: [udp sum ok] UDP, length 0 + 1 16:51:31.766766 IP6 (hlim 4, next-header Routing (43) payload length: 32) 2200::244:212:3fff:feae:22f7 > 2200::240:2:0:0:4: RT6 (len=2, type=0, segleft=1, rsv=0x0, [0]2200::210:2:0:0:4) [icmp6 sum ok] ICMP6, echo request, id 0, seq 0 + 2 16:51:32.803243 IP6 (hlim 5, next-header Routing (43) payload length: 48) 2200::244:212:3fff:feae:22f7 > 2200::211:2:0:0:2: RT6 (len=4, type=0, segleft=2, rsv=0x0, [0]2200::210:2:0:0:4, [1]2200::240:2:0:0:4) [icmp6 sum ok] ICMP6, echo request, id 0, seq 0 + 3 16:51:33.575585 IP6 (hlim 4, next-header Routing (43) payload length: 32) 2200::244:212:3fff:feae:22f7 > 2200::240:2:0:0:4: RT6 (len=2, type=0, segleft=1, rsv=0x0, [0]2200::210:2:0:0:4) 5645 > 5642: [udp sum ok] UDP, length 0 + 4 16:51:34.608086 IP6 (hlim 5, next-header Routing (43) payload length: 48) 2200::244:212:3fff:feae:22f7 > 2200::211:2:0:0:2: RT6 (len=4, type=0, segleft=2, rsv=0x0, [0]2200::210:2:0:0:4, [1]2200::240:2:0:0:4) 5645 > 5642: [udp sum ok] UDP, length 0 diff --git a/tests/ipv6-rthdr-oobr.out b/tests/ipv6-rthdr-oobr.out index 65a78c97..00e8cdf1 100644 --- a/tests/ipv6-rthdr-oobr.out +++ b/tests/ipv6-rthdr-oobr.out @@ -1 +1 @@ - 1 05:27:12.808464432 IP6 3030:3030:3030:3030:3030:3030:3030:3030 > 3030:3030:3030:3030:3030:3030:3030:3030: srcrt (len=48, type=0, segleft=48 [|rt6] + 1 05:27:12.808464432 IP6 3030:3030:3030:3030:3030:3030:3030:3030 > 3030:3030:3030:3030:3030:3030:3030:3030: RT6 (len=48, type=0, segleft=48 [|rt6] diff --git a/tests/ipv6-srh-ext-header.out b/tests/ipv6-srh-ext-header.out index 1e3fb033..dc64a655 100644 --- a/tests/ipv6-srh-ext-header.out +++ b/tests/ipv6-srh-ext-header.out @@ -1 +1 @@ - 1 16:29:31.085223 IP6 (flowlabel 0x889ad, hlim 64, next-header Routing (43) payload length: 144) a:b:c:12::1 > a:b:c:2::f1:0: srcrt (len=4, type=4, segleft=1, last-entry=1, flags=0x0, tag=0, [0]a:b:c:3::d6, [1]a:b:c:2::f1:0) IP6 (flowlabel 0x889ad, hlim 64, next-header ICMPv6 (58) payload length: 64) a:b:c:12::1 > b2::2: [icmp6 sum ok] ICMP6, echo request, id 1774, seq 1 + 1 16:29:31.085223 IP6 (flowlabel 0x889ad, hlim 64, next-header Routing (43) payload length: 144) a:b:c:12::1 > a:b:c:2::f1:0: RT6 (len=4, type=4, segleft=1, last-entry=1, flags=0x0, tag=0, [0]a:b:c:3::d6, [1]a:b:c:2::f1:0) IP6 (flowlabel 0x889ad, hlim 64, next-header ICMPv6 (58) payload length: 64) a:b:c:12::1 > b2::2: [icmp6 sum ok] ICMP6, echo request, id 1774, seq 1 diff --git a/tests/ipv6-srh-insert-cksum.out b/tests/ipv6-srh-insert-cksum.out index 1815c661..f16c8a3a 100644 --- a/tests/ipv6-srh-insert-cksum.out +++ b/tests/ipv6-srh-insert-cksum.out @@ -1 +1 @@ - 1 17:59:40.591932 IP6 (flowlabel 0x8f8b8, hlim 64, next-header Routing (43) payload length: 1088) 12::1 > 2::f1:0: srcrt (len=6, type=4, segleft=2, last-entry=2, flags=0x0, tag=0, [0]b2::2, [1]3::d6, [2]2::f1:0) 57745 > 5001: [udp sum ok] UDP, length 1024 + 1 17:59:40.591932 IP6 (flowlabel 0x8f8b8, hlim 64, next-header Routing (43) payload length: 1088) 12::1 > 2::f1:0: RT6 (len=6, type=4, segleft=2, last-entry=2, flags=0x0, tag=0, [0]b2::2, [1]3::d6, [2]2::f1:0) 57745 > 5001: [udp sum ok] UDP, length 1024 diff --git a/tests/ipv6-srh-ipproto-ether-ev.out b/tests/ipv6-srh-ipproto-ether-ev.out index 96a99bc7..36dedcfa 100644 --- a/tests/ipv6-srh-ipproto-ether-ev.out +++ b/tests/ipv6-srh-ipproto-ether-ev.out @@ -1 +1 @@ - 1 15:07:04.802036 be:f5:06:09:44:74 > d6:67:19:4e:0f:4f, ethertype IPv6 (0x86dd), length 196: (flowlabel 0xde027, hlim 63, next-header Routing (43) payload length: 142) a::1 > c::2: srcrt (len=2, type=4, segleft=0, last-entry=0, flags=0x0, tag=0, [0]c::2) ae:64:42:3b:5b:9a > 1e:1d:df:cd:54:7a, ethertype IPv6 (0x86dd), length 118: (flowlabel 0xde027, hlim 64, next-header ICMPv6 (58) payload length: 64) a::2 > e::2: [icmp6 sum ok] ICMP6, echo request, id 18516, seq 1339 + 1 15:07:04.802036 be:f5:06:09:44:74 > d6:67:19:4e:0f:4f, ethertype IPv6 (0x86dd), length 196: (flowlabel 0xde027, hlim 63, next-header Routing (43) payload length: 142) a::1 > c::2: RT6 (len=2, type=4, segleft=0, last-entry=0, flags=0x0, tag=0, [0]c::2) ae:64:42:3b:5b:9a > 1e:1d:df:cd:54:7a, ethertype IPv6 (0x86dd), length 118: (flowlabel 0xde027, hlim 64, next-header ICMPv6 (58) payload length: 64) a::2 > e::2: [icmp6 sum ok] ICMP6, echo request, id 18516, seq 1339 diff --git a/tests/ipv6-srh-ipproto-ether-v.out b/tests/ipv6-srh-ipproto-ether-v.out index 8c8b2178..2d6664e6 100644 --- a/tests/ipv6-srh-ipproto-ether-v.out +++ b/tests/ipv6-srh-ipproto-ether-v.out @@ -1 +1 @@ - 1 15:07:04.802036 IP6 (flowlabel 0xde027, hlim 63, next-header Routing (43) payload length: 142) a::1 > c::2: srcrt (len=2, type=4, segleft=0, last-entry=0, flags=0x0, tag=0, [0]c::2) IP6 (flowlabel 0xde027, hlim 64, next-header ICMPv6 (58) payload length: 64) a::2 > e::2: [icmp6 sum ok] ICMP6, echo request, id 18516, seq 1339 + 1 15:07:04.802036 IP6 (flowlabel 0xde027, hlim 63, next-header Routing (43) payload length: 142) a::1 > c::2: RT6 (len=2, type=4, segleft=0, last-entry=0, flags=0x0, tag=0, [0]c::2) IP6 (flowlabel 0xde027, hlim 64, next-header ICMPv6 (58) payload length: 64) a::2 > e::2: [icmp6 sum ok] ICMP6, echo request, id 18516, seq 1339