PW_ACH: Use proper symbolic names

Collect all used PW Associated Channel Types and use them in the
subdissector table registrations.

Change-Id: I5d196bceefdb4560b1f4388ff86898e316e5e2ae
Reviewed-on: https://code.wireshark.org/review/18590
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Jaap Keuter 2016-10-31 08:27:14 +01:00 committed by Michael Mann
parent b61cfd7ec1
commit d7e874c5d0
10 changed files with 50 additions and 26 deletions

View File

@ -870,9 +870,9 @@ proto_reg_handoff_bfd(void)
bfd_control_handle = find_dissector("bfd");
dissector_add_uint_range_with_preference("udp.port", UDP_PORT_RANGE_BFD, bfd_control_handle);
dissector_add_uint("pwach.channel_type", ACH_TYPE_BFD_CC, bfd_control_handle);
dissector_add_uint("pwach.channel_type", ACH_TYPE_BFD_CV, bfd_control_handle);
dissector_add_uint("pwach.channel_type", 0x7, bfd_control_handle); /* PWACH-encapsulated BFD, RFC 5885 */
dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_BFD_CC, bfd_control_handle);
dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_BFD_CV, bfd_control_handle);
dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_BFD, bfd_control_handle);
}
/*

View File

@ -57,6 +57,7 @@
#include "packet-gre.h"
#include "packet-l2tp.h"
#include "packet-vxlan.h"
#include "packet-mpls.h"
#ifdef HAVE_GEOIP
#include <GeoIP.h>
@ -3162,7 +3163,7 @@ proto_reg_handoff_ip(void)
dissector_add_uint("ax25.pid", AX25_P_IP, ip_handle);
dissector_add_uint("juniper.proto", JUNIPER_PROTO_IP, ip_handle);
dissector_add_uint("juniper.proto", JUNIPER_PROTO_MPLS_IP, ip_handle);
dissector_add_uint("pwach.channel_type", 0x21, ip_handle); /* IPv4, RFC4385 clause 6. */
dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_IPV4, ip_handle);
dissector_add_uint("sflow_245.header_protocol", SFLOW_245_HEADER_IPv4, ip_handle);
dissector_add_uint("l2tp.pw_type", L2TPv3_PROTOCOL_IP, ip_handle);
dissector_add_for_decode_as_with_preference("udp.port", ip_handle);

View File

@ -52,6 +52,7 @@
#include "packet-juniper.h"
#include "packet-sflow.h"
#include "packet-vxlan.h"
#include "packet-mpls.h"
#ifdef HAVE_GEOIP_V6
#include <GeoIP.h>
@ -3565,7 +3566,7 @@ proto_reg_handoff_ipv6(void)
dissector_add_uint("arcnet.protocol_id", ARCNET_PROTO_IPv6, ipv6_handle);
dissector_add_uint("juniper.proto", JUNIPER_PROTO_IP6, ipv6_handle);
dissector_add_uint("juniper.proto", JUNIPER_PROTO_MPLS_IP6, ipv6_handle);
dissector_add_uint("pwach.channel_type", 0x57, ipv6_handle); /* IPv6, RFC4385 clause 6. */
dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_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("enc", BSD_AF_INET6_BSD, ipv6_handle);

View File

@ -2558,7 +2558,7 @@ proto_reg_handoff_mpls_echo(void)
mpls_echo_handle = create_dissector_handle(dissect_mpls_echo, proto_mpls_echo);
dissector_add_uint_with_preference("udp.port", UDP_PORT_MPLS_ECHO, mpls_echo_handle);
dissector_add_uint("pwach.channel_type", ACH_TYPE_ONDEMAND_CV, mpls_echo_handle);
dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_ONDEMAND_CV, mpls_echo_handle);
}
/*

View File

@ -30,6 +30,7 @@
#include <epan/packet.h>
#include "packet-ip.h"
#include "packet-mpls.h"
void proto_register_mpls_pm(void);
void proto_reg_handoff_mpls_pm(void);
@ -1526,17 +1527,16 @@ proto_reg_handoff_mpls_pm(void)
dissector_handle_t mpls_pm_dlm_handle, mpls_pm_ilm_handle, mpls_pm_dm_handle,
mpls_pm_dlm_dm_handle, mpls_pm_ilm_dm_handle;
mpls_pm_dlm_handle = create_dissector_handle( dissect_mpls_pm_dlm, proto_mpls_pm_dlm );
dissector_add_uint("pwach.channel_type", 0x000A, mpls_pm_dlm_handle); /* FF: MPLS PM, RFC 6374, DLM */
mpls_pm_ilm_handle = create_dissector_handle( dissect_mpls_pm_ilm, proto_mpls_pm_ilm );
dissector_add_uint("pwach.channel_type", 0x000B, mpls_pm_ilm_handle); /* FF: MPLS PM, RFC 6374, ILM */
mpls_pm_dm_handle = create_dissector_handle( dissect_mpls_pm_delay, proto_mpls_pm_dm );
dissector_add_uint("pwach.channel_type", 0x000C, mpls_pm_dm_handle); /* FF: MPLS PM, RFC 6374, DM */
mpls_pm_dlm_dm_handle = create_dissector_handle( dissect_mpls_pm_dlm_dm, proto_mpls_pm_dlm_dm );
dissector_add_uint("pwach.channel_type", 0x000D, mpls_pm_dlm_dm_handle); /* FF: MPLS PM, RFC 6374, DLM+DM */
mpls_pm_ilm_dm_handle = create_dissector_handle( dissect_mpls_pm_ilm_dm, proto_mpls_pm_ilm_dm );
dissector_add_uint("pwach.channel_type", 0x000E, mpls_pm_ilm_dm_handle); /* FF: MPLS PM, RFC 6374, ILM+DM */
mpls_pm_dlm_handle = create_dissector_handle( dissect_mpls_pm_dlm, proto_mpls_pm_dlm );
dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_DLM, mpls_pm_dlm_handle);
mpls_pm_ilm_handle = create_dissector_handle( dissect_mpls_pm_ilm, proto_mpls_pm_ilm );
dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_ILM, mpls_pm_ilm_handle);
mpls_pm_dm_handle = create_dissector_handle( dissect_mpls_pm_delay, proto_mpls_pm_dm );
dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_DM, mpls_pm_dm_handle);
mpls_pm_dlm_dm_handle = create_dissector_handle( dissect_mpls_pm_dlm_dm, proto_mpls_pm_dlm_dm );
dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_DLM_DM, mpls_pm_dlm_dm_handle);
mpls_pm_ilm_dm_handle = create_dissector_handle( dissect_mpls_pm_ilm_dm, proto_mpls_pm_ilm_dm );
dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_ILM_DM, mpls_pm_ilm_dm_handle);
}
/*

View File

@ -29,6 +29,7 @@
#include "config.h"
#include <epan/packet.h>
#include "packet-mpls.h"
void proto_register_mpls_psc(void);
void proto_reg_handoff_mpls_psc(void);
@ -241,7 +242,7 @@ proto_reg_handoff_mpls_psc(void)
dissector_handle_t mpls_psc_handle;
mpls_psc_handle = create_dissector_handle( dissect_mpls_psc, proto_mpls_psc );
dissector_add_uint("pwach.channel_type", 0x0024, mpls_psc_handle); /* FF: PSC, RFC 6378 */
dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_PSC, mpls_psc_handle);
}
/*

View File

@ -292,7 +292,7 @@ dissect_pw_ach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
call_data_dissector(next_tvb, pinfo, tree);
}
if (channel_type == ACH_TYPE_BFD_CV)
if (channel_type == PW_ACH_TYPE_BFD_CV)
{
/* The BFD dissector has already been called, this is called in addition
XXX - Perhaps a new dissector function that combines both is preferred.*/

View File

@ -42,11 +42,30 @@ enum {
MPLS_LABEL_INVALID = -1
};
/* As per RFC 6428 http://tools.ietf.org/html/rfc6428, Section: 3.3 */
#define ACH_TYPE_BFD_CC 0x0022
#define ACH_TYPE_BFD_CV 0x0023
/* As RFC 6426:http://tools.ietf.org/html/rfc6426, Section: 7.4 */
#define ACH_TYPE_ONDEMAND_CV 0x0025
/* As per RFC 5885 */
#define PW_ACH_TYPE_BFD 0x0007
/* As per RFC 6374 */
#define PW_ACH_TYPE_DLM 0x000A
#define PW_ACH_TYPE_ILM 0x000B
#define PW_ACH_TYPE_DM 0x000C
#define PW_ACH_TYPE_DLM_DM 0x000D
#define PW_ACH_TYPE_ILM_DM 0x000E
/* As per RFC 4385 clause 6 */
#define PW_ACH_TYPE_IPV4 0x0021
/* As per RFC 6428 Section 3.3 */
#define PW_ACH_TYPE_BFD_CC 0x0022
#define PW_ACH_TYPE_BFD_CV 0x0023
/* As per RFC 6378 */
#define PW_ACH_TYPE_PSC 0x0024
/* As per RFC 6426 Section 7.4 */
#define PW_ACH_TYPE_ONDEMAND_CV 0x0025
/* As per RFC 6478 */
#define PW_ACH_TYPE_PW_OAM 0x0027
/* As per RFC 4385 clause 6 */
#define PW_ACH_TYPE_IPV6 0x0057
/* As per RFC 6427 */
#define PW_ACH_TYPE_MPLSTP_FM 0x0058
/* MPLS over UDP http://tools.ietf.org/html/draft-ietf-mpls-in-udp-11,
* udp destination port as defined in

View File

@ -29,6 +29,7 @@
#include "config.h"
#include <epan/packet.h>
#include "packet-bfd.h"
#include "packet-mpls.h"
void proto_register_mplstp_lock(void);
void proto_register_mplstp_fm(void);
@ -344,7 +345,7 @@ proto_reg_handoff_mplstp_fm(void)
dissector_handle_t mplstp_fm_handle;
mplstp_fm_handle = create_dissector_handle( dissect_mplstp_fm, proto_mplstp_fm );
dissector_add_uint("pwach.channel_type", 0x0058, mplstp_fm_handle); /* KM: MPLSTP FM, RFC 6427 */
dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_MPLSTP_FM, mplstp_fm_handle);
}
/*

View File

@ -26,6 +26,7 @@
#include "config.h"
#include <epan/packet.h>
#include "packet-mpls.h"
void proto_register_pw_oam(void);
void proto_reg_handoff_pw_oam(void);
@ -207,7 +208,7 @@ proto_reg_handoff_pw_oam(void)
dissector_handle_t pw_oam_handle;
pw_oam_handle = create_dissector_handle( dissect_pw_oam, proto_pw_oam );
dissector_add_uint("pwach.channel_type", 0x0027, pw_oam_handle); /* KM: MPLSTP PW-OAM, RFC 6478 */
dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_PW_OAM, pw_oam_handle);
}
/*