diff options
author | Michael Mann <mmann78@netscape.net> | 2015-12-12 09:44:54 -0500 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2015-12-13 07:09:01 +0000 |
commit | 510f7d1f05a43ee391c7a3c3c34eeaca0e78b97f (patch) | |
tree | c863a8e4d54230e72fc46e67f891cd2649bda05d | |
parent | 76dd8a27b77aa959d4f6c6fb09c48b2e79d9cd47 (diff) |
Register TCP ports 6000-6063 for X11 dissector.
This is done through a preference that defaults the range to 6000-6063, which corresponds to its IANA registered ports.
Bug: 11869
Change-Id: Ifafcf598417cd44545b0b4b9ac883cf1b63c9b23
Reviewed-on: https://code.wireshark.org/review/12572
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
-rw-r--r-- | epan/dissectors/packet-x11.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/epan/dissectors/packet-x11.c b/epan/dissectors/packet-x11.c index ccfb8bae75..a5aa07a3cf 100644 --- a/epan/dissectors/packet-x11.c +++ b/epan/dissectors/packet-x11.c @@ -216,10 +216,9 @@ static expert_field ei_x11_keycode_value_out_of_range = EI_INIT; /* desegmentation of X11 messages */ static gboolean x11_desegment = TRUE; +static range_t *global_x11_tcp_port_range; -#define TCP_PORT_X11 6000 -#define TCP_PORT_X11_2 6001 -#define TCP_PORT_X11_3 6002 +#define DEFAULT_X11_PORT_RANGE "6000-6063" /* * Round a length to a multiple of 4 bytes. @@ -5850,23 +5849,42 @@ void proto_register_x11(void) reply_table = g_hash_table_new(g_str_hash, g_str_equal); register_x11_extensions(); + /* Set default TCP ports */ + range_convert_str(&global_x11_tcp_port_range, DEFAULT_X11_PORT_RANGE, MAX_TCP_PORT); + x11_module = prefs_register_protocol(proto_x11, NULL); prefs_register_bool_preference(x11_module, "desegment", "Reassemble X11 messages spanning multiple TCP segments", "Whether the X11 dissector should reassemble messages spanning multiple TCP segments. " "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", &x11_desegment); + + prefs_register_range_preference(x11_module, "tcp.ports", "X11 TCP ports", + "TCP ports to be decoded as X11 (default: " + DEFAULT_X11_PORT_RANGE ")", + &global_x11_tcp_port_range, MAX_TCP_PORT); } void proto_reg_handoff_x11(void) { - dissector_handle_t x11_handle; + static gboolean initialized = FALSE; + static range_t *x11_tcp_port_range; + static dissector_handle_t x11_handle = NULL; + + if (!initialized) + { + x11_handle = create_dissector_handle(dissect_x11, proto_x11); + initialized = TRUE; + } + else + { + dissector_delete_uint_range("tcp.port", x11_tcp_port_range, x11_handle); + g_free(x11_tcp_port_range); + } - x11_handle = create_dissector_handle(dissect_x11, proto_x11); - dissector_add_uint("tcp.port", TCP_PORT_X11, x11_handle); - dissector_add_uint("tcp.port", TCP_PORT_X11_2, x11_handle); - dissector_add_uint("tcp.port", TCP_PORT_X11_3, x11_handle); + x11_tcp_port_range = range_copy(global_x11_tcp_port_range); + dissector_add_uint_range("tcp.port", x11_tcp_port_range, x11_handle); } /* |