diff options
author | William Tu <u9012063@gmail.com> | 2016-07-12 11:09:31 -0700 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-07-14 07:14:21 +0000 |
commit | 67457e92666f5938ae8d77fa9f8851583d6f3366 (patch) | |
tree | b8273c2afdab0b1af535c066598e115f9dc9b0c8 | |
parent | 18e4e3cdb128798ba6efe6febb868204a0bd95e0 (diff) |
Add ERSPAN II support for field EN and Index.
Current ERSPAN II dissector does not support parsing EN field and Index.
The patch follows the field description in draft:
https://tools.ietf.org/html/draft-foschiano-erspan-01
Change-Id: I92ce56264be0fb2560c4d1a5da35738cf45a8c96
Reviewed-on: https://code.wireshark.org/review/16400
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | epan/dissectors/packet-cisco-erspan.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/epan/dissectors/packet-cisco-erspan.c b/epan/dissectors/packet-cisco-erspan.c index b925ee4f9b..c83d59a3ab 100644 --- a/epan/dissectors/packet-cisco-erspan.c +++ b/epan/dissectors/packet-cisco-erspan.c @@ -73,9 +73,10 @@ static gint ett_erspan = -1; static int hf_erspan_version = -1; static int hf_erspan_vlan = -1; static int hf_erspan_priority = -1; -static int hf_erspan_direction = -1; +static int hf_erspan_encap = -1; static int hf_erspan_truncated = -1; static int hf_erspan_spanid = -1; +static int hf_erspan_index = -1; static int hf_erspan_timestamp = -1; static int hf_erspan_direction2 = -1; @@ -104,6 +105,18 @@ static const value_string erspan_direction_vals[] = { {0, NULL}, }; +#define ERSPAN_ENCAP_00 0 +#define ERSPAN_ENCAP_01 1 +#define ERSPAN_ENCAP_10 2 +#define ERSPAN_ENCAP_11 3 +static const value_string erspan_encap_vals[] = { + {ERSPAN_ENCAP_00, "Originally without VLAN tag"}, + {ERSPAN_ENCAP_01, "Originally ISL encapsulated"}, + {ERSPAN_ENCAP_10, "Originally 802.1Q encapsulated"}, + {ERSPAN_ENCAP_11, "VLAN tag preserved in frame"}, + {0, NULL} +}; + static const value_string erspan_truncated_vals[] = { {0, "Not truncated"}, {1, "Truncated"}, @@ -170,12 +183,11 @@ dissect_erspan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ ENC_BIG_ENDIAN); if (version == 1) - proto_tree_add_item(erspan_tree, hf_erspan_direction, tvb, + proto_tree_add_item(erspan_tree, hf_erspan_encap, tvb, offset, 2, ENC_BIG_ENDIAN); - - - proto_tree_add_item(erspan_tree, hf_erspan_bso, tvb, offset, 2, - ENC_BIG_ENDIAN); + else + proto_tree_add_item(erspan_tree, hf_erspan_bso, tvb, offset, 2, + ENC_BIG_ENDIAN); proto_tree_add_item(erspan_tree, hf_erspan_truncated, tvb, offset, 2, @@ -184,6 +196,12 @@ dissect_erspan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ ENC_BIG_ENDIAN); offset += 2; + if (version == 1) { + proto_tree_add_item(erspan_tree, hf_erspan_index, tvb, + offset, 4, ENC_BIG_ENDIAN); + offset += 4; + } + if (version == 2) { proto_tree_add_item(erspan_tree, hf_erspan_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -249,9 +267,9 @@ proto_register_erspan(void) { "Priority", "erspan.priority", FT_UINT16, BASE_DEC, NULL, 0xe000, NULL, HFILL }}, - { &hf_erspan_direction, - { "Direction", "erspan.direction", FT_UINT16, BASE_DEC, VALS(erspan_direction_vals), - 0x0800, NULL, HFILL }}, + { &hf_erspan_encap, + { "Encap", "erspan.encap", FT_UINT16, BASE_DEC, VALS(erspan_encap_vals), + 0x1800, NULL, HFILL }}, { &hf_erspan_bso, { "Bad/Short/Oversized", "erspan.bso", FT_UINT16, BASE_DEC, VALS(erspan_truncated_vals), @@ -266,6 +284,10 @@ proto_register_erspan(void) { "SpanID", "erspan.spanid", FT_UINT16, BASE_DEC, NULL, 0x03ff, NULL, HFILL }}, + { &hf_erspan_index, + { "Index", "erspan.index", FT_UINT32, BASE_DEC, NULL, + 0xfffff, NULL, HFILL }}, + { &hf_erspan_timestamp, { "Timestamp", "erspan.timestamp", FT_UINT32, BASE_DEC, NULL, 0xffffffff, NULL, HFILL }}, |