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().
This commit is contained in:
Francois-Xavier Le Bail 2020-09-10 15:49:09 +02:00
parent 49894b4155
commit 8a776c2410
8 changed files with 14 additions and 12 deletions

View File

@ -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;
}

View File

@ -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]

View File

@ -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

View File

@ -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]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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