1 /* packet-extreme-internal-eth.c
2 * Routines for the disassembly of Extreme Networks internal
3 * Ethernet capture headers
5 * Copyright 2021 Joerg Mayer (see AUTHORS file)
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
15 * It is possible to create internal capture in EXOS with
16 * debug packet capture ...
18 * List of interfaces on all VRs:
19 * run script shell.py cat /proc/net/dev
20 * on older software the following should work as well:
21 * debug packet capture on cmd-args "-D -1"
24 * https://extremeportal.force.com/ExtrArticleDetail?an=000079573
25 * https://extremeportal.force.com/ExtrArticleDetail?an=000082238
26 * https://extremeportal.force.com/ExtrArticleDetail?an=000079220
28 * This capture begins with an internal header (maybe containing some HiGig variant?),
29 * followed by the "original" Ethernet frame.
35 * always zero for incoming(?)
36 * often non-zero for outgoing
37 * 10 - 23: Unknown (traffic properties?)
46 #include <epan/packet.h>
47 #include <epan/etypes.h>
48 #include <epan/expert.h>
51 void proto_register_exeh(void);
52 void proto_reg_handoff_exeh(void);
54 static dissector_handle_t exeh_handle
;
56 static dissector_handle_t ethnofcs_handle
;
58 static int proto_exeh
;
60 static int hf_exeh_unknown_00_01
;
61 static int hf_exeh_module1
;
62 static int hf_exeh_port1
;
63 static int hf_exeh_module2
; /* m2 + p2 always zero for outgoing(?) */
64 static int hf_exeh_port2
;
65 static int hf_exeh_unknown_10_16
;
66 static int hf_exeh_unknown_17_0xfd
;
67 static int hf_exeh_unknown_17_0x02
;
68 static int hf_exeh_unknown_18_21
;
69 static int hf_exeh_unknown_22_23
;
70 static int hf_exeh_incoming_framesource
;
71 static int hf_exeh_outgoing_framesource
;
72 static int hf_exeh_vlan
;
73 static int hf_exeh_unknown_28_29
;
74 static int hf_exeh_dir
;
75 static int hf_exeh_unknown_32_33
;
76 static int hf_exeh_etype
;
77 static int hf_exeh_etypelen
;
78 static int hf_exeh_etypedata
;
80 static expert_field ei_exeh_unexpected_value
;
81 static expert_field ei_exeh_unequal_ports
;
82 static expert_field ei_exeh_incoming_framesource
;
83 static expert_field ei_exeh_outgoing_framesource
;
87 #define PROTO_SHORT_NAME "EXEH"
88 #define PROTO_LONG_NAME "EXtreme extra Eth Header"
90 static const value_string exeh_direction_vals
[] = {
97 static const value_string exeh_outgoing_vlanid_vals
[] = {
98 {0x0000, "No tag or VLAN ID = 0"},
99 {0x000f, "Has VLAN ID"},
104 static const value_string exeh_incoming_framesource_vals
[] = {
110 static const value_string exeh_outgoing_framesource_vals
[] = {
112 {0x4248, "Broadcom Hardware"},
119 dissect_exeh(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
122 proto_tree
*exeh_tree
;
124 uint32_t etype
, module1
, port1
, module2
, port2
, direction
, framesource
;
128 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, PROTO_SHORT_NAME
);
129 col_set_str(pinfo
->cinfo
, COL_INFO
, PROTO_SHORT_NAME
":");
131 ti
= proto_tree_add_item(tree
, proto_exeh
, tvb
, offset
, -1,
133 exeh_tree
= proto_item_add_subtree(ti
, ett_exeh
);
135 direction
= tvb_get_ntohs(tvb
, 30);
136 proto_tree_add_item(exeh_tree
, hf_exeh_unknown_00_01
, tvb
, offset
, 2, ENC_NA
);
138 proto_tree_add_item_ret_uint(exeh_tree
, hf_exeh_module1
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &module1
);
140 proto_tree_add_item_ret_uint(exeh_tree
, hf_exeh_port1
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &port1
);
142 proto_tree_add_item_ret_uint(exeh_tree
, hf_exeh_module2
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &module2
);
144 ti
= proto_tree_add_item_ret_uint(exeh_tree
, hf_exeh_port2
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &port2
);
145 if ( !(direction
== 255 && module2
== 0) && (module1
!= module2
|| port1
!= port2
) )
146 expert_add_info(pinfo
, ti
, &ei_exeh_unequal_ports
);
148 proto_tree_add_item(exeh_tree
, hf_exeh_unknown_10_16
, tvb
, offset
, 7, ENC_NA
);
150 proto_tree_add_item(exeh_tree
, hf_exeh_unknown_17_0xfd
, tvb
, offset
, 1, ENC_NA
);
151 proto_tree_add_item(exeh_tree
, hf_exeh_unknown_17_0x02
, tvb
, offset
, 1, ENC_NA
);
153 proto_tree_add_item(exeh_tree
, hf_exeh_unknown_18_21
, tvb
, offset
, 4, ENC_NA
);
155 proto_tree_add_item(exeh_tree
, hf_exeh_unknown_22_23
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
157 if ( direction
== 7 ) {
158 ti
= proto_tree_add_item_ret_uint(exeh_tree
, hf_exeh_incoming_framesource
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &framesource
);
159 if ( framesource
!= 0 )
160 expert_add_info(pinfo
, ti
, &ei_exeh_incoming_framesource
);
161 } else { /* Direction == 255 */
162 ti
= proto_tree_add_item_ret_uint(exeh_tree
, hf_exeh_outgoing_framesource
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &framesource
);
163 if ( framesource
!= 0 && framesource
!= 0x4248 )
164 expert_add_info(pinfo
, ti
, &ei_exeh_outgoing_framesource
);
167 proto_tree_add_item(exeh_tree
, hf_exeh_vlan
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
169 proto_tree_add_item(exeh_tree
, hf_exeh_unknown_28_29
, tvb
, offset
, 2, ENC_NA
);
171 proto_tree_add_item(exeh_tree
, hf_exeh_dir
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
173 proto_tree_add_item(exeh_tree
, hf_exeh_unknown_32_33
, tvb
, offset
, 2, ENC_NA
);
175 proto_tree_add_item_ret_uint(exeh_tree
, hf_exeh_etype
, tvb
, offset
, 2, ENC_BIG_ENDIAN
, &etype
);
177 case 0x8100: /* VLAN/VMAN Tag */
178 ti
= proto_tree_add_item_ret_int(exeh_tree
, hf_exeh_etypelen
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
, &databytes
);
179 if (tvb_reported_length_remaining(tvb
, offset
) != databytes
)
180 expert_add_info(pinfo
, ti
, &ei_exeh_unexpected_value
);
183 proto_tree_add_item(exeh_tree
, hf_exeh_etypedata
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
);
187 frame_tvb
= tvb_new_subset_remaining(tvb
, offset
);
188 call_dissector(ethnofcs_handle
, frame_tvb
, pinfo
, tree
);
190 return tvb_captured_length(tvb
);
194 proto_register_exeh(void)
196 static hf_register_info hf
[] = {
199 { &hf_exeh_unknown_00_01
,
200 { "Unknown_00", "exeh.unknown00", FT_BYTES
, BASE_NONE
, NULL
,
204 { "Module", "exeh.module1", FT_UINT16
, BASE_DEC
, NULL
,
208 { "Port", "exeh.port1", FT_UINT16
, BASE_DEC
, NULL
,
212 { "Module", "exeh.module2", FT_UINT16
, BASE_DEC
, NULL
,
216 { "Port", "exeh.port2", FT_UINT16
, BASE_DEC
, NULL
,
219 { &hf_exeh_unknown_10_16
,
220 { "Unknown_10 (incoming specific?)", "exeh.unknown10", FT_BYTES
, BASE_NONE
, NULL
,
223 { &hf_exeh_unknown_17_0xfd
,
224 { "Unknown_17", "exeh.unknown17", FT_UINT8
, BASE_HEX
, NULL
,
225 0xfd, NULL
, HFILL
}},
227 { &hf_exeh_unknown_17_0x02
,
228 { "Unknown_17 (Add dot1Q?)", "exeh.unknown17.dot1q", FT_BOOLEAN
, 8, TFS(&tfs_no_yes
),
229 0x02, NULL
, HFILL
}},
231 { &hf_exeh_unknown_18_21
,
232 { "Unknown_18 (outgoing specific?)", "exeh.unknown18", FT_BYTES
, BASE_NONE
, NULL
,
235 { &hf_exeh_unknown_22_23
,
236 { "Add VLAN ID?", "exeh.unknown22", FT_UINT16
, BASE_NONE
, VALS(exeh_outgoing_vlanid_vals
),
239 { &hf_exeh_incoming_framesource
,
240 { "Frame source", "exeh.framesource", FT_UINT16
, BASE_HEX
, VALS(exeh_incoming_framesource_vals
),
243 { &hf_exeh_outgoing_framesource
,
244 { "Frame source", "exeh.framesource", FT_UINT16
, BASE_HEX
, VALS(exeh_outgoing_framesource_vals
),
248 { "Transport VLAN", "exeh.vlan", FT_UINT16
, BASE_DEC
, NULL
,
251 { &hf_exeh_unknown_28_29
,
252 { "Unknown_28", "exeh.unknown28", FT_BYTES
, BASE_NONE
, NULL
,
256 { "Direction", "exeh.direction", FT_UINT16
, BASE_HEX
, VALS(exeh_direction_vals
),
259 { &hf_exeh_unknown_32_33
,
260 { "Unknown_32", "exeh.unknown32", FT_BYTES
, BASE_NONE
, NULL
,
264 { "Etype", "exeh.etype", FT_UINT16
, BASE_HEX
, NULL
,
267 { &hf_exeh_etypedata
,
268 { "Etype data", "exeh.etypedata", FT_UINT16
, BASE_HEX
, NULL
,
272 { "Length", "exeh.etypelen", FT_INT16
, BASE_DEC
, NULL
,
273 0x0, "Bytes from 8100 to end of frame", HFILL
}},
277 static int *ett
[] = {
281 static ei_register_info ei
[] = {
282 { &ei_exeh_unexpected_value
, { "exeh.unexpected_value", PI_PROTOCOL
, PI_WARN
, "Unexpected length", EXPFILL
}},
283 { &ei_exeh_unequal_ports
, { "exeh.unequal_ports", PI_PROTOCOL
, PI_WARN
, "Unequal ports", EXPFILL
}},
284 { &ei_exeh_incoming_framesource
, { "exeh.incoming_framesource", PI_PROTOCOL
, PI_WARN
, "Incoming framesource non-zero", EXPFILL
}},
285 { &ei_exeh_outgoing_framesource
, { "exeh.outgoing_framesource", PI_PROTOCOL
, PI_WARN
, "Outgoing framesource unknown magic", EXPFILL
}},
288 expert_module_t
* expert_exeh
;
290 proto_exeh
= proto_register_protocol(PROTO_LONG_NAME
, PROTO_SHORT_NAME
, "exeh");
291 proto_register_field_array(proto_exeh
, hf
, array_length(hf
));
292 proto_register_subtree_array(ett
, array_length(ett
));
293 expert_exeh
= expert_register_protocol(proto_exeh
);
294 expert_register_field_array(expert_exeh
, ei
, array_length(ei
));
296 exeh_handle
= register_dissector("exeh", dissect_exeh
, proto_exeh
);
300 proto_reg_handoff_exeh(void)
302 ethnofcs_handle
= find_dissector_add_dependency("eth_withoutfcs", proto_exeh
);
304 dissector_add_uint("ethertype", ETHERTYPE_EXEH
, exeh_handle
);
308 * Editor modelines - https://www.wireshark.org/tools/modelines.html
313 * indent-tabs-mode: t
316 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
317 * :indentSize=8:tabSize=8:noTabs=false: