Skip to content

Commit ecb0867

Browse files
committed
TCP: Update the Reset segment processing
Don't use "[!RST" for truncation, use standard [|tcp]. Replace the nd_printn() call by a nd_printjn() call. Moreover: Add a space (style).
1 parent 7c24b52 commit ecb0867

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

print-tcp.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ tcp_print(netdissect_options *ndo,
730730
}
731731
bp += header_len;
732732
if (flags & TH_RST) {
733-
if(ndo->ndo_vflag)
733+
if (ndo->ndo_vflag)
734734
print_tcp_rst_data(ndo, bp, length);
735735
else
736736
ND_TCHECK_LEN(bp, length);
@@ -867,14 +867,13 @@ static void
867867
print_tcp_rst_data(netdissect_options *ndo,
868868
const u_char *sp, u_int length)
869869
{
870-
ND_PRINT(ND_TTEST_LEN(sp, length) ? " [RST" : " [!RST");
871-
if (length > MAX_RST_DATA_LEN) {
872-
length = MAX_RST_DATA_LEN; /* can use -X for longer */
870+
ND_PRINT(" [RST");
871+
if (length > MAX_RST_DATA_LEN) /* can use -X for longer */
873872
ND_PRINT("+"); /* indicate we truncate */
874-
}
875873
ND_PRINT(" ");
876-
(void)nd_printn(ndo, sp, length, ndo->ndo_snapend);
874+
nd_printjn(ndo, sp, ND_MIN(length, MAX_RST_DATA_LEN));
877875
ND_PRINT("]");
876+
ND_TCHECK_LEN(sp, length);
878877
}
879878

880879
static void

tests/tcp_rst_data-trunc-v.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
1 2013-02-26 22:03:19.190965 IP (tos 0x20, ttl 243, id 8243, offset 0, flags [DF], proto TCP (6), length 98)
2-
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]
2+
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]

0 commit comments

Comments
 (0)