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@xxxxxxxxxxxx>
---
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