aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-10-07 13:57:31 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-10-07 13:57:31 +0000
commit5bb85241624abcab1e6d78d334ec25d282621d49 (patch)
treeb6d2db3136e236c5a5ba370a55a7807fc33b0e67 /src/transport/plugin_transport_http.c
parent14d30b9759fad1d797fe0650c11b38b869163e51 (diff)
downloadgnunet-5bb85241624abcab1e6d78d334ec25d282621d49.tar.gz
gnunet-5bb85241624abcab1e6d78d334ec25d282621d49.zip
Diffstat (limited to 'src/transport/plugin_transport_http.c')
-rw-r--r--src/transport/plugin_transport_http.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index bf63769f7..48ae22bc0 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -377,7 +377,7 @@ struct Plugin
377 /** 377 /**
378 * Plugin Port 378 * Plugin Port
379 */ 379 */
380 unsigned int port_inbound; 380 uint16_t port_inbound;
381 381
382 struct GNUNET_CONTAINER_MultiHashMap *peers; 382 struct GNUNET_CONTAINER_MultiHashMap *peers;
383 383
@@ -2512,8 +2512,6 @@ http_plugin_address_suggested (void *cls,
2512 2512
2513 struct IPv4HttpAddress *tv4 = plugin->ipv4_addr_head; 2513 struct IPv4HttpAddress *tv4 = plugin->ipv4_addr_head;
2514 struct IPv6HttpAddress *tv6 = plugin->ipv6_addr_head; 2514 struct IPv6HttpAddress *tv6 = plugin->ipv6_addr_head;
2515 int res;
2516 unsigned int port;
2517 2515
2518 GNUNET_assert(cls !=NULL); 2516 GNUNET_assert(cls !=NULL);
2519 if ((addrlen != sizeof (struct IPv4HttpAddress)) && 2517 if ((addrlen != sizeof (struct IPv4HttpAddress)) &&
@@ -2532,25 +2530,21 @@ http_plugin_address_suggested (void *cls,
2532 2530
2533 if (plugin->bind4_address!=NULL) 2531 if (plugin->bind4_address!=NULL)
2534 { 2532 {
2535 res = memcmp (&plugin->bind4_address->sin_addr, &v4->ipv4_addr, sizeof(uint32_t)); 2533 if (0 == memcmp (&plugin->bind4_address->sin_addr, &v4->ipv4_addr, sizeof(uint32_t)) && (ntohs (v4->u_port) == plugin->port_inbound))
2536 if ((res==0) && (ntohs (v4->u_port) == plugin->port_inbound))
2537 return GNUNET_OK; 2534 return GNUNET_OK;
2538 else 2535 else
2539 return GNUNET_SYSERR; 2536 return GNUNET_SYSERR;
2540 } 2537 }
2541
2542 while (tv4!=NULL) 2538 while (tv4!=NULL)
2543 { 2539 {
2544 res = memcmp (&tv4->ipv4_addr, &v4->ipv4_addr, sizeof(uint32_t)); 2540 if (0==memcmp (&tv4->ipv4_addr, &v4->ipv4_addr, sizeof(uint32_t)))
2545 if ((res==0) && (v4->u_port == tv4->u_port) && (ntohs (v4->u_port) == plugin->port_inbound)) 2541 break;
2546 return GNUNET_OK;
2547 tv4 = tv4->next; 2542 tv4 = tv4->next;
2548 } 2543 }
2549 port = ntohs (v4->u_port); 2544 if ((tv4 !=NULL) && (ntohs (v4->u_port) == plugin->port_inbound))
2550 if (port != plugin->port_inbound) 2545 return GNUNET_OK;
2551 { 2546 else
2552 return GNUNET_SYSERR; 2547 return GNUNET_SYSERR;
2553 }
2554 } 2548 }
2555 if (addrlen == sizeof (struct IPv6HttpAddress)) 2549 if (addrlen == sizeof (struct IPv6HttpAddress))
2556 { 2550 {
@@ -2558,8 +2552,7 @@ http_plugin_address_suggested (void *cls,
2558 2552
2559 if (plugin->bind6_address!=NULL) 2553 if (plugin->bind6_address!=NULL)
2560 { 2554 {
2561 res = memcmp (&plugin->bind6_address->sin6_addr, &v6->ipv6_addr, sizeof(struct in6_addr)); 2555 if (0 == memcmp (&plugin->bind6_address->sin6_addr, &v6->ipv6_addr, sizeof(struct in6_addr)))
2562 if ((res==0) && (ntohs (v6->u6_port) == plugin->port_inbound))
2563 return GNUNET_OK; 2556 return GNUNET_OK;
2564 else 2557 else
2565 return GNUNET_SYSERR; 2558 return GNUNET_SYSERR;
@@ -2567,11 +2560,14 @@ http_plugin_address_suggested (void *cls,
2567 2560
2568 while (tv6!=NULL) 2561 while (tv6!=NULL)
2569 { 2562 {
2570 res = memcmp (&tv6->ipv6_addr, &v6->ipv6_addr, sizeof(struct in6_addr)); 2563 if (0 == memcmp (&tv6->ipv6_addr, &v6->ipv6_addr, sizeof(struct in6_addr)))
2571 if ((res==0) && (v6->u6_port == tv6->u6_port) && (ntohs (v6->u6_port) == plugin->port_inbound)) 2564 break;
2572 return GNUNET_OK;
2573 tv6 = tv6->next; 2565 tv6 = tv6->next;
2574 } 2566 }
2567 if ((tv6 !=NULL) && (ntohs (v6->u6_port) == plugin->port_inbound))
2568 return GNUNET_OK;
2569 else
2570 return GNUNET_SYSERR;
2575 } 2571 }
2576 2572
2577 return GNUNET_SYSERR; 2573 return GNUNET_SYSERR;