diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-10-05 15:28:21 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-10-05 15:28:21 +0000 |
commit | ef76e090bf279f25038c03eec4eac96bbfbe952e (patch) | |
tree | 9e70dd991daefef65cd85dbcdc4bc4d19b7fedb0 | |
parent | 8c85bda93a8ece52f02af7f20fb797ad6ac79337 (diff) |
fix #3986
-rw-r--r-- | src/include/gnunet_nat_lib.h | 5 | ||||
-rw-r--r-- | src/include/gnunet_peerstore_service.h | 4 | ||||
-rw-r--r-- | src/nat/nat.c | 225 | ||||
-rw-r--r-- | src/nat/nat.h | 4 | ||||
-rw-r--r-- | src/peerinfo-tool/gnunet-peerinfo.c | 15 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport.c | 16 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_hello.c | 65 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.c | 10 |
8 files changed, 211 insertions, 133 deletions
diff --git a/src/include/gnunet_nat_lib.h b/src/include/gnunet_nat_lib.h index 88f8f6d65f..101517e8bb 100644 --- a/src/include/gnunet_nat_lib.h +++ b/src/include/gnunet_nat_lib.h @@ -80,14 +80,17 @@ enum GNUNET_NAT_Type * We have a direct connection */ GNUNET_NAT_TYPE_NO_NAT = GNUNET_OK, + /** * We are under a NAT but cannot traverse it */ GNUNET_NAT_TYPE_UNREACHABLE_NAT, + /** * We can traverse using STUN */ GNUNET_NAT_TYPE_STUN_PUNCHED_NAT, + /** * WE can traverse using UPNP */ @@ -195,8 +198,6 @@ enum GNUNET_NAT_StatusCode */ GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND, - - /** * */ diff --git a/src/include/gnunet_peerstore_service.h b/src/include/gnunet_peerstore_service.h index b32b29a782..556260928b 100644 --- a/src/include/gnunet_peerstore_service.h +++ b/src/include/gnunet_peerstore_service.h @@ -116,7 +116,9 @@ struct GNUNET_PEERSTORE_Record * @param success #GNUNET_OK or #GNUNET_SYSERR */ typedef void -(*GNUNET_PEERSTORE_Continuation)(void *cls, int success); +(*GNUNET_PEERSTORE_Continuation)(void *cls, + int success); + /** * Function called by PEERSTORE for each matching record. diff --git a/src/nat/nat.c b/src/nat/nat.c index e51c001f2e..709a13f03d 100644 --- a/src/nat/nat.c +++ b/src/nat/nat.c @@ -454,18 +454,15 @@ static void start_gnunet_nat_server (struct GNUNET_NAT_Handle *h); - - /** * Call task to process STUN * * @param cls handle to NAT * @param tc TaskContext */ - static void process_stun (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); + const struct GNUNET_SCHEDULER_TaskContext *tc); /** @@ -488,10 +485,14 @@ remove_from_address_list_by_source (struct GNUNET_NAT_Handle *h, next = pos->next; if (pos->source != src) continue; - GNUNET_CONTAINER_DLL_remove (h->lal_head, h->lal_tail, pos); + GNUNET_CONTAINER_DLL_remove (h->lal_head, + h->lal_tail, + pos); if (NULL != h->address_callback) - h->address_callback (h->callback_cls, GNUNET_NO, - (const struct sockaddr *) &pos[1], pos->addrlen); + h->address_callback (h->callback_cls, + GNUNET_NO, + (const struct sockaddr *) &pos[1], + pos->addrlen); GNUNET_free (pos); } } @@ -509,7 +510,8 @@ remove_from_address_list_by_source (struct GNUNET_NAT_Handle *h, static void add_to_address_list_as_is (struct GNUNET_NAT_Handle *h, enum LocalAddressSource src, - const struct sockaddr *arg, socklen_t arg_size) + const struct sockaddr *arg, + socklen_t arg_size) { struct LocalAddressList *lal; @@ -517,13 +519,18 @@ add_to_address_list_as_is (struct GNUNET_NAT_Handle *h, memcpy (&lal[1], arg, arg_size); lal->addrlen = arg_size; lal->source = src; - GNUNET_CONTAINER_DLL_insert (h->lal_head, h->lal_tail, lal); + GNUNET_CONTAINER_DLL_insert (h->lal_head, + h->lal_tail, + lal); LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding address `%s' from source %d\n", GNUNET_a2s (arg, arg_size), src); if (NULL != h->address_callback) - h->address_callback (h->callback_cls, GNUNET_YES, arg, arg_size); + h->address_callback (h->callback_cls, + GNUNET_YES, + arg, + arg_size); } @@ -1110,15 +1117,13 @@ list_interfaces (void *cls, * @param result , the status */ static void -stun_request_callback(void *cls, - enum GNUNET_NAT_StatusCode result) +stun_request_callback (void *cls, + enum GNUNET_NAT_StatusCode result) { - struct GNUNET_NAT_Handle *h = cls; - if(NULL == cls) + if (NULL == h) return; - h->waiting_stun = GNUNET_NO; if(result != GNUNET_OK) @@ -1126,58 +1131,64 @@ stun_request_callback(void *cls, LOG (GNUNET_ERROR_TYPE_WARNING, "Error processing a STUN request"); } +} -}; /** - * CHECK if is a valid STUN packet sending to GNUNET_NAT_stun_handle_packet. + * CHECK if is a valid STUN packet sending to GNUNET_NAT_stun_handle_packet(). * It also check if it can handle the packet based on the NAT handler. * You don't need to call anything else to check if the packet is valid, * * @param cls the NAT handle - * @param data, packet - * @param len, packet length - * + * @param data packet + * @param len packet length * @return #GNUNET_NO if it can't decode, #GNUNET_YES if is a packet */ int -GNUNET_NAT_is_valid_stun_packet(void *cls, const void *data, size_t len) +GNUNET_NAT_is_valid_stun_packet (void *cls, + const void *data, + size_t len) { struct GNUNET_NAT_Handle *h = cls; struct sockaddr_in answer; - /* We are not expecting a STUN message*/ - if(!h->waiting_stun) + /* We are not expecting a STUN message */ + if (! h->waiting_stun) return GNUNET_NO; - /*We dont have STUN installed*/ - if(!h->use_stun) + /* We dont have STUN installed */ + if (! h->use_stun) return GNUNET_NO; /* Empty the answer structure */ - memset(&answer, 0, sizeof(struct sockaddr_in)); + memset (&answer, + 0, + sizeof(struct sockaddr_in)); /*Lets handle the packet*/ - int valid = GNUNET_NAT_stun_handle_packet(data,len, &answer); - if(valid) - { - LOG (GNUNET_ERROR_TYPE_INFO, - "Stun server returned IP %s , with port %d \n", inet_ntoa(answer.sin_addr), ntohs(answer.sin_port)); - /* ADD IP AS VALID*/ - add_to_address_list (h, LAL_EXTERNAL_IP, (const struct sockaddr *) &answer, - sizeof (struct sockaddr_in)); - h->waiting_stun = GNUNET_NO; - return GNUNET_YES; - } - else - { + int valid = GNUNET_NAT_stun_handle_packet (data, + len, + &answer); + if (! valid) return GNUNET_NO; - } - - + LOG (GNUNET_ERROR_TYPE_INFO, + "Stun server returned %s:%d\n", + inet_ntoa (answer.sin_addr), + ntohs (answer.sin_port)); + /* Remove old IPs from previous STUN calls */ + remove_from_address_list_by_source (h, + LAL_EXTERNAL_STUN_IP); + /* Add new IP from STUN packet */ + add_to_address_list (h, + LAL_EXTERNAL_STUN_IP, + (const struct sockaddr *) &answer, + sizeof (struct sockaddr_in)); + h->waiting_stun = GNUNET_NO; + return GNUNET_YES; } + /** * Task to do a STUN request * @@ -1186,36 +1197,39 @@ GNUNET_NAT_is_valid_stun_packet(void *cls, const void *data, size_t len) */ static void process_stun (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) + const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GNUNET_NAT_Handle *h = cls; - - h->stun_task = NULL; - - - struct StunServerList* elem = h->actual_stun_server; + h->stun_task = NULL; /* Make the request */ LOG (GNUNET_ERROR_TYPE_INFO, - "I will request the stun server %s:%i !\n", elem->address, elem->port); - - if(GNUNET_OK == GNUNET_NAT_stun_make_request(elem->address, elem->port, h->socket, &stun_request_callback, NULL)) + "I will request the stun server %s:%i\n", + elem->address, + elem->port); + if (GNUNET_OK == + GNUNET_NAT_stun_make_request (elem->address, + elem->port, + h->socket, + &stun_request_callback, + NULL)) { h->waiting_stun = GNUNET_YES; } else { LOG (GNUNET_ERROR_TYPE_ERROR, - "STUN request failed %s:%i !\n", elem->address, elem->port); + "STUN request to %s:%i failed\n", + elem->address, + elem->port); } - h->stun_task = - GNUNET_SCHEDULER_add_delayed (h->stun_frequency, - &process_stun, h); + GNUNET_SCHEDULER_add_delayed (h->stun_frequency, + &process_stun, h); /* Set actual Server*/ - if(elem->next) + if (NULL != elem->next) { h->actual_stun_server = elem->next; } @@ -1223,11 +1237,9 @@ process_stun (void *cls, { h->actual_stun_server = h->stun_servers_head; } - } - /** * Task to do a lookup on our hostname for IP addresses. * @@ -1303,15 +1315,16 @@ upnp_add (void *cls, /* Error while running upnp client */ LOG (GNUNET_ERROR_TYPE_ERROR, _("Error while running upnp client:\n")); - //FIXME: convert error code to string - return; } if (GNUNET_YES == add_remove) { - add_to_address_list (h, LAL_UPNP, addr, addrlen); + add_to_address_list (h, + LAL_UPNP, + addr, + addrlen); return; } else if (GNUNET_NO == add_remove) @@ -1324,10 +1337,14 @@ upnp_add (void *cls, if ((pos->source != LAL_UPNP) || (pos->addrlen != addrlen) || (0 != memcmp (&pos[1], addr, addrlen))) continue; - GNUNET_CONTAINER_DLL_remove (h->lal_head, h->lal_tail, pos); + GNUNET_CONTAINER_DLL_remove (h->lal_head, + h->lal_tail, + pos); if (NULL != h->address_callback) - h->address_callback (h->callback_cls, GNUNET_NO, - (const struct sockaddr *) &pos[1], pos->addrlen); + h->address_callback (h->callback_cls, + GNUNET_NO, + (const struct sockaddr *) &pos[1], + pos->addrlen); GNUNET_free (pos); return; /* only remove once */ } @@ -1377,7 +1394,9 @@ add_minis (struct GNUNET_NAT_Handle *h, return; } - GNUNET_CONTAINER_DLL_insert (h->mini_head, h->mini_tail, ml); + GNUNET_CONTAINER_DLL_insert (h->mini_head, + h->mini_tail, + ml); } @@ -1470,7 +1489,7 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_NAT_AddressCallback address_callback, GNUNET_NAT_ReversalCallback reversal_callback, void *callback_cls, - struct GNUNET_NETWORK_Handle* sock ) + struct GNUNET_NETWORK_Handle *sock) { struct GNUNET_NAT_Handle *h; struct in_addr in_addr; @@ -1489,7 +1508,7 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, h->callback_cls = callback_cls; h->num_local_addrs = num_addrs; h->adv_port = adv_port; - if (num_addrs != 0) + if (0 != num_addrs) { h->local_addrs = GNUNET_malloc (num_addrs * sizeof (struct sockaddr *)); h->local_addrlens = GNUNET_malloc (num_addrs * sizeof (socklen_t)); @@ -1574,11 +1593,14 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, /* STUN */ h->use_stun = - GNUNET_CONFIGURATION_get_value_yesno (cfg, "nat", - "USE_STUN"); + GNUNET_CONFIGURATION_get_value_yesno (cfg, + "nat", + "USE_STUN"); if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_time (cfg, "nat", "STUN_FREQUENCY", + GNUNET_CONFIGURATION_get_value_time (cfg, + "nat", + "STUN_FREQUENCY", &h->stun_frequency)) h->stun_frequency = STUN_FREQUENCY; @@ -1599,25 +1621,28 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, "No external IP address given to add to our list of addresses\n"); } - /* ENABLE STUN ONLY ON UDP*/ - if(!is_tcp && (NULL != sock) && h->use_stun ) + /* ENABLE STUN ONLY ON UDP */ + if( (! is_tcp) && + (NULL != sock) && + h->use_stun) { - h->socket = sock; - h->actual_stun_server = NULL; - - /* Lets process the servers*/ char *stun_servers; - size_t urls; int pos; size_t pos_port; + h->socket = sock; + h->actual_stun_server = NULL; + /* Lets process the servers*/ if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, "nat", "STUN_SERVERS", + GNUNET_CONFIGURATION_get_value_string (cfg, + "nat", + "STUN_SERVERS", &stun_servers)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, - "nat", "STUN_SERVERS"); + "nat", + "STUN_SERVERS"); } urls = 0; @@ -1649,10 +1674,7 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, struct StunServerList* ml = GNUNET_new (struct StunServerList); - ml->next = NULL; - ml->prev = NULL; - - ml->port = atoi(&stun_servers[pos_port]); + ml->port = atoi (&stun_servers[pos_port]); stun_servers[pos_port-1] = '\0'; /* Remove trailing space */ @@ -1662,11 +1684,15 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, ml->address = GNUNET_strdup (&stun_servers[pos]); LOG (GNUNET_ERROR_TYPE_DEBUG, - "Found STUN server %s port %i !!!\n", ml->address, ml->port); + "Found STUN server %s:%i\n", + ml->address, + ml->port); - GNUNET_CONTAINER_DLL_insert (h->stun_servers_head, h->stun_servers_tail, ml); + GNUNET_CONTAINER_DLL_insert (h->stun_servers_head, + h->stun_servers_tail, + ml); /* Make sure that we STOP if is the last one*/ - if(0== pos) + if (0 == pos) break; } @@ -1684,17 +1710,21 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, h->actual_stun_server = h->stun_servers_head; } - h->stun_task = GNUNET_SCHEDULER_add_now(&process_stun, - h); + h->stun_task = GNUNET_SCHEDULER_add_now (&process_stun, + h); } /* Test for SUID binaries */ binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-server"); - if ((h->behind_nat == GNUNET_YES) && (GNUNET_YES == h->enable_nat_server) && - (GNUNET_YES != - GNUNET_OS_check_helper_binary (binary, GNUNET_YES, "-d 127.0.0.1" ))) // use localhost as source for that one udp-port, ok for testing + if ( (GNUNET_YES == h->behind_nat) && + (GNUNET_YES == h->enable_nat_server) && + (GNUNET_YES != + GNUNET_OS_check_helper_binary (binary, + GNUNET_YES, + "-d 127.0.0.1" ))) { + // use localhost as source for that one udp-port, ok for testing h->enable_nat_server = GNUNET_NO; LOG (GNUNET_ERROR_TYPE_WARNING, _("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"), @@ -1708,8 +1738,7 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, { h->enable_nat_client = GNUNET_NO; LOG (GNUNET_ERROR_TYPE_WARNING, - _ - ("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"), + _("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"), "gnunet-helper-nat-client"); } GNUNET_free (binary); @@ -1809,10 +1838,14 @@ GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h) } while (NULL != (lal = h->lal_head)) { - GNUNET_CONTAINER_DLL_remove (h->lal_head, h->lal_tail, lal); + GNUNET_CONTAINER_DLL_remove (h->lal_head, + h->lal_tail, + lal); if (NULL != h->address_callback) - h->address_callback (h->callback_cls, GNUNET_NO, - (const struct sockaddr *) &lal[1], lal->addrlen); + h->address_callback (h->callback_cls, + GNUNET_NO, + (const struct sockaddr *) &lal[1], + lal->addrlen); GNUNET_free (lal); } for (i = 0; i < h->num_local_addrs; i++) diff --git a/src/nat/nat.h b/src/nat/nat.h index 28eadba7a8..44cd81d42a 100644 --- a/src/nat/nat.h +++ b/src/nat/nat.h @@ -37,7 +37,7 @@ GNUNET_NETWORK_STRUCT_BEGIN struct GNUNET_NAT_TestMessage { /** - * Header with type "GNUNET_MESSAGE_TYPE_NAT_TEST" + * Header with type #GNUNET_MESSAGE_TYPE_NAT_TEST */ struct GNUNET_MessageHeader header; @@ -57,7 +57,7 @@ struct GNUNET_NAT_TestMessage uint16_t data; /** - * GNUNET_YES for TCP, GNUNET_NO for UDP. + * #GNUNET_YES for TCP, #GNUNET_NO for UDP. */ int32_t is_tcp; diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c index 75969d1400..53c2293d8a 100644 --- a/src/peerinfo-tool/gnunet-peerinfo.c +++ b/src/peerinfo-tool/gnunet-peerinfo.c @@ -291,15 +291,19 @@ process_resolved_address (void *cls, if (NULL != address) { - if (NULL == ar->result) + if (0 != strlen (address)) + { + if (NULL != ar->result) + GNUNET_free (ar->result); ar->result = GNUNET_strdup (address); + } return; } ar->atsc = NULL; if (GNUNET_SYSERR == res) GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _("Failure: Cannot convert address to string for peer `%s'\n"), - GNUNET_i2s (&ar->pc->peer)); + _("Failure: Cannot convert address to string for peer `%s'\n"), + GNUNET_i2s (&ar->pc->peer)); pc->num_addresses++; if (pc->num_addresses == pc->address_list_size) dump_pc (pc); @@ -346,6 +350,11 @@ print_address (void *cls, ar = &pc->address_list[--pc->off]; ar->pc = pc; ar->expiration = expiration; + GNUNET_asprintf (&ar->result, + "%s:%u:%u", + address->transport_name, + address->address_length, + address->local_info); ar->atsc = GNUNET_TRANSPORT_address_to_string (cfg, address, no_resolve, diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index f545b29f9a..9cf4bdcacc 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -515,23 +515,31 @@ plugin_env_address_change_notification (void *cls, if (GNUNET_YES == add_remove) { addresses ++; - GNUNET_STATISTICS_update (cfg, "# transport addresses", 1, GNUNET_NO); + GNUNET_STATISTICS_update (cfg, + "# transport addresses", + 1, + GNUNET_NO); } else if (GNUNET_NO == add_remove) { if (0 == addresses) + { GNUNET_break (0); + } else { addresses --; - GNUNET_STATISTICS_update (cfg, "# transport addresses", -1, GNUNET_NO); + GNUNET_STATISTICS_update (cfg, + "# transport addresses", + -1, + GNUNET_NO); } } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Transport now has %u addresses to communicate\n", addresses); - GST_hello_modify_addresses (add_remove, address); + GST_hello_modify_addresses (add_remove, + address); } diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c index 4607902a28..f1a16f112f 100644 --- a/src/transport/gnunet-service-transport_hello.c +++ b/src/transport/gnunet-service-transport_hello.c @@ -76,6 +76,13 @@ struct OwnAddressList */ struct GNUNET_CRYPTO_EddsaSignature pong_signature; + /** + * How often has this address been added/removed? Used as + * some plugins may learn the same external address from + * multiple origins. + */ + unsigned int rc; + }; @@ -133,7 +140,7 @@ struct GeneratorContext /** - * Add an address from the 'OwnAddressList' to the buffer. + * Add an address from the `struct OwnAddressList` to the buffer. * * @param cls the `struct GeneratorContext` * @param max maximum number of bytes left @@ -151,8 +158,10 @@ address_generator (void *cls, if (NULL == gc->addr_pos) return GNUNET_SYSERR; /* Done */ - ret = GNUNET_HELLO_add_address (gc->addr_pos->address, gc->expiration, buf, - max); + ret = GNUNET_HELLO_add_address (gc->addr_pos->address, + gc->expiration, + buf, + max); gc->addr_pos = gc->addr_pos->next; return ret; } @@ -267,7 +276,7 @@ GST_hello_stop () const struct GNUNET_MessageHeader * GST_hello_get () { - return (struct GNUNET_MessageHeader *) our_hello; + return (const struct GNUNET_MessageHeader *) our_hello; } @@ -284,28 +293,44 @@ GST_hello_modify_addresses (int addremove, struct OwnAddressList *al; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - (addremove == - GNUNET_YES) ? "Adding `%s' to the set of our addresses\n" : - "Removing `%s' from the set of our addresses\n", + (GNUNET_YES == addremove) + ? "Adding `%s' to the set of our addresses\n" + : "Removing `%s' from the set of our addresses\n", GST_plugins_a2s (address)); - GNUNET_assert (address != NULL); + GNUNET_assert (NULL != address); + for (al = oal_head; al != NULL; al = al->next) + if (0 == GNUNET_HELLO_address_cmp (address, al->address)) + break; if (GNUNET_NO == addremove) { - for (al = oal_head; al != NULL; al = al->next) - if (0 == GNUNET_HELLO_address_cmp (address, al->address)) - { - GNUNET_CONTAINER_DLL_remove (oal_head, oal_tail, al); - GNUNET_HELLO_address_free (al->address); - GNUNET_free (al); - refresh_hello (); - return; - } - /* address to be removed not found!? */ - GNUNET_break (0); + if (NULL == al) + { + /* address to be removed not found!? */ + GNUNET_break (0); + return; + } + al->rc--; + if (0 != al->rc) + return; /* RC not yet zero */ + GNUNET_CONTAINER_DLL_remove (oal_head, + oal_tail, + al); + GNUNET_HELLO_address_free (al->address); + GNUNET_free (al); + refresh_hello (); + return; + } + if (NULL != al) + { + /* address added twice or more */ + al->rc++; return; } al = GNUNET_new (struct OwnAddressList); - GNUNET_CONTAINER_DLL_insert (oal_head, oal_tail, al); + al->rc = 1; + GNUNET_CONTAINER_DLL_insert (oal_head, + oal_tail, + al); al->address = GNUNET_HELLO_address_copy (address); refresh_hello (); } diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 5836f28bcf..c7ee5b6e57 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c @@ -2855,11 +2855,11 @@ udp_select_read (struct Plugin *plugin, return; } - - /* PROCESS STUN PACKET */ - if(GNUNET_NAT_is_valid_stun_packet(plugin->nat,(uint8_t *)buf, size )) - return; - + /* Check if this is a STUN packet */ + if (GNUNET_NAT_is_valid_stun_packet (plugin->nat, + (uint8_t *)buf, + size)) + return; /* was STUN, do not process further */ if (size < sizeof(struct GNUNET_MessageHeader)) { |