diff options
Diffstat (limited to 'epan/dissectors/packet-vxlan.c')
-rw-r--r-- | epan/dissectors/packet-vxlan.c | 101 |
1 files changed, 41 insertions, 60 deletions
diff --git a/epan/dissectors/packet-vxlan.c b/epan/dissectors/packet-vxlan.c index d7ea55691f..ddadf99a58 100644 --- a/epan/dissectors/packet-vxlan.c +++ b/epan/dissectors/packet-vxlan.c @@ -28,6 +28,7 @@ #include "config.h" #include <epan/packet.h> +#include <epan/tfs.h> #define UDP_PORT_VXLAN 4789 @@ -37,15 +38,12 @@ void proto_reg_handoff_vxlan(void); static int proto_vxlan = -1; static int hf_vxlan_flags = -1; -static int hf_vxlan_flag_b7 = -1; -static int hf_vxlan_flag_b6 = -1; -static int hf_vxlan_flag_b5 = -1; -static int hf_vxlan_flag_b4 = -1; +static int hf_vxlan_flags_reserved = -1; +static int hf_vxlan_flag_a = -1; +static int hf_vxlan_flag_d = -1; static int hf_vxlan_flag_i = -1; -static int hf_vxlan_flag_b2 = -1; -static int hf_vxlan_flag_b1 = -1; -static int hf_vxlan_flag_b0 = -1; -static int hf_vxlan_reserved_24 = -1; +static int hf_vxlan_flag_g = -1; +static int hf_vxlan_gbp = -1; static int hf_vxlan_vni = -1; static int hf_vxlan_reserved_8 = -1; @@ -53,6 +51,14 @@ static int hf_vxlan_reserved_8 = -1; static int ett_vxlan = -1; static int ett_vxlan_flgs = -1; +static const int *flags_fields[] = { + &hf_vxlan_flag_g, + &hf_vxlan_flag_d, + &hf_vxlan_flag_i, + &hf_vxlan_flag_a, + &hf_vxlan_flags_reserved, + NULL + }; static dissector_handle_t eth_handle; @@ -77,31 +83,24 @@ dissect_vxlan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 VXLAN Header: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - |R|R|R|R|I|R|R|R| Reserved | + |G|R|R|R|I|R|R|R|R|D|R|R|A|R|R|R| Group Policy ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | VXLAN Network Identifier (VNI) | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ - /* Flags (8 bits) where the I flag MUST be set to 1 for a valid - * VXLAN Network ID (VNI). The remaining 7 bits (designated "R") are + /* Flags (16 bits) where the I flag MUST be set to 1 for a valid + * VXLAN Network ID (VNI). The remaining 12 bits (designated "R") are * reserved fields and MUST be set to zero. */ - flg_item = proto_tree_add_item(vxlan_tree, hf_vxlan_flags, tvb, offset, 1, ENC_BIG_ENDIAN); + flg_item = proto_tree_add_item(vxlan_tree, hf_vxlan_flags, tvb, offset, 2, ENC_BIG_ENDIAN); flg_tree = proto_item_add_subtree(flg_item, ett_vxlan_flgs); - proto_tree_add_item(flg_tree, hf_vxlan_flag_b7, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(flg_tree, hf_vxlan_flag_b6, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(flg_tree, hf_vxlan_flag_b5, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(flg_tree, hf_vxlan_flag_b4, tvb, offset, 1, ENC_BIG_ENDIAN); - - proto_tree_add_item(flg_tree, hf_vxlan_flag_i, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(flg_tree, hf_vxlan_flag_b2, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(flg_tree, hf_vxlan_flag_b1, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(flg_tree, hf_vxlan_flag_b0, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; + proto_tree_add_bitmask(flg_tree, tvb, offset, hf_vxlan_flags, + ett_vxlan_flgs, flags_fields, ENC_BIG_ENDIAN); + offset+=2; - proto_tree_add_item(vxlan_tree, hf_vxlan_reserved_24, tvb, offset, 3, ENC_BIG_ENDIAN); - offset+=3; + proto_tree_add_item(vxlan_tree, hf_vxlan_gbp, tvb, offset, 2, ENC_BIG_ENDIAN); + offset+=2; proto_tree_add_item(vxlan_tree, hf_vxlan_vni, tvb, offset, 3, ENC_BIG_ENDIAN); offset+=3; @@ -123,61 +122,43 @@ proto_register_vxlan(void) static hf_register_info hf[] = { { &hf_vxlan_flags, { "Flags", "vxlan.flags", - FT_UINT8, BASE_HEX, NULL, 0x00, + FT_UINT16, BASE_HEX, NULL, 0x00, NULL, HFILL }, }, - { &hf_vxlan_flag_b7, - { "Reserved(R)", "vxlan.flag_b7", - FT_BOOLEAN, 8, NULL, 0x80, - NULL, HFILL, - }, - }, - { &hf_vxlan_flag_b6, - { "Reserved(R)", "vxlan.flag_b6", - FT_BOOLEAN, 8, NULL, 0x40, + { &hf_vxlan_flags_reserved, + { "Reserved(R)", "vxlan.flags_reserved", + FT_BOOLEAN, 16, NULL, 0x77b7, NULL, HFILL, }, }, - { &hf_vxlan_flag_b5, - { "Reserved(R)", "vxlan.flag_b5", - FT_BOOLEAN, 8, NULL, 0x20, - NULL, HFILL, - }, - }, - { &hf_vxlan_flag_b4, - { "Reserved(R)", "vxlan.flag_b4", - FT_BOOLEAN, 8, NULL, 0x10, + { &hf_vxlan_flag_g, + { "GBP Extension", "vxlan.flag_g", + FT_BOOLEAN, 16, TFS(&tfs_defined_not_defined), 0x8000, NULL, HFILL, }, }, { &hf_vxlan_flag_i, - { "VXLAN Network ID(VNI)", "vxlan.flag_i", - FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08, - NULL, HFILL, - }, - }, - { &hf_vxlan_flag_b2, - { "Reserved(R)", "vxlan.flag_b2", - FT_BOOLEAN, 8, NULL, 0x04, + { "VXLAN Network ID (VNI)", "vxlan.flag_i", + FT_BOOLEAN, 16, NULL, 0x0800, NULL, HFILL, }, }, - { &hf_vxlan_flag_b1, - { "Reserved(R)", "vxlan.flag_b1", - FT_BOOLEAN, 8, NULL, 0x02, + { &hf_vxlan_flag_d, + { "Don't Learn", "vxlan.flag_d", + FT_BOOLEAN, 16, NULL, 0x0040, NULL, HFILL, }, }, - { &hf_vxlan_flag_b0, - { "Reserved(R)", "vxlan.flag_b0", - FT_BOOLEAN, 8, NULL, 0x01, + { &hf_vxlan_flag_a, + { "Policy Applied", "vxlan.flag_a", + FT_BOOLEAN, 16, NULL, 0x0008, NULL, HFILL, }, }, - { &hf_vxlan_reserved_24, - { "Reserved", "vxlan.reserved24", - FT_UINT24, BASE_HEX, NULL, 0x00, + { &hf_vxlan_gbp, + { "Group Policy ID", "vxlan.gbp", + FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }, }, |