From b35d8a5714e1e4b989237d1d117fba3364c24299 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 19 Jun 2012 10:49:01 -0400 Subject: [PATCH 1/1] Fix: problem in port assignment in uri_parse() The functions now puts 0 in the port field of the lttng_uri structure if NO port are specified. It's now the caller's job to assign a default port for that case. Since the uri_parse() function does not know the URI context, a default port can not be assigned correctly. Signed-off-by: David Goulet --- src/common/uri.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/uri.c b/src/common/uri.c index 3a58aedca..cb04d1963 100644 --- a/src/common/uri.c +++ b/src/common/uri.c @@ -145,17 +145,17 @@ ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris) /* Size of the uris array. Default is 1 */ ssize_t size = 1; char net[6], dst[LTTNG_MAX_DNNAME + 1]; - unsigned int ctrl_port = DEFAULT_NETWORK_CONTROL_PORT; - unsigned int data_port = DEFAULT_NETWORK_DATA_PORT; + unsigned int ctrl_port = 0; + unsigned int data_port = 0; struct lttng_uri *uri; const struct uri_proto *proto; /* * The first part is the protocol portion of a maximum of 5 bytes for now. - * (tcp, tcp6, udp, udp6, file, net). The second part is the hostname or IP - * address. The 255 bytes size is the limit found in the RFC 1035 for the - * total length of a domain name (https://www.ietf.org/rfc/rfc1035.txt). - * Finally, with the net:// protocol, two ports can be specified. + * The second part is the hostname or IP address. The 255 bytes size is the + * limit found in the RFC 1035 for the total length of a domain name + * (https://www.ietf.org/rfc/rfc1035.txt). Finally, for the net:// + * protocol, two ports CAN be specified. */ ret = sscanf(str_uri, "%5[^:]://", net); -- 2.34.1