forked from osmocom/wireshark
Add subdissector table for MPLS PW Associated Channel Type
Change-Id: Id72fcbe74b91b4eb25fb4d3f3d47a1d53c2857b2 Reviewed-on: https://code.wireshark.org/review/5212 Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
3924310d86
commit
055e4768ec
|
@ -40,6 +40,7 @@
|
|||
#include <epan/expert.h>
|
||||
|
||||
#include "packet-bfd.h"
|
||||
#include "packet-mpls.h"
|
||||
|
||||
void proto_register_bfd(void);
|
||||
void proto_reg_handoff_bfd(void);
|
||||
|
@ -923,6 +924,10 @@ proto_reg_handoff_bfd(void)
|
|||
bfd_control_handle = find_dissector("bfd");
|
||||
dissector_add_uint("udp.port", UDP_PORT_BFD_1HOP_CONTROL, bfd_control_handle);
|
||||
dissector_add_uint("udp.port", UDP_PORT_BFD_MULTIHOP_CONTROL, 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 */
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -3106,6 +3106,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_for_decode_as("udp.port", ip_handle);
|
||||
|
||||
heur_dissector_add("tipc", dissect_ip_heur, proto_ip);
|
||||
|
|
|
@ -3040,6 +3040,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. */
|
||||
|
||||
ipv6_hopopts_handle = new_create_dissector_handle(dissect_hopopts, proto_ipv6_hopopts );
|
||||
dissector_add_uint("ipv6.nxt", IP_PROTO_HOPOPTS, ipv6_hopopts_handle);
|
||||
|
|
|
@ -2564,6 +2564,8 @@ proto_reg_handoff_mpls_echo(void)
|
|||
|
||||
mpls_echo_udp_port = global_mpls_echo_udp_port;
|
||||
dissector_add_uint("udp.port", global_mpls_echo_udp_port, mpls_echo_handle);
|
||||
|
||||
dissector_add_uint("pwach.channel_type", ACH_TYPE_ONDEMAND_CV, mpls_echo_handle);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -111,12 +111,6 @@ static int hf_mpls_pm_timestamp4_r_ntp = -1;
|
|||
static int hf_mpls_pm_timestamp4_r_ptp = -1;
|
||||
static int hf_mpls_pm_timestamp4_unk = -1;
|
||||
|
||||
static dissector_handle_t mpls_pm_dlm_handle;
|
||||
static dissector_handle_t mpls_pm_ilm_handle;
|
||||
static dissector_handle_t mpls_pm_dm_handle;
|
||||
static dissector_handle_t mpls_pm_dlm_dm_handle;
|
||||
static dissector_handle_t mpls_pm_ilm_dm_handle;
|
||||
|
||||
/*
|
||||
* FF: please keep this list in sync with
|
||||
* http://www.iana.org/assignments/mpls-lsp-ping-parameters
|
||||
|
@ -1383,31 +1377,25 @@ proto_register_mpls_pm(void)
|
|||
|
||||
proto_register_field_array(proto_mpls_pm_dlm, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
register_dissector("mpls_pm_dlm", dissect_mpls_pm_dlm,
|
||||
proto_mpls_pm_dlm);
|
||||
|
||||
register_dissector("mpls_pm_ilm", dissect_mpls_pm_ilm,
|
||||
proto_mpls_pm_ilm);
|
||||
|
||||
register_dissector("mpls_pm_dm", dissect_mpls_pm_delay,
|
||||
proto_mpls_pm_dm);
|
||||
|
||||
register_dissector("mpls_pm_dlm_dm", dissect_mpls_pm_dlm_dm,
|
||||
proto_mpls_pm_dlm_dm);
|
||||
|
||||
register_dissector("mpls_pm_ilm_dm", dissect_mpls_pm_ilm_dm,
|
||||
proto_mpls_pm_ilm_dm);
|
||||
}
|
||||
|
||||
void
|
||||
proto_reg_handoff_mpls_pm(void)
|
||||
{
|
||||
mpls_pm_dlm_handle = find_dissector("mpls_pm_dlm");
|
||||
mpls_pm_ilm_handle = find_dissector("mpls_pm_ilm");
|
||||
mpls_pm_dm_handle = find_dissector("mpls_pm_dm");
|
||||
mpls_pm_dlm_dm_handle = find_dissector("mpls_pm_dlm_dm");
|
||||
mpls_pm_ilm_dm_handle = find_dissector("mpls_pm_ilm_dm");
|
||||
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 */
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -234,8 +234,15 @@ proto_register_mpls_psc(void)
|
|||
|
||||
proto_register_field_array(proto_mpls_psc, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
}
|
||||
|
||||
register_dissector("mpls_psc", dissect_mpls_psc, proto_mpls_psc);
|
||||
void
|
||||
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 */
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -68,12 +68,6 @@
|
|||
void proto_register_mpls(void);
|
||||
void proto_reg_handoff_mpls(void);
|
||||
|
||||
/* 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
|
||||
|
||||
static gint proto_mpls = -1;
|
||||
static gint proto_pw_ach = -1;
|
||||
static gint proto_pw_mcw = -1;
|
||||
|
@ -93,19 +87,11 @@ const value_string special_labels[] = {
|
|||
{0, NULL }
|
||||
};
|
||||
|
||||
static dissector_table_t pw_ach_subdissector_table;
|
||||
|
||||
static dissector_handle_t dissector_data;
|
||||
static dissector_handle_t dissector_ipv6;
|
||||
static dissector_handle_t dissector_ip;
|
||||
static dissector_handle_t dissector_bfd;
|
||||
static dissector_handle_t dissector_mpls_pm_dlm;
|
||||
static dissector_handle_t dissector_mpls_pm_ilm;
|
||||
static dissector_handle_t dissector_mpls_pm_dm;
|
||||
static dissector_handle_t dissector_mpls_pm_dlm_dm;
|
||||
static dissector_handle_t dissector_mpls_pm_ilm_dm;
|
||||
static dissector_handle_t dissector_mpls_psc;
|
||||
static dissector_handle_t dissector_mplstp_lock;
|
||||
static dissector_handle_t dissector_mplstp_fm;
|
||||
static dissector_handle_t dissector_pw_oam;
|
||||
static dissector_handle_t dissector_pw_eth_heuristic;
|
||||
static dissector_handle_t dissector_pw_fr;
|
||||
static dissector_handle_t dissector_pw_hdlc_nocw_fr;
|
||||
|
@ -397,71 +383,16 @@ dissect_pw_ach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
next_tvb = tvb_new_subset_remaining(tvb, 4);
|
||||
|
||||
switch (channel_type) {
|
||||
case ACH_TYPE_BFD_CC:
|
||||
call_dissector(dissector_bfd, next_tvb, pinfo, tree); /* bfd_control() */
|
||||
break;
|
||||
if (!dissector_try_uint(pw_ach_subdissector_table, channel_type, next_tvb, pinfo, tree))
|
||||
{
|
||||
call_dissector(dissector_data, next_tvb, pinfo, tree);
|
||||
}
|
||||
|
||||
case ACH_TYPE_BFD_CV:
|
||||
call_dissector(dissector_bfd, next_tvb, pinfo, tree); /* bfd_control() */
|
||||
dissect_bfd_mep(next_tvb, tree, 0);
|
||||
break;
|
||||
|
||||
case ACH_TYPE_ONDEMAND_CV:
|
||||
dissect_mpls_echo(next_tvb, pinfo, tree, NULL);
|
||||
break;
|
||||
|
||||
case 0x21: /* IPv4, RFC4385 clause 6. */
|
||||
call_dissector(dissector_ip, next_tvb, pinfo, tree);
|
||||
break;
|
||||
|
||||
case 0x7: /* PWACH-encapsulated BFD, RFC 5885 */
|
||||
call_dissector(dissector_bfd, next_tvb, pinfo, tree);
|
||||
break;
|
||||
|
||||
case 0x57: /* IPv6, RFC4385 clause 6. */
|
||||
call_dissector(dissector_ipv6, next_tvb, pinfo, tree);
|
||||
break;
|
||||
|
||||
case 0x000A: /* FF: MPLS PM, RFC 6374, DLM */
|
||||
call_dissector(dissector_mpls_pm_dlm, next_tvb, pinfo, tree);
|
||||
break;
|
||||
|
||||
case 0x000B: /* FF: MPLS PM, RFC 6374, ILM */
|
||||
call_dissector(dissector_mpls_pm_ilm, next_tvb, pinfo, tree);
|
||||
break;
|
||||
|
||||
case 0x000C: /* FF: MPLS PM, RFC 6374, DM */
|
||||
call_dissector(dissector_mpls_pm_dm, next_tvb, pinfo, tree);
|
||||
break;
|
||||
|
||||
case 0x000D: /* FF: MPLS PM, RFC 6374, DLM+DM */
|
||||
call_dissector(dissector_mpls_pm_dlm_dm, next_tvb, pinfo, tree);
|
||||
break;
|
||||
|
||||
case 0x000E: /* FF: MPLS PM, RFC 6374, ILM+DM */
|
||||
call_dissector(dissector_mpls_pm_ilm_dm, next_tvb, pinfo, tree);
|
||||
break;
|
||||
|
||||
case 0x0024: /* FF: PSC, RFC 6378 */
|
||||
call_dissector(dissector_mpls_psc, next_tvb, pinfo, tree);
|
||||
break;
|
||||
|
||||
case 0x0026: /* KM: MPLSTP LOCK, RFC 6435 */
|
||||
call_dissector(dissector_mplstp_lock, next_tvb, pinfo, tree);
|
||||
break;
|
||||
|
||||
case 0x0027: /* KM: MPLSTP PW-OAM, RFC 6478 */
|
||||
call_dissector(dissector_pw_oam, next_tvb, pinfo, tree);
|
||||
break;
|
||||
|
||||
case 0x0058: /* KM: MPLSTP FM, RFC 6427 */
|
||||
call_dissector(dissector_mplstp_fm, next_tvb, pinfo, tree);
|
||||
break;
|
||||
|
||||
default:
|
||||
call_dissector(dissector_data, next_tvb, pinfo, tree);
|
||||
break;
|
||||
if (channel_type == 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.*/
|
||||
dissect_bfd_mep(next_tvb, tree, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -799,6 +730,8 @@ proto_register_mpls(void)
|
|||
register_dissector("mpls", dissect_mpls, proto_mpls);
|
||||
register_dissector("mplspwcw", dissect_pw_mcw, proto_pw_mcw );
|
||||
|
||||
pw_ach_subdissector_table = register_dissector_table("pwach.channel_type", "PW Associated Channel Type", FT_UINT16, BASE_HEX);
|
||||
|
||||
module_mpls = prefs_register_protocol( proto_mpls, NULL );
|
||||
|
||||
prefs_register_enum_preference(module_mpls,
|
||||
|
@ -845,16 +778,6 @@ proto_reg_handoff_mpls(void)
|
|||
dissector_data = find_dissector("data");
|
||||
dissector_ipv6 = find_dissector("ipv6");
|
||||
dissector_ip = find_dissector("ip");
|
||||
dissector_bfd = find_dissector("bfd");
|
||||
dissector_mpls_pm_dlm = find_dissector("mpls_pm_dlm");
|
||||
dissector_mpls_pm_ilm = find_dissector("mpls_pm_ilm");
|
||||
dissector_mpls_pm_dm = find_dissector("mpls_pm_dm");
|
||||
dissector_mpls_pm_dlm_dm = find_dissector("mpls_pm_dlm_dm");
|
||||
dissector_mpls_pm_ilm_dm = find_dissector("mpls_pm_ilm_dm");
|
||||
dissector_mpls_psc = find_dissector("mpls_psc");
|
||||
dissector_mplstp_lock = find_dissector("mplstp_lock");
|
||||
dissector_mplstp_fm = find_dissector("mplstp_fm");
|
||||
dissector_pw_oam = find_dissector("pw_oam");
|
||||
dissector_pw_eth_heuristic = find_dissector("pw_eth_heuristic");
|
||||
dissector_pw_fr = find_dissector("pw_fr");
|
||||
dissector_pw_hdlc_nocw_fr = find_dissector("pw_hdlc_nocw_fr");
|
||||
|
|
|
@ -42,6 +42,12 @@ 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
|
||||
|
||||
/*
|
||||
* FF: private data passed from the MPLS dissector to subdissectors
|
||||
* (data parameter).
|
||||
|
@ -60,6 +66,5 @@ extern void decode_mpls_label(tvbuff_t *tvb, int offset,
|
|||
|
||||
extern gboolean dissect_try_cw_first_nibble(tvbuff_t *tvb, packet_info *pinfo,
|
||||
proto_tree *tree );
|
||||
int dissect_mpls_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -247,8 +247,15 @@ proto_register_mplstp_lock(void)
|
|||
|
||||
proto_register_field_array(proto_mplstp_lock, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
}
|
||||
|
||||
register_dissector("mplstp_lock", dissect_mplstp_lock, proto_mplstp_lock);
|
||||
void
|
||||
proto_reg_handoff_mplstp_lock(void)
|
||||
{
|
||||
dissector_handle_t mplstp_lock_handle;
|
||||
|
||||
mplstp_lock_handle = create_dissector_handle( dissect_mplstp_lock, proto_mplstp_lock );
|
||||
dissector_add_uint("pwach.channel_type", 0x0026, mplstp_lock_handle); /* KM: MPLSTP LOCK, RFC 6435 */
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -329,8 +336,15 @@ proto_register_mplstp_fm(void)
|
|||
|
||||
proto_register_field_array(proto_mplstp_fm, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
}
|
||||
|
||||
register_dissector("mplstp_fm", dissect_mplstp_fm, proto_mplstp_fm);
|
||||
void
|
||||
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 */
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -200,8 +200,15 @@ proto_register_pw_oam(void)
|
|||
|
||||
proto_register_field_array (proto_pw_oam, hf, array_length(hf));
|
||||
proto_register_subtree_array (ett, array_length(ett));
|
||||
}
|
||||
|
||||
register_dissector("pw_oam", dissect_pw_oam, proto_pw_oam);
|
||||
void
|
||||
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 */
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue