gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r15236 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r15236 - gnunet/src/transport
Date: Mon, 16 May 2011 14:49:06 +0200

Author: wachs
Date: 2011-05-16 14:49:06 +0200 (Mon, 16 May 2011)
New Revision: 15236

Modified:
   gnunet/src/transport/plugin_transport_tcp.c
Log:
bug fix: ipv6 did not check bind address

ipv6 addresses were given to transport service even if service did bind to a 
specific ipv4 address
other peers could not validate that address




Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2011-05-16 12:03:55 UTC (rev 
15235)
+++ gnunet/src/transport/plugin_transport_tcp.c 2011-05-16 12:49:06 UTC (rev 
15236)
@@ -2165,7 +2165,7 @@
   void *arg;
   uint16_t args;
   void *arg_nat;
-  char buf[INET_ADDRSTRLEN];
+  char buf[INET6_ADDRSTRLEN];
 
   af = addr->sa_family;
   arg_nat = NULL;
@@ -2183,7 +2183,7 @@
 #if DEBUG_TCP
           GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 
                           "tcp",
-                          "Not notifying transport of address `%s' 
(redundant)\n",
+                          "Not notifying transport of address `%s' (does not 
match bind address)\n",
                           GNUNET_a2s (addr, addrlen));
 #endif
           return GNUNET_OK;
@@ -2215,6 +2215,25 @@
       memcpy (&t6.ipv6_addr,
              &((struct sockaddr_in6 *) addr)->sin6_addr,
              sizeof (struct in6_addr));
+
+      /* check bind address */
+      GNUNET_assert (NULL != inet_ntop(AF_INET6,
+                                      &t6.ipv6_addr,
+                                      buf,
+                                      sizeof (buf)));
+
+      if ( (plugin->bind_address != NULL) &&
+          (0 != strcmp(buf, plugin->bind_address)) )
+        {
+#if DEBUG_TCP
+          GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+                          "tcp",
+                          "Not notifying transport of address `%s' (does not 
match bind address)\n",
+                          GNUNET_a2s (addr, addrlen));
+#endif
+          return GNUNET_OK;
+        }
+
       add_to_address_list (plugin, 
                           &t6.ipv6_addr, 
                           sizeof (struct in6_addr));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]