[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r9022 - in gnunet: . src/transport src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r9022 - in gnunet: . src/transport src/util |
Date: |
Wed, 23 Sep 2009 22:59:14 -0600 |
Author: amatus
Date: 2009-09-23 22:59:14 -0600 (Wed, 23 Sep 2009)
New Revision: 9022
Modified:
gnunet/configure.ac
gnunet/src/transport/plugin_transport_udp.c
gnunet/src/transport/test_plugin_transport.c
gnunet/src/util/service.c
gnunet/src/util/test_client.c
gnunet/src/util/test_connection.c
gnunet/src/util/test_connection_addressing.c
gnunet/src/util/test_connection_receive_cancel.c
gnunet/src/util/test_connection_timeout.c
gnunet/src/util/test_server.c
gnunet/src/util/test_server_disconnect.c
gnunet/src/util/test_server_with_client.c
Log:
FreeBSD has sockaddr_in.sin_len, and sockaddr_in6.sin6_len.
Modified: gnunet/configure.ac
===================================================================
--- gnunet/configure.ac 2009-09-23 21:50:04 UTC (rev 9021)
+++ gnunet/configure.ac 2009-09-24 04:59:14 UTC (rev 9022)
@@ -600,6 +600,15 @@
AC_HEADER_STDBOOL
AC_STRUCT_TM
+AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
+ [ AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [Do we have sockaddr_in.sin_len?])
+ ],
+ [],
+ [
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ ])
Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2009-09-23 21:50:04 UTC (rev
9021)
+++ gnunet/src/transport/plugin_transport_udp.c 2009-09-24 04:59:14 UTC (rev
9022)
@@ -362,6 +362,9 @@
if ((available & VERSION_AVAILABLE_IPV4) > 0)
{
memset (&serverAddrv4, 0, sizeof (serverAddrv4));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ serverAddrv4.sin_len = sizeof (serverAddrv4);
+#endif
serverAddrv4.sin_family = AF_INET;
serverAddrv4.sin_port = haddr->port;
memcpy (&serverAddrv4.sin_addr, &haddr->ipv4, sizeof (struct in_addr));
@@ -371,6 +374,9 @@
else
{
memset (&serverAddrv6, 0, sizeof (serverAddrv6));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ serverAddrv6.sin6_len = sizeof (serverAddrv6);
+#endif
serverAddrv6.sin6_family = AF_INET;
serverAddrv6.sin6_port = haddr->port;
memcpy (&serverAddrv6.sin6_addr, &haddr->ipv6,
@@ -438,6 +444,9 @@
if (available_protocols == VERSION_AVAILABLE_IPV4)
{
memset (&serverAddrv4, 0, sizeof (serverAddrv4));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ serverAddrv4.sin_len = sizeof (serverAddrv4);
+#endif
serverAddrv4.sin_family = AF_INET;
serverAddrv4.sin_addr.s_addr = INADDR_ANY;
serverAddrv4.sin_port = htons (port);
@@ -447,6 +456,9 @@
else
{
memset (&serverAddrv6, 0, sizeof (serverAddrv6));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ serverAddrv6.sin6_len = sizeof (serverAddrv6);
+#endif
serverAddrv6.sin6_family = AF_INET6;
serverAddrv6.sin6_addr = in6addr_any;
serverAddrv6.sin6_port = htons (port);
Modified: gnunet/src/transport/test_plugin_transport.c
===================================================================
--- gnunet/src/transport/test_plugin_transport.c 2009-09-23 21:50:04 UTC
(rev 9021)
+++ gnunet/src/transport/test_plugin_transport.c 2009-09-24 04:59:14 UTC
(rev 9022)
@@ -203,6 +203,9 @@
struct sockaddr_in soaddr;
memset (&soaddr, 0, sizeof(soaddr));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ soaddr.sin_len = sizeof (soaddr);
+#endif
soaddr.sin_family = AF_INET;
/* Sailor: set this port to 2367 to see the
testcase fail after 30s (because validation
Modified: gnunet/src/util/service.c
===================================================================
--- gnunet/src/util/service.c 2009-09-23 21:50:04 UTC (rev 9021)
+++ gnunet/src/util/service.c 2009-09-24 04:59:14 UTC (rev 9022)
@@ -942,8 +942,11 @@
if (disablev6)
{
/* V4-only */
- sctx->addrlen = sizeof (struct sockaddr_in6);
+ sctx->addrlen = sizeof (struct sockaddr_in);
sctx->addr = GNUNET_malloc (sctx->addrlen);
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ ((struct sockaddr_in *) sctx->addr)->sin_len = sctx->addrlen;
+#endif
((struct sockaddr_in *) sctx->addr)->sin_family = AF_INET;
((struct sockaddr_in *) sctx->addr)->sin_port = htons (port);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -956,6 +959,9 @@
/* dual stack */
sctx->addrlen = sizeof (struct sockaddr_in6);
sctx->addr = GNUNET_malloc (sctx->addrlen);
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ ((struct sockaddr_in6 *) sctx->addr)->sin6_len = sctx->addrlen;
+#endif
((struct sockaddr_in6 *) sctx->addr)->sin6_family = AF_INET6;
((struct sockaddr_in6 *) sctx->addr)->sin6_port = htons (port);
}
Modified: gnunet/src/util/test_client.c
===================================================================
--- gnunet/src/util/test_client.c 2009-09-23 21:50:04 UTC (rev 9021)
+++ gnunet/src/util/test_client.c 2009-09-24 04:59:14 UTC (rev 9022)
@@ -140,6 +140,9 @@
struct sockaddr_in sa;
memset (&sa, 0, sizeof (sa));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ sa.sin_len = sizeof (sa);
+#endif
sa.sin_family = AF_INET;
sa.sin_port = htons (PORT);
server = GNUNET_SERVER_create (tc->sched,
Modified: gnunet/src/util/test_connection.c
===================================================================
--- gnunet/src/util/test_connection.c 2009-09-23 21:50:04 UTC (rev 9021)
+++ gnunet/src/util/test_connection.c 2009-09-24 04:59:14 UTC (rev 9022)
@@ -57,6 +57,9 @@
struct GNUNET_NETWORK_Handle *desc;
memset (&sa, 0, sizeof (sa));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ sa.sin_len = sizeof (sa);
+#endif
sa.sin_port = htons (PORT);
sa.sin_family = AF_INET;
desc = GNUNET_NETWORK_socket_socket (AF_INET, SOCK_STREAM, 0);
Modified: gnunet/src/util/test_connection_addressing.c
===================================================================
--- gnunet/src/util/test_connection_addressing.c 2009-09-23 21:50:04 UTC
(rev 9021)
+++ gnunet/src/util/test_connection_addressing.c 2009-09-24 04:59:14 UTC
(rev 9022)
@@ -57,6 +57,9 @@
struct GNUNET_NETWORK_Handle *desc;
memset (&sa, 0, sizeof (sa));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ sa.sin_len = sizeof (sa);
+#endif
sa.sin_port = htons (PORT);
desc = GNUNET_NETWORK_socket_socket (AF_INET, SOCK_STREAM, 0);
GNUNET_assert (desc != 0);
@@ -115,6 +118,9 @@
GNUNET_assert (alen == sizeof (struct sockaddr_in));
v4 = addr;
memset (&expect, 0, sizeof (expect));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ expect.sin_len = sizeof (expect);
+#endif
expect.sin_family = AF_INET;
expect.sin_port = v4->sin_port;
expect.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
@@ -143,6 +149,9 @@
lsock = GNUNET_CONNECTION_create_from_existing (tc->sched, ls, 0);
GNUNET_assert (lsock != NULL);
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ v4.sin_len = sizeof (v4);
+#endif
v4.sin_family = AF_INET;
v4.sin_port = htons (PORT);
v4.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
Modified: gnunet/src/util/test_connection_receive_cancel.c
===================================================================
--- gnunet/src/util/test_connection_receive_cancel.c 2009-09-23 21:50:04 UTC
(rev 9021)
+++ gnunet/src/util/test_connection_receive_cancel.c 2009-09-24 04:59:14 UTC
(rev 9022)
@@ -58,6 +58,9 @@
struct GNUNET_NETWORK_Handle *desc;
memset (&sa, 0, sizeof (sa));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ sa.sin_len = sizeof (sa);
+#endif
sa.sin_port = htons (PORT);
desc = GNUNET_NETWORK_socket_socket (AF_INET, SOCK_STREAM, 0);
GNUNET_assert (desc != NULL);
Modified: gnunet/src/util/test_connection_timeout.c
===================================================================
--- gnunet/src/util/test_connection_timeout.c 2009-09-23 21:50:04 UTC (rev
9021)
+++ gnunet/src/util/test_connection_timeout.c 2009-09-24 04:59:14 UTC (rev
9022)
@@ -51,6 +51,9 @@
struct GNUNET_NETWORK_Handle *desc;
memset (&sa, 0, sizeof (sa));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ sa.sin_len = sizeof (sa);
+#endif
sa.sin_port = htons (PORT);
desc = GNUNET_NETWORK_socket_socket (AF_INET, SOCK_STREAM, 0);
GNUNET_assert (desc != NULL);
Modified: gnunet/src/util/test_server.c
===================================================================
--- gnunet/src/util/test_server.c 2009-09-23 21:50:04 UTC (rev 9021)
+++ gnunet/src/util/test_server.c 2009-09-24 04:59:14 UTC (rev 9022)
@@ -234,6 +234,9 @@
sched = tc->sched;
memset (&sa, 0, sizeof (sa));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ sa.sin_len = sizeof (sa);
+#endif
sa.sin_family = AF_INET;
sa.sin_port = htons (PORT);
server = GNUNET_SERVER_create (tc->sched,
Modified: gnunet/src/util/test_server_disconnect.c
===================================================================
--- gnunet/src/util/test_server_disconnect.c 2009-09-23 21:50:04 UTC (rev
9021)
+++ gnunet/src/util/test_server_disconnect.c 2009-09-24 04:59:14 UTC (rev
9022)
@@ -82,6 +82,9 @@
GNUNET_assert (addrlen == sizeof (struct sockaddr_in));
have = addr;
memset (&sa, 0, sizeof (sa));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ sa.sin_len = sizeof (sa);
+#endif
sa.sin_family = AF_INET;
sa.sin_port = have->sin_port;
sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
@@ -177,6 +180,9 @@
sched = tc->sched;
memset (&sa, 0, sizeof (sa));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ sa.sin_len = sizeof (sa);
+#endif
sa.sin_family = AF_INET;
sa.sin_port = htons (PORT);
server = GNUNET_SERVER_create (tc->sched,
Modified: gnunet/src/util/test_server_with_client.c
===================================================================
--- gnunet/src/util/test_server_with_client.c 2009-09-23 21:50:04 UTC (rev
9021)
+++ gnunet/src/util/test_server_with_client.c 2009-09-24 04:59:14 UTC (rev
9022)
@@ -74,6 +74,9 @@
GNUNET_assert (addrlen == sizeof (struct sockaddr_in));
have = addr;
memset (&sa, 0, sizeof (sa));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ sa.sin_len = sizeof (sa);
+#endif
sa.sin_family = AF_INET;
sa.sin_port = have->sin_port;
sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
@@ -151,6 +154,9 @@
sched = tc->sched;
memset (&sa, 0, sizeof (sa));
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ sa.sin_len = sizeof (sa);
+#endif
sa.sin_family = AF_INET;
sa.sin_port = htons (PORT);
server = GNUNET_SERVER_create (tc->sched,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r9022 - in gnunet: . src/transport src/util,
gnunet <=