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>
This commit is contained in:
Michael Mann 2015-12-12 09:44:54 -05:00 committed by Alexis La Goutte
parent 76dd8a27b7
commit 510f7d1f05
1 changed files with 26 additions and 8 deletions

View File

@ -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;
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);
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_tcp_port_range = range_copy(global_x11_tcp_port_range);
dissector_add_uint_range("tcp.port", x11_tcp_port_range, x11_handle);
}
/*