From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Guy Harris <gharris@sonic.net>
Cc: wireshark-dev@wireshark.org, linux-can@vger.kernel.org,
Oliver Hartkopp <socketcan@hartkopp.net>
Subject: [PATCH 3/4] socketcan: display len8dlc content for Classical CAN
Date: Mon, 18 Mar 2024 11:46:42 +0100 [thread overview]
Message-ID: <20240318104643.24098-4-socketcan@hartkopp.net> (raw)
In-Reply-To: <20240318104643.24098-1-socketcan@hartkopp.net>
While the Classical CAN frame can transport only 8 byte of data the
4 bit data length code (DLC) has the ability to have a value range
from 0 to 15. To be able to send and receive DLC values from 9 to 15
the struct can_frame contains an additional len8dlc element which
can have values from 9 to 15 when the data length value is 8.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
---
epan/dissectors/packet-socketcan.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/epan/dissectors/packet-socketcan.c b/epan/dissectors/packet-socketcan.c
index 2e29484085..4ca0479f79 100644
--- a/epan/dissectors/packet-socketcan.c
+++ b/epan/dissectors/packet-socketcan.c
@@ -33,10 +33,11 @@ static int hf_can_infoent_ext;
static int hf_can_infoent_std;
static int hf_can_extflag;
static int hf_can_rtrflag;
static int hf_can_errflag;
static int hf_can_reserved;
+static int hf_can_len8dlc;
static int hf_can_padding;
static int hf_can_err_tx_timeout;
static int hf_can_err_lostarb;
static int hf_can_err_ctrl;
@@ -720,11 +721,12 @@ dissect_socketcan_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu
if (can_packet_type == PACKET_TYPE_CAN_FD) {
proto_tree_add_bitmask_list(can_tree, tvb, CANFD_FLAG_OFFSET, 1, canfd_flag_fields, ENC_NA);
proto_tree_add_item(can_tree, hf_can_reserved, tvb, CANFD_FLAG_OFFSET+1, 2, ENC_NA);
} else {
- proto_tree_add_item(can_tree, hf_can_reserved, tvb, CANFD_FLAG_OFFSET, 3, ENC_NA);
+ proto_tree_add_item(can_tree, hf_can_reserved, tvb, CANFD_FLAG_OFFSET, 2, ENC_NA);
+ proto_tree_add_item(can_tree, hf_can_len8dlc, tvb, CANFD_FLAG_OFFSET+2, 1, ENC_NA);
}
if (frame_type == LINUX_CAN_ERR) {
int * const *flag;
const char *sepa = ": ";
@@ -853,10 +855,12 @@ proto_register_socketcan(void) {
"Remote Transmission Request Flag", "can.flags.rtr", FT_BOOLEAN, 32, NULL, CAN_RTR_FLAG, NULL, HFILL } },
{ &hf_can_errflag, {
"Error Message Flag", "can.flags.err", FT_BOOLEAN, 32, NULL, CAN_ERR_FLAG, NULL, HFILL } },
{ &hf_can_len, {
"Frame-Length", "can.len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+ { &hf_can_len8dlc, {
+ "Len 8 DLC", "can.len8dlc", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_can_reserved, {
"Reserved", "can.reserved", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_can_padding, {
"Padding", "can.padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_canfd_brsflag, {
--
2.43.0
next prev parent reply other threads:[~2024-03-18 10:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-18 10:46 [PATCH 0/4] Wireshark SocketCAN updates Oliver Hartkopp
2024-03-18 10:46 ` [PATCH 1/4] socketcan: simplify CAN packet type detection Oliver Hartkopp
2024-03-18 10:46 ` [PATCH 2/4] socketcan: display CANFD_FDF and CANXL_XLF flag content Oliver Hartkopp
2024-03-18 10:46 ` Oliver Hartkopp [this message]
2024-03-18 10:46 ` [PATCH 4/4] socketcan: update CAN CiA 611-1 definitions Oliver Hartkopp
2024-03-18 16:37 ` [Wireshark-dev] [PATCH 0/4] Wireshark SocketCAN updates Gerald Combs
2024-03-18 19:15 ` Oliver Hartkopp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240318104643.24098-4-socketcan@hartkopp.net \
--to=socketcan@hartkopp.net \
--cc=gharris@sonic.net \
--cc=linux-can@vger.kernel.org \
--cc=wireshark-dev@wireshark.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).