VXLAN: use the newly created vxlan.next_proto dissector table everywhere
Change-Id: Ib6f44e0f1d3d8c76d2b6e6c778af8c243af4389c Reviewed-on: https://code.wireshark.org/review/16543 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
0da9995358
commit
d75de9f755
|
@ -1752,6 +1752,7 @@ DISSECTOR_INCLUDES = \
|
||||||
packet-usb.h \
|
packet-usb.h \
|
||||||
packet-usb-hid.h \
|
packet-usb-hid.h \
|
||||||
packet-usbip.h \
|
packet-usbip.h \
|
||||||
|
packet-vxlan.h \
|
||||||
packet-wap.h \
|
packet-wap.h \
|
||||||
packet-wccp.h \
|
packet-wccp.h \
|
||||||
packet-windows-common.h \
|
packet-windows-common.h \
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "packet-juniper.h"
|
#include "packet-juniper.h"
|
||||||
#include "packet-sflow.h"
|
#include "packet-sflow.h"
|
||||||
#include "packet-l2tp.h"
|
#include "packet-l2tp.h"
|
||||||
|
#include "packet-vxlan.h"
|
||||||
#include <epan/crc32-tvb.h>
|
#include <epan/crc32-tvb.h>
|
||||||
#include <wiretap/erf.h>
|
#include <wiretap/erf.h>
|
||||||
|
|
||||||
|
@ -1064,7 +1065,7 @@ proto_reg_handoff_eth(void)
|
||||||
dissector_add_uint("juniper.proto", JUNIPER_PROTO_ETHER, eth_withoutfcs_handle);
|
dissector_add_uint("juniper.proto", JUNIPER_PROTO_ETHER, eth_withoutfcs_handle);
|
||||||
dissector_add_uint("sflow_245.header_protocol", SFLOW_245_HEADER_ETHERNET, eth_withoutfcs_handle);
|
dissector_add_uint("sflow_245.header_protocol", SFLOW_245_HEADER_ETHERNET, eth_withoutfcs_handle);
|
||||||
dissector_add_uint("l2tp.pw_type", L2TPv3_PROTOCOL_ETH, eth_withoutfcs_handle);
|
dissector_add_uint("l2tp.pw_type", L2TPv3_PROTOCOL_ETH, eth_withoutfcs_handle);
|
||||||
|
dissector_add_uint("vxlan.next_proto", VXLAN_ETHERNET, eth_withoutfcs_handle);
|
||||||
dissector_add_uint("sll.ltype", LINUX_SLL_P_ETHERNET, eth_withoutfcs_handle);
|
dissector_add_uint("sll.ltype", LINUX_SLL_P_ETHERNET, eth_withoutfcs_handle);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#include "packet-sflow.h"
|
#include "packet-sflow.h"
|
||||||
#include "packet-gre.h"
|
#include "packet-gre.h"
|
||||||
#include "packet-l2tp.h"
|
#include "packet-l2tp.h"
|
||||||
|
#include "packet-vxlan.h"
|
||||||
|
|
||||||
#ifdef HAVE_GEOIP
|
#ifdef HAVE_GEOIP
|
||||||
#include <GeoIP.h>
|
#include <GeoIP.h>
|
||||||
|
@ -3205,6 +3206,7 @@ proto_reg_handoff_ip(void)
|
||||||
dissector_add_for_decode_as("pcli.payload", ip_handle);
|
dissector_add_for_decode_as("pcli.payload", ip_handle);
|
||||||
dissector_add_uint("wtap_encap", WTAP_ENCAP_RAW_IP4, ip_handle);
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_RAW_IP4, ip_handle);
|
||||||
dissector_add_uint("enc", BSD_AF_INET, ip_handle);
|
dissector_add_uint("enc", BSD_AF_INET, ip_handle);
|
||||||
|
dissector_add_uint("vxlan.next_proto", VXLAN_IPV4, ip_handle);
|
||||||
|
|
||||||
heur_dissector_add("tipc", dissect_ip_heur, "IP over TIPC", "ip_tipc", proto_ip, HEURISTIC_ENABLE);
|
heur_dissector_add("tipc", dissect_ip_heur, "IP over TIPC", "ip_tipc", proto_ip, HEURISTIC_ENABLE);
|
||||||
register_capture_dissector("ethertype", ETHERTYPE_IP, capture_ip, proto_ip);
|
register_capture_dissector("ethertype", ETHERTYPE_IP, capture_ip, proto_ip);
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include "packet-ip.h"
|
#include "packet-ip.h"
|
||||||
#include "packet-juniper.h"
|
#include "packet-juniper.h"
|
||||||
#include "packet-sflow.h"
|
#include "packet-sflow.h"
|
||||||
|
#include "packet-vxlan.h"
|
||||||
|
|
||||||
#ifdef HAVE_GEOIP_V6
|
#ifdef HAVE_GEOIP_V6
|
||||||
#include <GeoIP.h>
|
#include <GeoIP.h>
|
||||||
|
@ -3232,6 +3233,7 @@ proto_reg_handoff_ipv6(void)
|
||||||
dissector_add_uint("sflow_245.header_protocol", SFLOW_245_HEADER_IPv6, ipv6_handle);
|
dissector_add_uint("sflow_245.header_protocol", SFLOW_245_HEADER_IPv6, ipv6_handle);
|
||||||
dissector_add_uint("wtap_encap", WTAP_ENCAP_RAW_IP6, ipv6_handle);
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_RAW_IP6, ipv6_handle);
|
||||||
dissector_add_uint("enc", BSD_AF_INET6_BSD, ipv6_handle);
|
dissector_add_uint("enc", BSD_AF_INET6_BSD, ipv6_handle);
|
||||||
|
dissector_add_uint("vxlan.next_proto", VXLAN_IPV6, ipv6_handle);
|
||||||
|
|
||||||
dissector_add_for_decode_as("udp.port", ipv6_handle);
|
dissector_add_for_decode_as("udp.port", ipv6_handle);
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
#include "packet-juniper.h"
|
#include "packet-juniper.h"
|
||||||
#include "packet-sflow.h"
|
#include "packet-sflow.h"
|
||||||
#include "packet-l2tp.h"
|
#include "packet-l2tp.h"
|
||||||
|
#include "packet-vxlan.h"
|
||||||
|
|
||||||
void proto_register_mpls(void);
|
void proto_register_mpls(void);
|
||||||
void proto_reg_handoff_mpls(void);
|
void proto_reg_handoff_mpls(void);
|
||||||
|
@ -645,6 +646,7 @@ proto_reg_handoff_mpls(void)
|
||||||
dissector_add_uint("sflow_245.header_protocol", SFLOW_245_HEADER_MPLS, mpls_handle);
|
dissector_add_uint("sflow_245.header_protocol", SFLOW_245_HEADER_MPLS, mpls_handle);
|
||||||
dissector_add_uint("l2tp.pw_type", L2TPv3_PROTOCOL_MPLS, mpls_handle);
|
dissector_add_uint("l2tp.pw_type", L2TPv3_PROTOCOL_MPLS, mpls_handle);
|
||||||
dissector_add_uint("udp.port", UDP_PORT_MPLS_OVER_UDP, mpls_handle);
|
dissector_add_uint("udp.port", UDP_PORT_MPLS_OVER_UDP, mpls_handle);
|
||||||
|
dissector_add_uint("vxlan.next_proto", VXLAN_MPLS, mpls_handle);
|
||||||
|
|
||||||
mpls_pwcw_handle = create_dissector_handle( dissect_pw_mcw, proto_pw_mcw );
|
mpls_pwcw_handle = create_dissector_handle( dissect_pw_mcw, proto_pw_mcw );
|
||||||
dissector_add_uint( "mpls.label", MPLS_LABEL_INVALID, mpls_pwcw_handle );
|
dissector_add_uint( "mpls.label", MPLS_LABEL_INVALID, mpls_pwcw_handle );
|
||||||
|
|
|
@ -34,10 +34,10 @@
|
||||||
#include <epan/prefs.h>
|
#include <epan/prefs.h>
|
||||||
#include <epan/ipproto.h>
|
#include <epan/ipproto.h>
|
||||||
#include <epan/decode_as.h>
|
#include <epan/decode_as.h>
|
||||||
|
#include "packet-vxlan.h"
|
||||||
|
|
||||||
#define MD_TYPE_1 1
|
#define MD_TYPE_1 1
|
||||||
#define MD_TYPE_2 2
|
#define MD_TYPE_2 2
|
||||||
#define VXLAN_NSH 4
|
|
||||||
|
|
||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
void proto_reg_handoff_nsh(void);
|
void proto_reg_handoff_nsh(void);
|
||||||
|
|
|
@ -29,14 +29,10 @@
|
||||||
|
|
||||||
#include <epan/packet.h>
|
#include <epan/packet.h>
|
||||||
#include <epan/tfs.h>
|
#include <epan/tfs.h>
|
||||||
|
#include "packet-vxlan.h"
|
||||||
|
|
||||||
#define UDP_PORT_VXLAN 4789
|
#define UDP_PORT_VXLAN 4789
|
||||||
#define UDP_PORT_VXLAN_GPE 4790
|
#define UDP_PORT_VXLAN_GPE 4790
|
||||||
#define VXLAN_IPV4 1
|
|
||||||
#define VXLAN_IPV6 2
|
|
||||||
#define VXLAN_ETHERNET 3
|
|
||||||
#define VXLAN_NSH 4
|
|
||||||
#define VXLAN_MPLS 5
|
|
||||||
|
|
||||||
void proto_register_vxlan(void);
|
void proto_register_vxlan(void);
|
||||||
void proto_reg_handoff_vxlan(void);
|
void proto_reg_handoff_vxlan(void);
|
||||||
|
@ -93,10 +89,6 @@ static const value_string vxlan_next_protocols[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static dissector_handle_t eth_handle;
|
static dissector_handle_t eth_handle;
|
||||||
static dissector_handle_t ip_handle;
|
|
||||||
static dissector_handle_t ipv6_handle;
|
|
||||||
static dissector_handle_t nsh_handle;
|
|
||||||
static dissector_handle_t mpls_handle;
|
|
||||||
static dissector_table_t vxlan_dissector_table;
|
static dissector_table_t vxlan_dissector_table;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -106,7 +98,7 @@ dissect_vxlan_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int is
|
||||||
proto_item *ti;
|
proto_item *ti;
|
||||||
tvbuff_t *next_tvb;
|
tvbuff_t *next_tvb;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int vxlan_next_proto=-1;
|
guint32 vxlan_next_proto;
|
||||||
|
|
||||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "VxLAN");
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "VxLAN");
|
||||||
col_clear(pinfo->cinfo, COL_INFO);
|
col_clear(pinfo->cinfo, COL_INFO);
|
||||||
|
@ -122,8 +114,7 @@ dissect_vxlan_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int is
|
||||||
proto_tree_add_item(vxlan_tree, hf_vxlan_gpe_reserved_16, tvb, offset, 2, ENC_BIG_ENDIAN);
|
proto_tree_add_item(vxlan_tree, hf_vxlan_gpe_reserved_16, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
|
|
||||||
proto_tree_add_item(vxlan_tree, hf_vxlan_next_proto, tvb, offset, 1, ENC_BIG_ENDIAN);
|
proto_tree_add_item_ret_uint(vxlan_tree, hf_vxlan_next_proto, tvb, offset, 1, ENC_BIG_ENDIAN, &vxlan_next_proto);
|
||||||
vxlan_next_proto = tvb_get_guint8(tvb, offset);
|
|
||||||
offset += 1;
|
offset += 1;
|
||||||
} else {
|
} else {
|
||||||
proto_tree_add_bitmask(vxlan_tree, tvb, offset, hf_vxlan_flags, ett_vxlan_flags, flags_fields, ENC_BIG_ENDIAN);
|
proto_tree_add_bitmask(vxlan_tree, tvb, offset, hf_vxlan_flags, ett_vxlan_flags, flags_fields, ENC_BIG_ENDIAN);
|
||||||
|
@ -142,32 +133,8 @@ dissect_vxlan_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int is
|
||||||
next_tvb = tvb_new_subset_remaining(tvb, offset);
|
next_tvb = tvb_new_subset_remaining(tvb, offset);
|
||||||
|
|
||||||
if(is_gpe){
|
if(is_gpe){
|
||||||
switch(vxlan_next_proto){
|
if(!dissector_try_uint(vxlan_dissector_table, vxlan_next_proto, next_tvb, pinfo, tree)) {
|
||||||
|
|
||||||
case VXLAN_IPV4 :
|
|
||||||
call_dissector(ip_handle, next_tvb, pinfo, tree);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VXLAN_IPV6 :
|
|
||||||
call_dissector(ipv6_handle, next_tvb, pinfo, tree);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VXLAN_ETHERNET :
|
|
||||||
call_dissector(eth_handle, next_tvb, pinfo, tree);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VXLAN_NSH :
|
|
||||||
if(!dissector_try_uint(vxlan_dissector_table, VXLAN_NSH, next_tvb, pinfo, tree))
|
|
||||||
call_data_dissector(next_tvb, pinfo, vxlan_tree);
|
call_data_dissector(next_tvb, pinfo, vxlan_tree);
|
||||||
break;
|
|
||||||
|
|
||||||
case VXLAN_MPLS :
|
|
||||||
call_dissector(mpls_handle, next_tvb, pinfo, tree);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
call_data_dissector(next_tvb, pinfo, vxlan_tree);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
call_dissector(eth_handle, next_tvb, pinfo, tree);
|
call_dissector(eth_handle, next_tvb, pinfo, tree);
|
||||||
|
@ -336,10 +303,6 @@ proto_reg_handoff_vxlan(void)
|
||||||
* FCS.
|
* FCS.
|
||||||
*/
|
*/
|
||||||
eth_handle = find_dissector_add_dependency("eth_withoutfcs", proto_vxlan);
|
eth_handle = find_dissector_add_dependency("eth_withoutfcs", proto_vxlan);
|
||||||
ip_handle = find_dissector_add_dependency("ip", proto_vxlan);
|
|
||||||
ipv6_handle = find_dissector_add_dependency("ipv6", proto_vxlan);
|
|
||||||
nsh_handle = find_dissector_add_dependency("nsh", proto_vxlan);
|
|
||||||
mpls_handle = find_dissector_add_dependency("mpls", proto_vxlan);
|
|
||||||
|
|
||||||
vxlan_handle = create_dissector_handle(dissect_vxlan, proto_vxlan);
|
vxlan_handle = create_dissector_handle(dissect_vxlan, proto_vxlan);
|
||||||
vxlan_gpe_handle = create_dissector_handle(dissect_vxlan_gpe, proto_vxlan_gpe);
|
vxlan_gpe_handle = create_dissector_handle(dissect_vxlan_gpe, proto_vxlan_gpe);
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/* packet-vxlan.h
|
||||||
|
*
|
||||||
|
* Routines for Virtual eXtensible Local Area Network (VXLAN) packet dissection
|
||||||
|
* RFC 7348 plus draft-smith-vxlan-group-policy-01
|
||||||
|
*
|
||||||
|
* (c) Copyright 2016, Sumit Kumar Jha <sjha3@ncsu.edu>
|
||||||
|
* Support for VXLAN GPE (https://www.ietf.org/id/draft-ietf-nvo3-vxlan-gpe-02.txt)
|
||||||
|
*
|
||||||
|
* Wireshark - Network traffic analyzer
|
||||||
|
* By Gerald Combs <gerald@wireshark.org>
|
||||||
|
* Copyright 1998 Gerald Combs
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __PACKET_VXLAN_H__
|
||||||
|
#define __PACKET_VXLAN_H__
|
||||||
|
|
||||||
|
#define VXLAN_IPV4 1
|
||||||
|
#define VXLAN_IPV6 2
|
||||||
|
#define VXLAN_ETHERNET 3
|
||||||
|
#define VXLAN_NSH 4
|
||||||
|
#define VXLAN_MPLS 5
|
||||||
|
|
||||||
|
#endif /* __PACKET_VXLAN_H__ */
|
Loading…
Reference in New Issue