aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transport/plugin_transport_http.c57
1 files changed, 9 insertions, 48 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index de91935e8..8d9aa3646 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -2917,7 +2917,6 @@ tcp_nat_cb_add_addr (void *cls,
2917 switch (af) 2917 switch (af)
2918 { 2918 {
2919 case AF_INET: 2919 case AF_INET:
2920 return;
2921 t4 = plugin->ipv4_addr_head; 2920 t4 = plugin->ipv4_addr_head;
2922 while (t4 != NULL) 2921 while (t4 != NULL)
2923 { 2922 {
@@ -2952,12 +2951,7 @@ tcp_nat_cb_add_addr (void *cls,
2952 &((struct sockaddr_in6 *) addr)->sin6_addr, 2951 &((struct sockaddr_in6 *) addr)->sin6_addr,
2953 sizeof (struct in6_addr)); 2952 sizeof (struct in6_addr));
2954 if (0 == res) 2953 if (0 == res)
2955 {
2956 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
2957 "tcp",
2958 "FOUND\n");
2959 break; 2954 break;
2960 }
2961 t6 = t6->next; 2955 t6 = t6->next;
2962 } 2956 }
2963 if (t6 == NULL) 2957 if (t6 == NULL)
@@ -2968,9 +2962,6 @@ tcp_nat_cb_add_addr (void *cls,
2968 &((struct sockaddr_in6 *) addr)->sin6_addr, 2962 &((struct sockaddr_in6 *) addr)->sin6_addr,
2969 sizeof (struct in6_addr)); 2963 sizeof (struct in6_addr));
2970 t6->u6_port = htons (plugin->port_inbound); 2964 t6->u6_port = htons (plugin->port_inbound);
2971 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
2972 "tcp",
2973 "Added `%s' to our address set\n", http_plugin_address_to_string(NULL, t6, sizeof (struct IPv6HttpAddress)));
2974 GNUNET_CONTAINER_DLL_insert(plugin->ipv6_addr_head, 2965 GNUNET_CONTAINER_DLL_insert(plugin->ipv6_addr_head,
2975 plugin->ipv6_addr_tail,t6); 2966 plugin->ipv6_addr_tail,t6);
2976 } 2967 }
@@ -2999,7 +2990,6 @@ tcp_nat_cb_remove_addr (void *cls,
2999 switch (af) 2990 switch (af)
3000 { 2991 {
3001 case AF_INET: 2992 case AF_INET:
3002 return;
3003 t4 = plugin->ipv4_addr_head; 2993 t4 = plugin->ipv4_addr_head;
3004 while (t4 != NULL) 2994 while (t4 != NULL)
3005 { 2995 {
@@ -3028,19 +3018,11 @@ tcp_nat_cb_remove_addr (void *cls,
3028 &((struct sockaddr_in6 *) addr)->sin6_addr, 3018 &((struct sockaddr_in6 *) addr)->sin6_addr,
3029 sizeof (struct in6_addr)); 3019 sizeof (struct in6_addr));
3030 if (0 == res) 3020 if (0 == res)
3031 {
3032 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
3033 "tcp",
3034 "FOUND\n");
3035 break; 3021 break;
3036 }
3037 t6 = t6->next; 3022 t6 = t6->next;
3038 } 3023 }
3039 if (t6 == NULL) 3024 if (t6 == NULL)
3040 return; 3025 return;
3041 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
3042 "tcp",
3043 "Removing `%s' from our address set\n", http_plugin_address_to_string(NULL, t6, sizeof (struct IPv6HttpAddress)));
3044 plugin->env->notify_address(plugin->env->cls, 3026 plugin->env->notify_address(plugin->env->cls,
3045 add_remove, 3027 add_remove,
3046 t6, sizeof (struct IPv6HttpAddress)); 3028 t6, sizeof (struct IPv6HttpAddress));
@@ -3071,12 +3053,12 @@ tcp_nat_port_map_callback (void *cls,
3071 socklen_t addrlen) 3053 socklen_t addrlen)
3072{ 3054{
3073 GNUNET_assert(cls !=NULL ); 3055 GNUNET_assert(cls !=NULL );
3074 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, 3056#if DEBUG_HTTP
3075 "tcp", 3057 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
3076 "NPMC called with %d for address `%s'\n", 3058 "NPMC called to %s address `%s'\n",
3077 add_remove, 3059 (add_remove == GNUNET_YES) ? "remove" : "add",
3078 GNUNET_a2s (addr, addrlen)); 3060 GNUNET_a2s (addr, addrlen));
3079 3061#endif
3080 /* convert 'addr' to our internal format */ 3062 /* convert 'addr' to our internal format */
3081 switch (add_remove) 3063 switch (add_remove)
3082 { 3064 {
@@ -3243,7 +3225,9 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
3243 struct GNUNET_TIME_Relative gn_timeout; 3225 struct GNUNET_TIME_Relative gn_timeout;
3244 long long unsigned int port; 3226 long long unsigned int port;
3245 unsigned long long tneigh; 3227 unsigned long long tneigh;
3246 int addr_count = 0; 3228 struct sockaddr **addrs;
3229 socklen_t *addrlens;
3230 int ret;
3247 char * component_name; 3231 char * component_name;
3248#if BUILD_HTTPS 3232#if BUILD_HTTPS
3249 char * key_file = NULL; 3233 char * key_file = NULL;
@@ -3620,14 +3604,6 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
3620 return NULL; 3604 return NULL;
3621 } 3605 }
3622 3606
3623 if (plugin->bind4_address != NULL)
3624 addr_count++;
3625 if (plugin->bind6_address != NULL)
3626 addr_count++;
3627
3628 struct sockaddr **addrs;
3629 socklen_t *addrlens;
3630 int ret;
3631 ret = GNUNET_SERVICE_get_server_addresses (component_name, 3607 ret = GNUNET_SERVICE_get_server_addresses (component_name,
3632 env->cfg, 3608 env->cfg,
3633 &addrs, 3609 &addrs,
@@ -3635,22 +3611,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
3635 3611
3636 if (ret != GNUNET_SYSERR) 3612 if (ret != GNUNET_SYSERR)
3637 { 3613 {
3638 int counter = 0; 3614 plugin->nat = GNUNET_NAT_register (env->cfg,
3639 struct sockaddr *tmp = addrs[counter];
3640 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
3641 component_name,
3642 "addresses %u\n",ret);
3643 while (tmp!= NULL)
3644 {
3645 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
3646 component_name,
3647 "address[%u] %s\n",counter, (tmp->sa_family == AF_INET) ? "AF_INET" : "AF_INET6" );
3648 counter++;
3649 tmp = addrs[counter];
3650 }
3651
3652
3653 plugin->nat = GNUNET_NAT_register (env->cfg,
3654 GNUNET_YES, 3615 GNUNET_YES,
3655 port, 3616 port,
3656 (unsigned int) ret, 3617 (unsigned int) ret,