Remove MPLS preference that doubled for Decode As.

Just use Decode As directly.
Also replace "registered" dissectors which just the creation of a handle since the dissectors really don't need to be "found" outside of themselves.

Change-Id: I1e0c3ae784b71c0145b1f1730a97feae8e9f488f
Reviewed-on: https://code.wireshark.org/review/7899
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2015-04-03 08:43:19 -04:00
parent 3ab3158700
commit 7ca04728c3
8 changed files with 34 additions and 219 deletions

View File

@ -440,7 +440,6 @@ proto_register_itdm(void)
module_t *itdm_module;
proto_itdm = proto_register_protocol("Internal TDM", "ITDM", "itdm");
register_dissector("itdm", dissect_itdm, proto_itdm);
proto_register_field_array(proto_itdm, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
@ -466,7 +465,7 @@ proto_reg_handoff_itdm(void)
static guint ItdmMPLSLabel;
if (!Initialized) {
itdm_handle = find_dissector("itdm");
itdm_handle = create_dissector_handle( dissect_itdm, proto_itdm );
data_handle = find_dissector("data");
Initialized=TRUE;
} else {

View File

@ -93,120 +93,8 @@ 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_pw_eth_heuristic;
static dissector_handle_t dissector_pw_fr;
static dissector_handle_t dissector_pw_hdlc_nocw_fr;
static dissector_handle_t dissector_pw_hdlc_nocw_hdlc_ppp;
static dissector_handle_t dissector_pw_eth_cw;
static dissector_handle_t dissector_pw_eth_nocw;
static dissector_handle_t dissector_pw_satop;
static dissector_handle_t dissector_itdm;
static dissector_handle_t dissector_mpls_pw_atm_n1_cw;
static dissector_handle_t dissector_mpls_pw_atm_n1_nocw;
static dissector_handle_t dissector_mpls_pw_atm_11_aal5pdu;
static dissector_handle_t dissector_mpls_pw_atm_aal5_sdu;
static dissector_handle_t dissector_pw_cesopsn;
static dissector_handle_t dissector_pw_ach;
enum mpls_default_dissector_t {
MDD_PW_ETH_HEUR = 0
,MDD_MPLS_PW_ETH_CW
,MDD_MPLS_PW_ETH_NOCW
,MDD_PW_SATOP
,MDD_PW_CESOPSN
,MDD_MPLS_PW_FR_DLCI
,MDD_MPLS_PW_HDLC_NOCW_FRPORT
,MDD_MPLS_PW_HDLC_NOCW_HDLC_PPP
,MDD_MPLS_PW_GENERIC
,MDD_ITDM
,MDD_MPLS_PW_ATM_N1_CW
,MDD_MPLS_PW_ATM_N1_NOCW
,MDD_MPLS_PW_ATM_11_OR_AAL5_PDU
,MDD_MPLS_PW_ATM_AAL5_SDU
};
/* TODO the content of mpls_default_payload menu
* should be automatically built like mpls "decode as..." menu;
* this way, mpls_default_payload will be automatically filled up when
* new mpls-specific dissector added.
*/
static const enum_val_t mpls_default_payload_defs[] = {
{
"pw satop"
,pwc_longname_pw_satop
,MDD_PW_SATOP
},
{
"pw cesopsn"
,pwc_longname_pw_cesopsn
,MDD_PW_CESOPSN
},
{
"mpls pw ethernet heuristic"
,"Ethernet MPLS PW (CW is heuristically detected)"
,MDD_PW_ETH_HEUR
},
{
"mpls pw ethernet cw"
,"Ethernet MPLS PW (with CW)"
,MDD_MPLS_PW_ETH_CW
},
{
"mpls pw ethernet no_cw"
,"Ethernet MPLS PW (no CW, early implementations)"
,MDD_MPLS_PW_ETH_NOCW
},
{
"mpls pw generic cw"
,"Generic MPLS PW (with Generic/Preferred MPLS CW)"
,MDD_MPLS_PW_GENERIC
},
{
"mpls pw fr dlci"
,"Frame relay DLCI MPLS PW"
,MDD_MPLS_PW_FR_DLCI
},
{
"mpls pw hdlc no_cw fr_port"
,"HDLC MPLS PW (no CW), FR Port mode"
,MDD_MPLS_PW_HDLC_NOCW_FRPORT
},
{
"mpls pw hdlc no_cw hdlc payload_ppp"
,"HDLC MPLS PW (no CW), HDLC mode, PPP payload"
,MDD_MPLS_PW_HDLC_NOCW_HDLC_PPP
},
{
"itdm"
,"Internal TDM"
,MDD_ITDM
},
{
"mpls pw atm n_to_one cw"
,pwc_longname_pw_atm_n1_cw
,MDD_MPLS_PW_ATM_N1_CW
},
{
"mpls pw atm n_to_one no_cw"
,pwc_longname_pw_atm_n1_nocw
,MDD_MPLS_PW_ATM_N1_NOCW
},
{
"mpls pw atm one_to_one or aal5_pdu"
,pwc_longname_pw_atm_11_or_aal5_pdu
,MDD_MPLS_PW_ATM_11_OR_AAL5_PDU
},
{
"mpls pw atm aal5_sdu"
,pwc_longname_pw_atm_aal5_sdu
,MDD_MPLS_PW_ATM_AAL5_SDU
},
{
NULL
,NULL
,-1
}
};
/* For RFC6391 - Flow aware transport of pseudowire over a mpls PSN*/
static gboolean mpls_bos_flowlabel = FALSE;
@ -217,8 +105,6 @@ static int hf_mpls_exp = -1;
static int hf_mpls_bos = -1;
static int hf_mpls_ttl = -1;
static gint mpls_default_payload = MDD_PW_ETH_HEUR;
static int hf_mpls_pw_ach_ver = -1;
static int hf_mpls_pw_ach_res = -1;
static int hf_mpls_pw_ach_channel_type = -1;
@ -592,53 +478,6 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* eventually any further PW heuristics decide.
*/
}
/* 3) use the mpls_default_payload info from user */
switch (mpls_default_payload) {
case MDD_PW_SATOP:
call_dissector(dissector_pw_satop, next_tvb, pinfo, tree);
break;
case MDD_PW_CESOPSN:
call_dissector(dissector_pw_cesopsn, next_tvb, pinfo, tree);
break;
case MDD_PW_ETH_HEUR:
call_dissector(dissector_pw_eth_heuristic, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ETH_CW:
call_dissector(dissector_pw_eth_cw, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ETH_NOCW:
call_dissector(dissector_pw_eth_nocw, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_FR_DLCI:
call_dissector(dissector_pw_fr, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_HDLC_NOCW_FRPORT:
call_dissector(dissector_pw_hdlc_nocw_fr, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_HDLC_NOCW_HDLC_PPP:
call_dissector(dissector_pw_hdlc_nocw_hdlc_ppp,next_tvb, pinfo, tree);
break;
case MDD_ITDM:
call_dissector(dissector_itdm, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ATM_N1_CW:
call_dissector(dissector_mpls_pw_atm_n1_cw, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ATM_N1_NOCW:
call_dissector(dissector_mpls_pw_atm_n1_nocw, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ATM_11_OR_AAL5_PDU:
call_dissector(dissector_mpls_pw_atm_11_aal5pdu, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ATM_AAL5_SDU:
call_dissector(dissector_mpls_pw_atm_aal5_sdu, next_tvb, pinfo, tree);
break;
default: /* fallthrough */
case MDD_MPLS_PW_GENERIC:
dissect_pw_mcw(next_tvb, pinfo, tree);
break;
}
}
void
@ -760,19 +599,12 @@ proto_register_mpls(void)
expert_register_field_array(expert_mpls, ei, array_length(ei));
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,
"mplspref.payload",
"Default decoder for MPLS payload",
"Default decoder for MPLS payload",
&mpls_default_payload,
mpls_default_payload_defs,
FALSE );
prefs_register_obsolete_preference(module_mpls, "mplspref.payload");
/* RFC6391: Flow aware transport of pseudowire*/
prefs_register_bool_preference(module_mpls,
@ -788,7 +620,7 @@ proto_register_mpls(void)
void
proto_reg_handoff_mpls(void)
{
dissector_handle_t mpls_handle;
dissector_handle_t mpls_handle, mpls_pwcw_handle;
mpls_handle = find_dissector("mpls");
dissector_add_uint("ethertype", ETHERTYPE_MPLS, mpls_handle);
@ -808,25 +640,12 @@ proto_reg_handoff_mpls(void)
dissector_add_uint("sflow_245.header_protocol", SFLOW_245_HEADER_MPLS, mpls_handle);
dissector_add_uint("udp.port", UDP_PORT_MPLS_OVER_UDP, mpls_handle);
mpls_handle = find_dissector("mplspwcw");
dissector_add_uint( "mpls.label", MPLS_LABEL_INVALID, mpls_handle );
mpls_pwcw_handle = create_dissector_handle( dissect_pw_mcw, proto_pw_mcw );
dissector_add_uint( "mpls.label", MPLS_LABEL_INVALID, mpls_pwcw_handle );
dissector_data = find_dissector("data");
dissector_ipv6 = find_dissector("ipv6");
dissector_ip = find_dissector("ip");
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");
dissector_pw_hdlc_nocw_hdlc_ppp = find_dissector("pw_hdlc_nocw_hdlc_ppp");
dissector_pw_eth_cw = find_dissector("pw_eth_cw");
dissector_pw_eth_nocw = find_dissector("pw_eth_nocw");
dissector_pw_satop = find_dissector("pw_satop_mpls");
dissector_itdm = find_dissector("itdm");
dissector_mpls_pw_atm_n1_cw = find_dissector("mpls_pw_atm_n1_cw");
dissector_mpls_pw_atm_n1_nocw = find_dissector("mpls_pw_atm_n1_nocw");
dissector_mpls_pw_atm_11_aal5pdu= find_dissector("mpls_pw_atm_11_or_aal5_pdu");
dissector_mpls_pw_atm_aal5_sdu = find_dissector("mpls_pw_atm_aal5_sdu");
dissector_pw_cesopsn = find_dissector("pw_cesopsn_mpls");
dissector_pw_ach = create_dissector_handle(dissect_pw_ach, proto_pw_ach );
}

View File

@ -1906,10 +1906,6 @@ proto_register_pw_atm_ata(void)
proto_register_subtree_array(ett_array, array_length(ett_array));
register_dissector("mpls_pw_atm_aal5_sdu" ,dissect_aal5_sdu ,proto_aal5_sdu);
register_dissector("mpls_pw_atm_11_or_aal5_pdu" ,dissect_11_or_aal5_pdu ,proto_11_or_aal5_pdu);
register_dissector("mpls_pw_atm_n1_cw" ,dissect_n1_cw ,proto_n1_cw);
register_dissector("mpls_pw_atm_n1_nocw" ,dissect_n1_nocw ,proto_n1_nocw);
new_register_dissector("mpls_pw_atm_control_word" ,dissect_control_word ,proto_control_word);
new_register_dissector("mpls_pw_atm_cell" ,dissect_cell ,proto_cell);
new_register_dissector("mpls_pw_atm_cell_header",dissect_cell_header ,proto_cell_header);
@ -1963,13 +1959,13 @@ void
proto_reg_handoff_pw_atm_ata(void)
{
dissector_handle_t h;
h = find_dissector("mpls_pw_atm_n1_cw");
h = create_dissector_handle( dissect_n1_cw, proto_n1_cw );
dissector_add_for_decode_as( "mpls.label", h );
h = find_dissector("mpls_pw_atm_n1_nocw");
h = create_dissector_handle( dissect_n1_nocw, proto_n1_nocw );
dissector_add_for_decode_as( "mpls.label", h );
h = find_dissector("mpls_pw_atm_11_or_aal5_pdu");
h = create_dissector_handle( dissect_11_or_aal5_pdu, proto_11_or_aal5_pdu );
dissector_add_for_decode_as( "mpls.label", h );
h = find_dissector("mpls_pw_atm_aal5_sdu");
h = create_dissector_handle( dissect_aal5_sdu, proto_aal5_sdu );
dissector_add_for_decode_as( "mpls.label", h );
dh_cell = find_dissector("mpls_pw_atm_cell");

View File

@ -444,7 +444,6 @@ void proto_register_pw_cesopsn(void)
proto_register_subtree_array(ett_array, array_length(ett_array));
expert_pwcesopsn = expert_register_protocol(proto);
expert_register_field_array(expert_pwcesopsn, ei, array_length(ei));
register_dissector("pw_cesopsn_mpls", dissect_pw_cesopsn_mpls, proto);
register_dissector("pw_cesopsn_udp", dissect_pw_cesopsn_udp, proto);
return;
}
@ -452,10 +451,15 @@ void proto_register_pw_cesopsn(void)
void proto_reg_handoff_pw_cesopsn(void)
{
dissector_handle_t pw_cesopsn_mpls_handle;
data_handle = find_dissector("data");
pw_padding_handle = find_dissector("pw_padding");
/* For Decode As */
dissector_add_for_decode_as("mpls.label", find_dissector("pw_cesopsn_mpls"));
pw_cesopsn_mpls_handle = create_dissector_handle( dissect_pw_cesopsn_mpls, proto );
dissector_add_for_decode_as("mpls.label", pw_cesopsn_mpls_handle);
dissector_add_for_decode_as("udp.port", find_dissector("pw_cesopsn_udp"));
return;
}

View File

@ -191,11 +191,6 @@ proto_register_pw_eth(void)
"pwethheuristic");
proto_register_field_array(proto_pw_eth_cw, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
new_register_dissector("pw_eth_cw", dissect_pw_eth_cw, proto_pw_eth_cw);
register_dissector("pw_eth_nocw", dissect_pw_eth_nocw,
proto_pw_eth_nocw);
register_dissector("pw_eth_heuristic", dissect_pw_eth_heuristic,
proto_pw_eth_heuristic);
}
void
@ -205,13 +200,13 @@ proto_reg_handoff_pw_eth(void)
eth_withoutfcs_handle = find_dissector("eth_withoutfcs");
pw_eth_handle_cw = find_dissector("pw_eth_cw");
pw_eth_handle_cw = new_create_dissector_handle( dissect_pw_eth_cw, proto_pw_eth_cw );
dissector_add_for_decode_as("mpls.label", pw_eth_handle_cw);
pw_eth_handle_nocw = find_dissector("pw_eth_nocw");
pw_eth_handle_nocw = create_dissector_handle( dissect_pw_eth_nocw, proto_pw_eth_nocw );
dissector_add_for_decode_as("mpls.label", pw_eth_handle_nocw);
pw_eth_handle_heuristic = find_dissector("pw_eth_heuristic");
pw_eth_handle_heuristic = create_dissector_handle( dissect_pw_eth_heuristic, proto_pw_eth_heuristic );
dissector_add_for_decode_as("mpls.label", pw_eth_handle_heuristic);
}

View File

@ -305,16 +305,17 @@ static hf_register_info hf[] = {
proto_register_subtree_array(ett, array_length(ett));
expert_pwfr = expert_register_protocol(proto_encaps);
expert_register_field_array(expert_pwfr, ei, array_length(ei));
register_dissector("pw_fr", dissect_pw_fr, proto_encaps );
}
void
proto_reg_handoff_pw_fr(void)
{
dissector_handle_t h;
h = find_dissector("pw_fr");
dissector_add_for_decode_as("mpls.label", h);
dissector_handle_t pw_fr_mpls_handle;
pw_fr_mpls_handle = create_dissector_handle( dissect_pw_fr, proto_encaps );
dissector_add_for_decode_as("mpls.label", pw_fr_mpls_handle);
fr_stripped_address_handle = find_dissector("fr_stripped_address");
}

View File

@ -218,20 +218,17 @@ void proto_register_pw_hdlc(void)
proto_register_field_array(proto_pw_hdlc_nocw_fr, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_dissector("pw_hdlc_nocw_fr", dissect_pw_hdlc_nocw_fr, proto_pw_hdlc_nocw_fr );
new_register_dissector("pw_hdlc_nocw_hdlc_ppp", dissect_pw_hdlc_nocw_hdlc_ppp, proto_pw_hdlc_nocw_hdlc_ppp );
}
void proto_reg_handoff_pw_hdlc(void)
{
dissector_handle_t handle;
dissector_handle_t pw_fr_handle, pw_ppp_handle;
handle = find_dissector("pw_hdlc_nocw_fr");
dissector_add_for_decode_as( "mpls.label", handle );
pw_fr_handle = create_dissector_handle( dissect_pw_hdlc_nocw_fr, proto_pw_hdlc_nocw_fr );
dissector_add_for_decode_as( "mpls.label", pw_fr_handle );
handle = find_dissector("pw_hdlc_nocw_hdlc_ppp");
dissector_add_for_decode_as( "mpls.label", handle );
pw_ppp_handle = new_create_dissector_handle( dissect_pw_hdlc_nocw_hdlc_ppp, proto_pw_hdlc_nocw_hdlc_ppp );
dissector_add_for_decode_as( "mpls.label", pw_ppp_handle );
ppp_handle = find_dissector( "ppp" );
fr_handle = find_dissector( "fr" );

View File

@ -460,17 +460,21 @@ void proto_register_pw_satop(void)
proto_register_subtree_array(ett_array, array_length(ett_array));
expert_pwsatop = expert_register_protocol(proto);
expert_register_field_array(expert_pwsatop, ei, array_length(ei));
register_dissector("pw_satop_mpls", dissect_pw_satop_mpls, proto);
register_dissector("pw_satop_udp", dissect_pw_satop_udp, proto);
return;
}
void proto_reg_handoff_pw_satop(void)
{
dissector_handle_t pw_satop_mpls_handle;
data_handle = find_dissector("data");
pw_padding_handle = find_dissector("pw_padding");
/* For Decode As */
dissector_add_for_decode_as("mpls.label", find_dissector("pw_satop_mpls"));
pw_satop_mpls_handle = create_dissector_handle( dissect_pw_satop_mpls, proto );
dissector_add_for_decode_as("mpls.label", pw_satop_mpls_handle);
dissector_add_for_decode_as("udp.port", find_dissector("pw_satop_udp"));
}