diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-12-20 16:05:39 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-12-20 16:05:39 +0000 |
commit | fa1999c564482883e15e54fdcbbae50e75427bdf (patch) | |
tree | e55a811c679f6600067a551538fdb2c31190c1b0 /src/exit | |
parent | 0ada07d91217807b9566aa76fb2f20512be308d5 (diff) | |
download | gnunet-fa1999c564482883e15e54fdcbbae50e75427bdf.tar.gz gnunet-fa1999c564482883e15e54fdcbbae50e75427bdf.zip |
-fix service name construction, remove .gnunet.
Diffstat (limited to 'src/exit')
-rw-r--r-- | src/exit/gnunet-daemon-exit.c | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index 6afb38fd9..39c93a84d 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c | |||
@@ -1900,11 +1900,14 @@ receive_tcp_service (void *cls, | |||
1900 | GNUNET_i2s (&state->peer), | 1900 | GNUNET_i2s (&state->peer), |
1901 | GNUNET_h2s (&start->service_descriptor), | 1901 | GNUNET_h2s (&start->service_descriptor), |
1902 | (unsigned int) ntohs (start->tcp_header.destination_port)); | 1902 | (unsigned int) ntohs (start->tcp_header.destination_port)); |
1903 | if (NULL == (state->specifics.tcp_udp.serv = find_service (tcp_services, &start->service_descriptor, | 1903 | if (NULL == (state->specifics.tcp_udp.serv = |
1904 | ntohs (start->tcp_header.destination_port)))) | 1904 | find_service (tcp_services, |
1905 | &start->service_descriptor, | ||
1906 | ntohs (start->tcp_header.destination_port)))) | ||
1905 | { | 1907 | { |
1906 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1908 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1907 | _("No service found for %s on port %d!\n"), | 1909 | _("No service %s found for %s on port %d!\n"), |
1910 | GNUNET_h2s (&start->service_descriptor), | ||
1908 | "TCP", | 1911 | "TCP", |
1909 | ntohs (start->tcp_header.destination_port)); | 1912 | ntohs (start->tcp_header.destination_port)); |
1910 | GNUNET_STATISTICS_update (stats, | 1913 | GNUNET_STATISTICS_update (stats, |
@@ -2978,11 +2981,14 @@ receive_udp_service (void *cls, | |||
2978 | GNUNET_i2s (&state->peer), | 2981 | GNUNET_i2s (&state->peer), |
2979 | GNUNET_h2s (&msg->service_descriptor), | 2982 | GNUNET_h2s (&msg->service_descriptor), |
2980 | (unsigned int) ntohs (msg->destination_port)); | 2983 | (unsigned int) ntohs (msg->destination_port)); |
2981 | if (NULL == (state->specifics.tcp_udp.serv = find_service (udp_services, &msg->service_descriptor, | 2984 | if (NULL == (state->specifics.tcp_udp.serv = |
2982 | ntohs (msg->destination_port)))) | 2985 | find_service (udp_services, |
2986 | &msg->service_descriptor, | ||
2987 | ntohs (msg->destination_port)))) | ||
2983 | { | 2988 | { |
2984 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 2989 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
2985 | _("No service found for %s on port %d!\n"), | 2990 | _("No service %s found for %s on port %d!\n"), |
2991 | GNUNET_h2s (&msg->service_descriptor), | ||
2986 | "UDP", | 2992 | "UDP", |
2987 | ntohs (msg->destination_port)); | 2993 | ntohs (msg->destination_port)); |
2988 | GNUNET_STATISTICS_update (stats, | 2994 | GNUNET_STATISTICS_update (stats, |
@@ -3213,6 +3219,12 @@ add_services (int proto, | |||
3213 | char *hostname; | 3219 | char *hostname; |
3214 | char *hostport; | 3220 | char *hostport; |
3215 | struct LocalService *serv; | 3221 | struct LocalService *serv; |
3222 | char *n; | ||
3223 | size_t slen; | ||
3224 | |||
3225 | slen = strlen (name); | ||
3226 | GNUNET_assert (slen >= 8); | ||
3227 | n = GNUNET_strndup (name, slen - 8 /* remove .gnunet. */); | ||
3216 | 3228 | ||
3217 | for (redirect = strtok (cpy, " "); redirect != NULL; | 3229 | for (redirect = strtok (cpy, " "); redirect != NULL; |
3218 | redirect = strtok (NULL, " ")) | 3230 | redirect = strtok (NULL, " ")) |
@@ -3230,9 +3242,9 @@ add_services (int proto, | |||
3230 | if (NULL == (hostport = strstr (hostname, ":"))) | 3242 | if (NULL == (hostport = strstr (hostname, ":"))) |
3231 | { | 3243 | { |
3232 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 3244 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
3233 | _("Option `%s' for domain `%s' is not formatted correctly!\n"), | 3245 | _("Option `%s' for domain `%s' is not formatted correctly!\n"), |
3234 | redirect, | 3246 | redirect, |
3235 | name); | 3247 | name); |
3236 | continue; | 3248 | continue; |
3237 | } | 3249 | } |
3238 | hostport[0] = '\0'; | 3250 | hostport[0] = '\0'; |
@@ -3244,9 +3256,9 @@ add_services (int proto, | |||
3244 | if (!((local_port > 0) && (local_port < 65536))) | 3256 | if (!((local_port > 0) && (local_port < 65536))) |
3245 | { | 3257 | { |
3246 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 3258 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
3247 | _("`%s' is not a valid port number (for domain `%s')!"), | 3259 | _("`%s' is not a valid port number (for domain `%s')!"), |
3248 | redirect, | 3260 | redirect, |
3249 | name); | 3261 | name); |
3250 | continue; | 3262 | continue; |
3251 | } | 3263 | } |
3252 | if (!((remote_port > 0) && (remote_port < 65536))) | 3264 | if (!((remote_port > 0) && (remote_port < 65536))) |
@@ -3287,7 +3299,7 @@ add_services (int proto, | |||
3287 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 3299 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
3288 | _("No addresses found for hostname `%s' of service `%s'!\n"), | 3300 | _("No addresses found for hostname `%s' of service `%s'!\n"), |
3289 | hostname, | 3301 | hostname, |
3290 | name); | 3302 | n); |
3291 | GNUNET_free (serv); | 3303 | GNUNET_free (serv); |
3292 | continue; | 3304 | continue; |
3293 | } | 3305 | } |
@@ -3300,7 +3312,7 @@ add_services (int proto, | |||
3300 | { | 3312 | { |
3301 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 3313 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
3302 | _("Service `%s' configured for IPv4, but IPv4 is disabled!\n"), | 3314 | _("Service `%s' configured for IPv4, but IPv4 is disabled!\n"), |
3303 | name); | 3315 | n); |
3304 | freeaddrinfo (res); | 3316 | freeaddrinfo (res); |
3305 | GNUNET_free (serv); | 3317 | GNUNET_free (serv); |
3306 | continue; | 3318 | continue; |
@@ -3312,7 +3324,7 @@ add_services (int proto, | |||
3312 | { | 3324 | { |
3313 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 3325 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
3314 | _("Service `%s' configured for IPv4, but IPv4 is disabled!\n"), | 3326 | _("Service `%s' configured for IPv4, but IPv4 is disabled!\n"), |
3315 | name); | 3327 | n); |
3316 | freeaddrinfo (res); | 3328 | freeaddrinfo (res); |
3317 | GNUNET_free (serv); | 3329 | GNUNET_free (serv); |
3318 | continue; | 3330 | continue; |
@@ -3324,14 +3336,14 @@ add_services (int proto, | |||
3324 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 3336 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
3325 | _("No IP addresses found for hostname `%s' of service `%s'!\n"), | 3337 | _("No IP addresses found for hostname `%s' of service `%s'!\n"), |
3326 | hostname, | 3338 | hostname, |
3327 | name); | 3339 | n); |
3328 | GNUNET_free (serv); | 3340 | GNUNET_free (serv); |
3329 | continue; | 3341 | continue; |
3330 | } | 3342 | } |
3331 | freeaddrinfo (res); | 3343 | freeaddrinfo (res); |
3332 | } | 3344 | } |
3333 | store_service ((IPPROTO_UDP == proto) ? udp_services : tcp_services, | 3345 | store_service ((IPPROTO_UDP == proto) ? udp_services : tcp_services, |
3334 | name, | 3346 | n, |
3335 | local_port, | 3347 | local_port, |
3336 | serv); | 3348 | serv); |
3337 | } | 3349 | } |