Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
IPv6: Use "header+payload length" in two messages
Browse files Browse the repository at this point in the history
It seems a more logical order than "payload+header".

It is not in current release 4.99.4, will be in 4.99.5.

Update some test outputs accordingly.

(backported from commit 440d155)
  • Loading branch information
fxlb committed Mar 4, 2024
1 parent 43b5bb0 commit 68ea977
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions print-ip6.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
if (payload_len != 0) {
len = payload_len + sizeof(struct ip6_hdr);
if (len > length) {
ND_PRINT("[payload+header length %u > length %u]",
ND_PRINT("[header+payload length %u > length %u]",
len, length);
nd_print_invalid(ndo);
ND_PRINT(" ");
Expand Down Expand Up @@ -435,7 +435,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
if (len < total_advance)
goto trunc;
if (len > length) {
ND_PRINT("[payload+header length %u > length %u]",
ND_PRINT("[header+payload length %u > length %u]",
len, length);
nd_print_invalid(ndo);
ND_PRINT(" ");
Expand Down
4 changes: 2 additions & 2 deletions tests/cve2015-0261-ipv6.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1 13:55:31.300000 IP6 [payload+header length 26510 > length 185] (invalid) (class 0x76, flowlabel 0x76767, hlim 103, next-header Mobility (135) payload length: 26470) 6767:6767:6767:6767:6767:6767:6767:6767 > 6767:6767:6767:6767:6767:6767:6767:6705: mobility: BU seq#=26471 HL lifetime=105884(type-0x67: len=103) [|mobility]
2 15:21:11.300000 IP6 [payload+header length 26510 > length 185] (invalid) (class 0x76, flowlabel 0x76767, hlim 103, next-header Mobility (135) payload length: 26470) 6767:6767:6767:6767:6767:6767:6767:6767 > 6767:6767:4f67:6767:6767:6767:6767:6767: (header length 8 is too small for type 6) [|mobility]
1 13:55:31.300000 IP6 [header+payload length 26510 > length 185] (invalid) (class 0x76, flowlabel 0x76767, hlim 103, next-header Mobility (135) payload length: 26470) 6767:6767:6767:6767:6767:6767:6767:6767 > 6767:6767:6767:6767:6767:6767:6767:6705: mobility: BU seq#=26471 HL lifetime=105884(type-0x67: len=103) [|mobility]
2 15:21:11.300000 IP6 [header+payload length 26510 > length 185] (invalid) (class 0x76, flowlabel 0x76767, hlim 103, next-header Mobility (135) payload length: 26470) 6767:6767:6767:6767:6767:6767:6767:6767 > 6767:6767:4f67:6767:6767:6767:6767:6767: (header length 8 is too small for type 6) [|mobility]
2 changes: 1 addition & 1 deletion tests/ipv6-too-long-jumbo.out
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1 12:40:23.226395 IP6 (class 0xc0, hlim 0, next-header Options (0) payload length: 0) 1:6:1a28:312:d7cb:b318:34e5:d3ea > 2b7f:cd1f:ec3c:fb9c:e731:d16b:a8fe:ba8c: HBH (opt_type 0x1a: len=0)(padn)(opt_type 0x16: len=0)(opt_type 0x64: len=114)(jumbo: 3858694210) (opt_type 0x42: len=3)(opt_type 0xfe: len=6)(pad1)(jumbo: 248 - already seen) (opt_type 0x0e: len=8)(opt_type 0x07: len=4)(opt_type 0xf1: len=60) [payload+header length 3858694250 > length 476] (invalid) ip-proto-12 3858693802
1 12:40:23.226395 IP6 (class 0xc0, hlim 0, next-header Options (0) payload length: 0) 1:6:1a28:312:d7cb:b318:34e5:d3ea > 2b7f:cd1f:ec3c:fb9c:e731:d16b:a8fe:ba8c: HBH (opt_type 0x1a: len=0)(padn)(opt_type 0x16: len=0)(opt_type 0x64: len=114)(jumbo: 3858694210) (opt_type 0x42: len=3)(opt_type 0xfe: len=6)(pad1)(jumbo: 248 - already seen) (opt_type 0x0e: len=8)(opt_type 0x07: len=4)(opt_type 0xf1: len=60) [header+payload length 3858694250 > length 476] (invalid) ip-proto-12 3858693802
2 changes: 1 addition & 1 deletion tests/ipv6_invalid_length_2.out
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1 08:59:14.753767 IP6 [payload+header length 105 > length 104] (invalid) (flowlabel 0x67576, hlim 64, next-header UDP (17) payload length: 65) 2605:bc80:3010:104::8cd3:9ce.45678 > 2600:3c00:e000:19::1.53: [udp sum ok] 34053+ [1au] A? www.tcpdump.org. (56)
1 08:59:14.753767 IP6 [header+payload length 105 > length 104] (invalid) (flowlabel 0x67576, hlim 64, next-header UDP (17) payload length: 65) 2605:bc80:3010:104::8cd3:9ce.45678 > 2600:3c00:e000:19::1.53: [udp sum ok] 34053+ [1au] A? www.tcpdump.org. (56)
2 changes: 1 addition & 1 deletion tests/ipv6_jumbogram_invalid_length.out
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1 09:09:55.627421 IP6 (hlim 227, next-header Options (0) payload length: 0) 2200::244:212:3fff:feae:22f7 > 2200::240:2:0:0:4: HBH (jumbo: 65537) [payload+header length 65577 > length 65576] (invalid) ICMP6, echo request, id 4576, seq 51486
1 09:09:55.627421 IP6 (hlim 227, next-header Options (0) payload length: 0) 2200::244:212:3fff:feae:22f7 > 2200::240:2:0:0:4: HBH (jumbo: 65537) [header+payload length 65577 > length 65576] (invalid) ICMP6, echo request, id 4576, seq 51486

0 comments on commit 68ea977

Please sign in to comment.