/src/wireshark/epan/dissectors/packet-retix-bpdu.c
Line | Count | Source |
1 | | /* packet-retix-bpdu.c |
2 | | * Routines for BPDU (Retix Spanning Tree Protocol) disassembly |
3 | | * |
4 | | * Copyright 2005 Giles Scott (gscott <AT> arubanetworks dot com> |
5 | | * |
6 | | * Wireshark - Network traffic analyzer |
7 | | * By Gerald Combs <gerald@wireshark.org> |
8 | | * Copyright 1998 Gerald Combs |
9 | | * |
10 | | * SPDX-License-Identifier: GPL-2.0-or-later |
11 | | */ |
12 | | |
13 | | #include "config.h" |
14 | | |
15 | | #include <epan/packet.h> |
16 | | #include <epan/addr_resolv.h> |
17 | | |
18 | | void proto_register_retix_bpdu(void); |
19 | | |
20 | | static int ett_retix_bpdu; |
21 | | static int proto_retix_bpdu; |
22 | | |
23 | | static int hf_retix_bpdu_root_mac; |
24 | | static int hf_retix_bpdu_bridge_mac; |
25 | | static int hf_retix_bpdu_max_age; |
26 | | static int hf_retix_bpdu_hello_time; |
27 | | static int hf_retix_bpdu_forward_delay; |
28 | | |
29 | | /* I don't have the spec's for this protcol so it's been reverse engineered |
30 | | * It seems quite like 802.1D |
31 | | * It looks like the protocol version is specified in the ethernet trailer |
32 | | * In the single packet I have the trailer is |
33 | | * "RevC CBPDU" |
34 | | * There are several fields I've not dissected as I'm not exactly sure what they are |
35 | | * What ever happened to Retix anyway? |
36 | | */ |
37 | | static int |
38 | | dissect_retix_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) |
39 | 3 | { |
40 | 3 | proto_tree *retix_bpdu_tree; |
41 | 3 | proto_tree *ti; |
42 | | |
43 | 3 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "R-STP"); |
44 | | |
45 | 3 | ti = proto_tree_add_item(tree, proto_retix_bpdu, tvb, 0, -1, ENC_NA); |
46 | 3 | retix_bpdu_tree = proto_item_add_subtree(ti, ett_retix_bpdu); |
47 | | |
48 | 3 | proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_root_mac, tvb, 0, 6, ENC_NA); |
49 | | |
50 | 3 | proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_bridge_mac, tvb, 10, 6, ENC_NA); |
51 | 3 | col_add_fstr(pinfo->cinfo, COL_INFO, "Bridge MAC %s", tvb_ether_to_str(pinfo->pool, tvb, 10)); |
52 | | |
53 | 3 | proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_max_age, tvb, 20, 2, ENC_BIG_ENDIAN); |
54 | 3 | proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_hello_time, tvb, 22, 2, ENC_BIG_ENDIAN); |
55 | 3 | proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_forward_delay, tvb, 24, 2, ENC_BIG_ENDIAN); |
56 | | |
57 | 3 | return tvb_captured_length(tvb); |
58 | 3 | } |
59 | | |
60 | | |
61 | | void |
62 | | proto_register_retix_bpdu(void) |
63 | 16 | { |
64 | 16 | static hf_register_info hf[] = { |
65 | 16 | { &hf_retix_bpdu_root_mac, |
66 | 16 | { "Root MAC", "r-stp.root.hw", FT_ETHER, BASE_NONE, NULL, 0x0, |
67 | 16 | NULL, HFILL}}, |
68 | | |
69 | 16 | { &hf_retix_bpdu_bridge_mac, |
70 | 16 | { "Bridge MAC", "r-stp.bridge.hw", FT_ETHER, BASE_NONE, NULL, 0x0, |
71 | 16 | NULL, HFILL}}, |
72 | | |
73 | 16 | { &hf_retix_bpdu_max_age, |
74 | 16 | { "Max Age", "r-stp.maxage", FT_UINT16, BASE_DEC, NULL, 0x0, |
75 | 16 | NULL, HFILL}}, |
76 | | |
77 | 16 | { &hf_retix_bpdu_hello_time, |
78 | 16 | { "Hello Time", "r-stp.hello", FT_UINT16, BASE_DEC, NULL, 0x0, |
79 | 16 | NULL, HFILL}}, |
80 | | |
81 | 16 | { &hf_retix_bpdu_forward_delay, |
82 | 16 | { "Forward Delay", "r-stp.forward", FT_UINT16, BASE_DEC, NULL, 0x0, |
83 | 16 | NULL, HFILL}}, |
84 | 16 | }; |
85 | | |
86 | 16 | static int *ett[] ={ |
87 | 16 | &ett_retix_bpdu, |
88 | 16 | }; |
89 | | |
90 | 16 | proto_retix_bpdu = proto_register_protocol("Retix Spanning Tree Protocol", "R-STP", "r-stp"); |
91 | 16 | proto_register_field_array(proto_retix_bpdu, hf, array_length(hf)); |
92 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
93 | 16 | register_dissector("rbpdu", dissect_retix_bpdu, proto_retix_bpdu); |
94 | 16 | } |
95 | | |
96 | | /* |
97 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
98 | | * |
99 | | * Local Variables: |
100 | | * c-basic-offset: 2 |
101 | | * tab-width: 8 |
102 | | * indent-tabs-mode: nil |
103 | | * End: |
104 | | * |
105 | | * ex: set shiftwidth=2 tabstop=8 expandtab: |
106 | | * :indentSize=2:tabSize=8:noTabs=true: |
107 | | */ |