]> The Tcpdump Group git mirrors - tcpdump/commitdiff
TCP: Update the Reset segment processing
authorFrancois-Xavier Le Bail <[email protected]>
Tue, 19 Jan 2021 17:43:53 +0000 (18:43 +0100)
committerfxlb <[email protected]>
Sun, 9 Feb 2025 18:08:18 +0000 (18:08 +0000)
Don't use "[!RST" for truncation, use standard [|tcp].

Replace the nd_printn() call by a nd_printjn() call.

Moreover:
Add a space (style).

print-tcp.c
tests/tcp_rst_data-trunc-v.out

index 4314ec22bfbe78aad18489c86f19c92642a900b8..d997cbcdd9463077f89d8e9b2249ee0cb70dc9b8 100644 (file)
@@ -730,7 +730,7 @@ tcp_print(netdissect_options *ndo,
         }
         bp += header_len;
         if (flags & TH_RST) {
-                if(ndo->ndo_vflag)
+                if (ndo->ndo_vflag)
                         print_tcp_rst_data(ndo, bp, length);
                 else
                         ND_TCHECK_LEN(bp, length);
@@ -867,14 +867,13 @@ static void
 print_tcp_rst_data(netdissect_options *ndo,
                    const u_char *sp, u_int length)
 {
-        ND_PRINT(ND_TTEST_LEN(sp, length) ? " [RST" : " [!RST");
-        if (length > MAX_RST_DATA_LEN) {
-                length = MAX_RST_DATA_LEN;     /* can use -X for longer */
+        ND_PRINT(" [RST");
+        if (length > MAX_RST_DATA_LEN)         /* can use -X for longer */
                 ND_PRINT("+");                 /* indicate we truncate */
-        }
         ND_PRINT(" ");
-        (void)nd_printn(ndo, sp, length, ndo->ndo_snapend);
+        nd_printjn(ndo, sp, ND_MIN(length, MAX_RST_DATA_LEN));
         ND_PRINT("]");
+        ND_TCHECK_LEN(sp, length);
 }
 
 static void
index 0f25b0b475068aa75745bca705d4fe32c444cd33..74c5bad8ea5fb60ff79ab2fe7cd86cf3a088e57d 100644 (file)
@@ -1,2 +1,2 @@
     1  2013-02-26 22:03:19.190965 IP (tos 0x20, ttl 243, id 8243, offset 0, flags [DF], proto TCP (6), length 98)
-    199.204.31.89.80 > 172.16.133.41.52875: Flags [R.], seq 1617159969:1617160027, ack 1936660873, win 5785, length 58 [!RST+ BIG-IP: [0x11c5672:3045] {peer]
+    199.204.31.89.80 > 172.16.133.41.52875: Flags [R.], seq 1617159969:1617160027, ack 1936660873, win 5785, length 58 [RST+ BIG-IP: [0x11c5672:3045] {peer] [|tcp]