aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2018-11-30 20:26:29 +0100
committerAnders Broman <a.broman58@gmail.com>2018-12-01 15:52:37 +0000
commit71268f8bd1458048e2d75f5a3b8bc94feb3b7d0c (patch)
tree238a56ead11eff27ac01a9ec76dc03e4d36840e9 /epan
parentc66fbf481fb3e4b39a36744230239f5eb953dd4e (diff)
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>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-beep.c1
-rw-r--r--epan/dissectors/packet-capwap.c1
-rw-r--r--epan/dissectors/packet-epl.c1
-rw-r--r--epan/dissectors/packet-gopher.c6
-rw-r--r--epan/dissectors/packet-hdfs.c1
-rw-r--r--epan/dissectors/packet-iec104.c1
-rw-r--r--epan/dissectors/packet-kafka.c1
-rw-r--r--epan/dissectors/packet-mbtcp.c2
-rw-r--r--epan/dissectors/packet-quake2.c3
-rw-r--r--epan/dissectors/packet-quakeworld.c3
-rw-r--r--epan/dissectors/packet-rsync.c1
-rw-r--r--epan/dissectors/packet-s5066dts.c1
-rw-r--r--epan/dissectors/packet-tds.c1
-rw-r--r--epan/dissectors/packet-tftp.c1
-rw-r--r--epan/dissectors/packet-uaudp.c1
15 files changed, 19 insertions, 6 deletions
diff --git a/epan/dissectors/packet-beep.c b/epan/dissectors/packet-beep.c
index 890ca0c126..0b0660abba 100644
--- a/epan/dissectors/packet-beep.c
+++ b/epan/dissectors/packet-beep.c
@@ -991,6 +991,7 @@ proto_reg_handoff_beep(void)
dissector_add_uint_with_preference("tcp.port", TCP_PORT_BEEP, beep_handle);
+ apply_beep_prefs();
}
/*
diff --git a/epan/dissectors/packet-capwap.c b/epan/dissectors/packet-capwap.c
index 8dce6100a7..abdc694f55 100644
--- a/epan/dissectors/packet-capwap.c
+++ b/epan/dissectors/packet-capwap.c
@@ -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
diff --git a/epan/dissectors/packet-epl.c b/epan/dissectors/packet-epl.c
index 7da8c42018..900c2f1c75 100644
--- a/epan/dissectors/packet-epl.c
+++ b/epan/dissectors/packet-epl.c
@@ -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 );
diff --git a/epan/dissectors/packet-gopher.c b/epan/dissectors/packet-gopher.c
index 3632fd7fa7..06ed49d774 100644
--- a/epan/dissectors/packet-gopher.c
+++ b/epan/dissectors/packet-gopher.c
@@ -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();
}
/*
diff --git a/epan/dissectors/packet-hdfs.c b/epan/dissectors/packet-hdfs.c
index 09a527c6be..6bf4bdaa65 100644
--- a/epan/dissectors/packet-hdfs.c
+++ b/epan/dissectors/packet-hdfs.c
@@ -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
diff --git a/epan/dissectors/packet-iec104.c b/epan/dissectors/packet-iec104.c
index 2248173bf1..c7f596e61c 100644
--- a/epan/dissectors/packet-iec104.c
+++ b/epan/dissectors/packet-iec104.c
@@ -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();
}
/*
diff --git a/epan/dissectors/packet-kafka.c b/epan/dissectors/packet-kafka.c
index b2f9c9fff4..d4afc54b88 100644
--- a/epan/dissectors/packet-kafka.c
+++ b/epan/dissectors/packet-kafka.c
@@ -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();
}
/*
diff --git a/epan/dissectors/packet-mbtcp.c b/epan/dissectors/packet-mbtcp.c
index 350729509a..c142fecb3b 100644
--- a/epan/dissectors/packet-mbtcp.c
+++ b/epan/dissectors/packet-mbtcp.c
@@ -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);
diff --git a/epan/dissectors/packet-quake2.c b/epan/dissectors/packet-quake2.c
index 6d2a423799..6c476c1f36 100644
--- a/epan/dissectors/packet-quake2.c
+++ b/epan/dissectors/packet-quake2.c
@@ -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();
}
/*
diff --git a/epan/dissectors/packet-quakeworld.c b/epan/dissectors/packet-quakeworld.c
index 309d6c18a6..37dea4ad9c 100644
--- a/epan/dissectors/packet-quakeworld.c
+++ b/epan/dissectors/packet-quakeworld.c
@@ -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();
}
/*
diff --git a/epan/dissectors/packet-rsync.c b/epan/dissectors/packet-rsync.c
index e4b9961b7c..e0331118c4 100644
--- a/epan/dissectors/packet-rsync.c
+++ b/epan/dissectors/packet-rsync.c
@@ -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();
}
/*
diff --git a/epan/dissectors/packet-s5066dts.c b/epan/dissectors/packet-s5066dts.c
index 33e933f19a..607abe9baf 100644
--- a/epan/dissectors/packet-s5066dts.c
+++ b/epan/dissectors/packet-s5066dts.c
@@ -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();
}
/*
diff --git a/epan/dissectors/packet-tds.c b/epan/dissectors/packet-tds.c
index 3196a445cd..b23a23fe7e 100644
--- a/epan/dissectors/packet-tds.c
+++ b/epan/dissectors/packet-tds.c
@@ -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);
diff --git a/epan/dissectors/packet-tftp.c b/epan/dissectors/packet-tftp.c
index e85b70ea08..0bcda017ed 100644
--- a/epan/dissectors/packet-tftp.c
+++ b/epan/dissectors/packet-tftp.c
@@ -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();
}
/*
diff --git a/epan/dissectors/packet-uaudp.c b/epan/dissectors/packet-uaudp.c
index a0078b2b76..5f21308e3e 100644
--- a/epan/dissectors/packet-uaudp.c
+++ b/epan/dissectors/packet-uaudp.c
@@ -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();
}
/*