forked from osmocom/wireshark
Apply port preferences during dissector handoff registration
Handling of preferences is often done in the dissector handoff registration. Therefore this function is often registered as callback while registering preference handling for the module. In this way the preferences are processed both when registering the dissector and when changes happen. Some dissectors opt to register a seperate callback function to be called when preferences change. Now these have to be called from the dissector handoff function explicitly, in order to have the preferences processed during dissector registration. This becomes explicitly apparent when the port registration comes into play. With the migration to using dissector registration on ports with preference this port (range) is often retrieved from the preferences to match against the ports in a packet to determine an incoming or outgoing packet of a server. In case the callback function is not called from the dissector registration this determination fails, until the preferences are applied/changed, causing the preference handling callback to be called. This change add the calling of the callback during dissector registration, fixing some dissector port registrations in the process. Change-Id: Ieaea7f63f8f9062c56582a042a3a5a862e286406 Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl> Reviewed-on: https://code.wireshark.org/review/30848 Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
c66fbf481f
commit
71268f8bd1
|
@ -991,6 +991,7 @@ proto_reg_handoff_beep(void)
|
|||
|
||||
dissector_add_uint_with_preference("tcp.port", TCP_PORT_BEEP, beep_handle);
|
||||
|
||||
apply_beep_prefs();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -5778,6 +5778,7 @@ proto_reg_handoff_capwap(void)
|
|||
|
||||
dissector_add_uint_with_preference("udp.port", UDP_PORT_CAPWAP_CONTROL, capwap_control_handle);
|
||||
dissector_add_uint_with_preference("udp.port", UDP_PORT_CAPWAP_DATA, capwap_data_handle);
|
||||
apply_capwap_prefs();
|
||||
}
|
||||
/*
|
||||
* Editor modelines
|
||||
|
|
|
@ -6243,6 +6243,7 @@ proto_reg_handoff_epl(void)
|
|||
|
||||
dissector_add_uint("ethertype", ETHERTYPE_EPL_V2, epl_handle);
|
||||
dissector_add_uint_with_preference("udp.port", UDP_PORT_EPL, epl_udp_handle);
|
||||
apply_prefs();
|
||||
|
||||
/* register frame init routine */
|
||||
register_init_routine( setup_dissector );
|
||||
|
|
|
@ -70,10 +70,7 @@ static range_t *gopher_tcp_range = NULL;
|
|||
/* Returns TRUE if the packet is from a client */
|
||||
static gboolean
|
||||
is_client(packet_info *pinfo) {
|
||||
if (value_is_in_range(gopher_tcp_range, pinfo->destport)) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
return value_is_in_range(gopher_tcp_range, pinfo->destport);
|
||||
}
|
||||
|
||||
/* Name + Tab + Selector + Tab + Host + Tab + Port */
|
||||
|
@ -269,6 +266,7 @@ proto_reg_handoff_gopher(void)
|
|||
{
|
||||
gopher_handle = create_dissector_handle(dissect_gopher, proto_gopher);
|
||||
dissector_add_uint_range_with_preference("tcp.port", TCP_DEFAULT_RANGE, gopher_handle);
|
||||
gopher_prefs_apply();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1049,6 +1049,7 @@ void
|
|||
proto_reg_handoff_hdfs(void)
|
||||
{
|
||||
dissector_add_for_decode_as_with_preference("tcp.port", hdfs_handle);
|
||||
apply_hdfs_prefs();
|
||||
}
|
||||
/*
|
||||
* Editor modelines
|
||||
|
|
|
@ -1932,6 +1932,7 @@ proto_reg_handoff_iec104(void)
|
|||
iec104asdu_handle = create_dissector_handle(dissect_iec104asdu, proto_iec104asdu);
|
||||
|
||||
dissector_add_uint_with_preference("tcp.port", IEC104_PORT, iec104apci_handle);
|
||||
apply_iec104_prefs();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -4222,6 +4222,7 @@ proto_reg_handoff_kafka(void)
|
|||
|
||||
/* Replace range of ports with current */
|
||||
dissector_add_uint_range_with_preference("tcp.port", "", kafka_handle);
|
||||
apply_kafka_prefs();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -2159,6 +2159,7 @@ proto_reg_handoff_mbtcp(void)
|
|||
{
|
||||
dissector_add_uint_with_preference("tcp.port", PORT_MBTCP, mbtcp_handle);
|
||||
dissector_add_uint_with_preference("udp.port", PORT_MBTCP, mbudp_handle);
|
||||
apply_mbtcp_prefs();
|
||||
|
||||
dissector_add_uint("mbtcp.prot_id", MODBUS_PROTOCOL_ID, modbus_handle);
|
||||
|
||||
|
@ -2172,6 +2173,7 @@ proto_reg_handoff_mbrtu(void)
|
|||
/* Make sure to use Modbus RTU Preferences field to determine default TCP port */
|
||||
dissector_add_for_decode_as_with_preference("udp.port", mbrtu_udp_handle);
|
||||
dissector_add_for_decode_as_with_preference("tcp.port", mbrtu_handle);
|
||||
apply_mbrtu_prefs();
|
||||
|
||||
dissector_add_uint("mbtcp.prot_id", MODBUS_PROTOCOL_ID, modbus_handle);
|
||||
dissector_add_for_decode_as("rtacser.data", mbrtu_handle);
|
||||
|
|
|
@ -830,7 +830,8 @@ proto_reg_handoff_quake2(void)
|
|||
dissector_handle_t quake2_handle;
|
||||
quake2_handle = create_dissector_handle(dissect_quake2, proto_quake2);
|
||||
|
||||
dissector_add_uint("udp.port", PORT_MASTER, quake2_handle);
|
||||
dissector_add_uint_with_preference("udp.port", PORT_MASTER, quake2_handle);
|
||||
apply_quake2_prefs();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -828,7 +828,8 @@ proto_reg_handoff_quakeworld(void)
|
|||
dissector_handle_t quakeworld_handle;
|
||||
|
||||
quakeworld_handle = create_dissector_handle(dissect_quakeworld, proto_quakeworld);
|
||||
dissector_add_uint("udp.port", PORT_MASTER, quakeworld_handle);
|
||||
dissector_add_uint_with_preference("udp.port", PORT_MASTER, quakeworld_handle);
|
||||
apply_quakeworld_prefs();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -352,6 +352,7 @@ void
|
|||
proto_reg_handoff_rsync(void)
|
||||
{
|
||||
dissector_add_uint_with_preference("tcp.port", TCP_PORT_RSYNC, rsync_handle);
|
||||
apply_rsync_prefs();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1347,6 +1347,7 @@ void proto_reg_handoff_s5066dts(void)
|
|||
s5066dts_over_tcp_handle = create_dissector_handle(dissect_s5066dts_tcp, proto_s5066dts);
|
||||
|
||||
dissector_add_for_decode_as_with_preference("tcp.port", s5066dts_over_tcp_handle);
|
||||
apply_s5066dts_prefs();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -10151,6 +10151,7 @@ proto_reg_handoff_tds(void)
|
|||
{
|
||||
/* Initial TDS ports: MS SQL default ports */
|
||||
dissector_add_uint_range_with_preference("tcp.port", TDS_PORT_RANGE, tds_tcp_handle);
|
||||
apply_tds_prefs();
|
||||
heur_dissector_add("tcp", dissect_tds_tcp_heur, "Tabular Data Stream over TCP", "tds_tcp", proto_tds, HEURISTIC_ENABLE);
|
||||
|
||||
ntlmssp_handle = find_dissector_add_dependency("ntlmssp", proto_tds);
|
||||
|
|
|
@ -876,6 +876,7 @@ proto_reg_handoff_tftp(void)
|
|||
heur_dissector_add("stun", dissect_embeddedtftp_heur, "TFTP over TURN", "tftp_stun", proto_tftp, HEURISTIC_ENABLE);
|
||||
|
||||
dissector_add_uint_range_with_preference("udp.port", UDP_PORT_TFTP_RANGE, tftp_handle);
|
||||
apply_tftp_prefs();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -545,6 +545,7 @@ void proto_reg_handoff_uaudp(void)
|
|||
ua_term_to_sys_handle = find_dissector_add_dependency("ua_term_to_sys", proto_uaudp);
|
||||
|
||||
dissector_add_uint_range_with_preference("udp.port", UAUDP_PORT_RANGE, uaudp_handle);
|
||||
apply_uaudp_prefs();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue