From nobody Sun Dec 31 21:04:12 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T3BSF0tnBz55JHX; Sun, 31 Dec 2023 21:04:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T3BSF01w4z3chq; Sun, 31 Dec 2023 21:04:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704056653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pz65Tt2jCpaTGn9ZdDrdkrXunEMLPABkOkjYdw1Mshc=; b=HhvJTKBXvHJTcuMn0+87yEOM/H61S4eGTopSFk8eQ5W2+Is8xVQOeRkOdduP5MRZ38/G35 +BUxq3HgtERDxquy84tvqzO9iu6wT83VT1k0kPJC2yFFSD+rDP1xQgDo1z8Wv3gdu9gLn0 MpklPguNcg8zxFy7+/Ng2B+Nlx4v8iKsx4rkIJfBWbNb0bzzWWDFUgsL9g9fv0a0XZV/IV ql68lgNtBLH24FnFPnOHVYc+Kxn/i0r4gTPWd6S7VRpty+fXQIxHP6aMXeu+1HiZUeswvq dszZsbhF6jVSc0EEJQn/ygcL8FMVUW1YKpn+dZma7vcjZrI/G9+IWc8E56s8QQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704056653; a=rsa-sha256; cv=none; b=R+m8u0FVuUBdOJy74MP8UD8AtZ5/6LLW5bgmGYeLYlGHjA+jXvgA1uu2lFhgQNEKrSw79Y RMqR7gcEwJL3E2ORKP0E3k94J+Z6aIDFkPIBJ7xMpbAhhT1swSNSEtrY3JIVpgak6j40E4 6EuI5mh9LpEhyhht5XalubvnmXWKZDHJE1RbyftVkCu7mI8/ns+pWK8nd7tmsvHu1u0RHh wCrL0srb3+exZ+YBQcc2Fl8p8I1rJ7ZFe4Ki6ku+ZwLwey4SzU5KN/xjBBgdMS/cnaWOQV 70gBUYZqAL4tpIIwa2Kn9bHBDORglG+EACf6todSmxMs08e6rhaDgGxmAvIh7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704056653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pz65Tt2jCpaTGn9ZdDrdkrXunEMLPABkOkjYdw1Mshc=; b=CUpFJaiBWW/qJod0cUkXWBD5wQM7NiQywiCXAOg/ze3HnNTxPF0uLmn5l9668gSuMn9qtU rtcQO/0OOsQgC2cEqEK1rlkjWZ3ai+dEI4epntgN49+fjQL5uJSsMfN1VcsJrfwOfDTqS/ 1i2tWlBYUUAHgAvaRtIo9BKVpRld0raMDuGYre9l8qS3CBOJzA90iTwAYX4m7fiJsgOgjd h3pkneCaUc7HpiiaDJfYOJW2/17pLxH5Cr17k+bNRZAG18pKznKWRJchA3cWuLXcxZ1cjv q5A8QAL7Me2CN/UdrPftyvBxiWepwBuuQANOUksrUBdRVId3sl35Zcs7F3xpcQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T3BSD6B0HzqHL; Sun, 31 Dec 2023 21:04:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BVL4CGG012480; Sun, 31 Dec 2023 21:04:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BVL4CHe012477; Sun, 31 Dec 2023 21:04:12 GMT (envelope-from git) Date: Sun, 31 Dec 2023 21:04:12 GMT Message-Id: <202312312104.3BVL4CHe012477@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 38c63bdc4625 - main - libdtrace: decode all tcp header flags and add decoding capability of TH_AE to dtrace, including the example provided with tcpdebug. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 38c63bdc46252d4d8cd313dff4183ec4546d26d9 Auto-Submitted: auto-generated The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=38c63bdc46252d4d8cd313dff4183ec4546d26d9 commit 38c63bdc46252d4d8cd313dff4183ec4546d26d9 Author: Richard Scheffenegger AuthorDate: 2023-12-31 14:00:21 +0000 Commit: Richard Scheffenegger CommitDate: 2023-12-31 14:02:03 +0000 libdtrace: decode all tcp header flags and add decoding capability of TH_AE to dtrace, including the example provided with tcpdebug. MFC after: 1 week Reviewed By: markj, mav Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D43243 --- cddl/lib/libdtrace/tcp.d | 35 +++++++++++++++++++---------------- share/dtrace/tcpdebug | 9 ++++++--- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/cddl/lib/libdtrace/tcp.d b/cddl/lib/libdtrace/tcp.d index ea3a553ebf53..a91f2cd2b0b4 100644 --- a/cddl/lib/libdtrace/tcp.d +++ b/cddl/lib/libdtrace/tcp.d @@ -81,21 +81,23 @@ inline int TCP_STATE_TIME_WAIT = TCPS_TIME_WAIT; /* TCP segment flags. */ #pragma D binding "1.6.3" TH_FIN -inline uint8_t TH_FIN = 0x01; +inline uint16_t TH_FIN = 0x01; #pragma D binding "1.6.3" TH_SYN -inline uint8_t TH_SYN = 0x02; +inline uint16_t TH_SYN = 0x02; #pragma D binding "1.6.3" TH_RST -inline uint8_t TH_RST = 0x04; +inline uint16_t TH_RST = 0x04; #pragma D binding "1.6.3" TH_PUSH -inline uint8_t TH_PUSH = 0x08; +inline uint16_t TH_PUSH = 0x08; #pragma D binding "1.6.3" TH_ACK -inline uint8_t TH_ACK = 0x10; +inline uint16_t TH_ACK = 0x10; #pragma D binding "1.6.3" TH_URG -inline uint8_t TH_URG = 0x20; +inline uint16_t TH_URG = 0x20; #pragma D binding "1.6.3" TH_ECE -inline uint8_t TH_ECE = 0x40; +inline uint16_t TH_ECE = 0x40; #pragma D binding "1.6.3" TH_CWR -inline uint8_t TH_CWR = 0x80; +inline uint16_t TH_CWR = 0x80; +#pragma D binding "1.6.3" TH_AE +inline uint16_t TH_AE = 0x100; /* TCP connection state strings. */ #pragma D binding "1.6.3" tcp_state_string @@ -173,7 +175,7 @@ typedef struct tcpinfo { uint32_t tcp_seq; /* sequence number */ uint32_t tcp_ack; /* acknowledgment number */ uint8_t tcp_offset; /* data offset, in bytes */ - uint8_t tcp_flags; /* flags */ + uint16_t tcp_flags; /* flags */ uint16_t tcp_window; /* window size */ uint16_t tcp_checksum; /* checksum */ uint16_t tcp_urgent; /* urgent data pointer */ @@ -192,7 +194,7 @@ typedef struct tcpinfoh { uint32_t tcp_seq; /* sequence number */ uint32_t tcp_ack; /* acknowledgment number */ uint8_t tcp_offset; /* data offset, in bytes */ - uint8_t tcp_flags; /* flags */ + uint16_t tcp_flags; /* flags */ uint16_t tcp_window; /* window size */ uint16_t tcp_checksum; /* checksum */ uint16_t tcp_urgent; /* urgent data pointer */ @@ -264,7 +266,7 @@ translator tcpinfo_t < struct tcphdr *p > { tcp_seq = p == NULL ? -1 : ntohl(p->th_seq); tcp_ack = p == NULL ? -1 : ntohl(p->th_ack); tcp_offset = p == NULL ? -1 : (p->th_off >> 2); - tcp_flags = p == NULL ? 0 : p->th_flags; + tcp_flags = p == NULL ? 0 : ((p->th_x2 << 8) | p->th_flags); tcp_window = p == NULL ? 0 : ntohs(p->th_win); tcp_checksum = p == NULL ? 0 : ntohs(p->th_sum); tcp_urgent = p == NULL ? 0 : ntohs(p->th_urp); @@ -283,7 +285,7 @@ translator tcpinfoh_t < struct tcphdr *p > { tcp_seq = p == NULL ? -1 : p->th_seq; tcp_ack = p == NULL ? -1 : p->th_ack; tcp_offset = p == NULL ? -1 : (p->th_off >> 2); - tcp_flags = p == NULL ? 0 : p->th_flags; + tcp_flags = p == NULL ? 0 : ((p->th_x2 << 8) | p->th_flags); tcp_window = p == NULL ? 0 : p->th_win; tcp_checksum = p == NULL ? 0 : ntohs(p->th_sum); tcp_urgent = p == NULL ? 0 : p->th_urp; @@ -311,17 +313,17 @@ inline int TA_DROP = 4; /* direction strings. */ -#pragma D binding "1.12.1" tcpdebug_dir_string +#pragma D binding "1.13" tcpdebug_dir_string inline string tcpdebug_dir_string[uint8_t direction] = direction == TA_INPUT ? "input" : direction == TA_OUTPUT ? "output" : direction == TA_USER ? "user" : direction == TA_RESPOND ? "respond" : - direction == TA_OUTPUT ? "drop" : + direction == TA_DROP ? "drop" : "unknown" ; -#pragma D binding "1.12.1" tcpflag_string -inline string tcpflag_string[uint8_t flags] = +#pragma D binding "1.13" tcpflag_string +inline string tcpflag_string[uint16_t flags] = flags & TH_FIN ? "FIN" : flags & TH_SYN ? "SYN" : flags & TH_RST ? "RST" : @@ -330,6 +332,7 @@ inline string tcpflag_string[uint8_t flags] = flags & TH_URG ? "URG" : flags & TH_ECE ? "ECE" : flags & TH_CWR ? "CWR" : + flags & TH_AE ? "AE" : "unknown" ; #pragma D binding "1.12.1" PRU_ATTACH diff --git a/share/dtrace/tcpdebug b/share/dtrace/tcpdebug index e6ba394743e6..07367b7637f5 100755 --- a/share/dtrace/tcpdebug +++ b/share/dtrace/tcpdebug @@ -64,7 +64,8 @@ tcp:kernel::debug-input printf("%s", flags & TH_PUSH ? "PUSH," :""); printf("%s", flags & TH_URG ? "URG," :""); printf("%s", flags & TH_ECE ? "ECE," :""); - printf("%s", flags & TH_CWR ? "CWR" :""); + printf("%s", flags & TH_CWR ? "CWR," :""); + printf("%s", flags & TH_AE ? "AE" :""); printf("%s", flags != 0 ? ">" : ""); printf("\n"); @@ -97,7 +98,8 @@ tcp:kernel::debug-output printf("%s", flags & TH_PUSH ? "PUSH," :""); printf("%s", flags & TH_URG ? "URG," :""); printf("%s", flags & TH_ECE ? "ECE," :""); - printf("%s", flags & TH_CWR ? "CWR" :""); + printf("%s", flags & TH_CWR ? "CWR," :""); + printf("%s", flags & TH_AE ? "AE" :""); printf("%s", flags != 0 ? ">" : ""); printf("\n"); @@ -135,7 +137,8 @@ tcp:kernel::debug-drop printf("%s", flags & TH_PUSH ? "PUSH," :""); printf("%s", flags & TH_URG ? "URG," :""); printf("%s", flags & TH_ECE ? "ECE," :""); - printf("%s", flags & TH_CWR ? "CWR" :""); + printf("%s", flags & TH_CWR ? "CWR," :""); + printf("%s", flags & TH_AE ? "AE" :""); printf("%s", flags != 0 ? ">" : ""); printf("\n");