From 80f20e7e7b5602b17276ec70b5990809f629334e Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Tue, 15 Jun 2010 10:01:49 +0000 Subject: [PATCH] --- src/transport/plugin_transport_http.c | 12 ++++++------ src/transport/test_plugin_transport_http.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index a07a52316..b04497765 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c @@ -1358,17 +1358,18 @@ http_plugin_address_suggested (void *cls, if ((addrlen != sizeof (struct IPv4HttpAddress)) && (addrlen != sizeof (struct IPv6HttpAddress))) { - GNUNET_break_op (0); return GNUNET_SYSERR; } if (addrlen == sizeof (struct IPv4HttpAddress)) { v4 = (struct IPv4HttpAddress *) addr; - + if (INADDR_LOOPBACK == ntohl(v4->ipv4_addr)) + { + return GNUNET_SYSERR; + } port = ntohs (v4->u_port); if (port != plugin->port_inbound) { - GNUNET_break_op (0); return GNUNET_SYSERR; } } @@ -1377,17 +1378,16 @@ http_plugin_address_suggested (void *cls, v6 = (struct IPv6HttpAddress *) addr; if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) { - GNUNET_break_op (0); return GNUNET_SYSERR; } port = ntohs (v6->u6_port); if (port != plugin->port_inbound) { - GNUNET_break_op (0); return GNUNET_SYSERR; } - } + + return GNUNET_OK; } diff --git a/src/transport/test_plugin_transport_http.c b/src/transport/test_plugin_transport_http.c index efeaab9a1..8bec6b012 100644 --- a/src/transport/test_plugin_transport_http.c +++ b/src/transport/test_plugin_transport_http.c @@ -1090,20 +1090,20 @@ run (void *cls, /* Suggesting addresses with wrong port*/ struct IPv4HttpAddress failing_addr; - failing_addr.ipv4_addr = INADDR_LOOPBACK; - failing_addr.u_port = 0; + failing_addr.ipv4_addr = htonl(INADDR_LOOPBACK); + failing_addr.u_port = htons(0); suggest_res = api->check_address (NULL,&failing_addr,sizeof (struct IPv4HttpAddress)); GNUNET_assert (GNUNET_SYSERR == suggest_res); /* Suggesting addresses with wrong size*/ - failing_addr.ipv4_addr = INADDR_LOOPBACK; - failing_addr.u_port = 0; + failing_addr.ipv4_addr = htonl(INADDR_LOOPBACK); + failing_addr.u_port = htons(0); suggest_res = api->check_address (NULL,&failing_addr,sizeof (struct IPv6HttpAddress)); GNUNET_assert (GNUNET_SYSERR == suggest_res); /* Suggesting addresses with wrong address*/ - failing_addr.ipv4_addr = 0; - failing_addr.u_port = 12389; + failing_addr.ipv4_addr = htonl(INADDR_LOOPBACK); + failing_addr.u_port = htons(12389); suggest_res = api->check_address (NULL,&failing_addr,sizeof (struct IPv4HttpAddress)); GNUNET_assert (GNUNET_SYSERR == suggest_res); -- 2.25.1