2 * Dissector for Allied Telesis Resiliency Link Frames
4 * Copyright (c) 2024 by Martin Mayer <martin.mayer@m2-it-solutions.de>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include <epan/etypes.h>
15 #include <epan/packet.h>
17 void proto_register_at_rl(void);
18 void proto_reg_handoff_at_rl(void);
20 static dissector_handle_t at_rl_handle
;
22 static int proto_at_rl
;
24 #define AT_RL_FRAME_LEN 18
27 static int hf_at_rl_sequence
;
28 static int hf_at_rl_master
;
29 static int hf_at_rl_padding
;
30 static int hf_at_rl_vcsid
;
31 static int hf_at_rl_role_change
;
36 dissect_at_rl(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
39 /* Check if packet is destined to the Allied Telesis address (01:00:CD:FA:1B:AC) */
40 uint8_t dst_mac
[6] = {0x01, 0x00, 0xCD, 0xFA, 0x1B, 0xAC};
41 address dst_addr
= ADDRESS_INIT_NONE
;
42 set_address(&dst_addr
, AT_ETHER
, sizeof(dst_mac
), &dst_mac
);
44 if(!addresses_equal(&pinfo
->dl_dst
, &dst_addr
))
47 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "AT RL");
48 col_clear(pinfo
->cinfo
,COL_INFO
);
49 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "Seq: %u, VCS-ID: %u",
50 tvb_get_uint32(tvb
, 0, ENC_BIG_ENDIAN
),
51 tvb_get_uint16(tvb
, 12, ENC_BIG_ENDIAN
));
53 /* Frame has fixed length, so we can directly set tree and reported length (padding will most likely be added) */
54 tvb_set_reported_length(tvb
, AT_RL_FRAME_LEN
);
56 proto_item
*ti
= proto_tree_add_item(tree
, proto_at_rl
, tvb
, 0, AT_RL_FRAME_LEN
, ENC_NA
);
57 proto_tree
*at_rl_tree
= proto_item_add_subtree(ti
, ett_at_rl
);
60 proto_tree_add_item(at_rl_tree
, hf_at_rl_sequence
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
63 proto_tree_add_item(at_rl_tree
, hf_at_rl_master
, tvb
, offset
, 6, ENC_NA
);
66 proto_tree_add_item(at_rl_tree
, hf_at_rl_padding
, tvb
, offset
, 2, ENC_NA
);
69 proto_tree_add_item(at_rl_tree
, hf_at_rl_vcsid
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
72 proto_tree_add_item(at_rl_tree
, hf_at_rl_role_change
, tvb
, offset
, 4, ENC_TIME_SECS
);
74 return AT_RL_FRAME_LEN
;
78 proto_register_at_rl(void)
80 static hf_register_info hf
[] = {
82 { "Sequence No.", "atrl.sequence",
83 FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
86 { "Active Master", "atrl.master",
87 FT_ETHER
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
90 { "Padding", "atrl.padding",
91 FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
94 { "Virtual Chassis Stack ID", "atrl.vcsid",
95 FT_UINT16
, BASE_DEC_HEX
, NULL
, 0x0, NULL
, HFILL
}
97 { &hf_at_rl_role_change
,
98 { "Last Role Change", "atrl.role_change",
99 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x0, NULL
, HFILL
}
103 static int *ett
[] = {
107 proto_at_rl
= proto_register_protocol ("Allied Telesis Resiliency Link", "AT RL", "atrl");
109 proto_register_field_array(proto_at_rl
, hf
, array_length(hf
));
110 proto_register_subtree_array(ett
, array_length(ett
));
112 at_rl_handle
= register_dissector("atrl", dissect_at_rl
, proto_at_rl
);
116 proto_reg_handoff_at_rl(void)
118 dissector_add_uint("ethertype", ETHERTYPE_ATRL
, at_rl_handle
);
122 * Editor modelines - https://www.wireshark.org/tools/modelines.html
127 * indent-tabs-mode: nil
130 * vi: set shiftwidth=4 tabstop=8 expandtab:
131 * :indentSize=4:tabSize=8:noTabs=true: