gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r20071 - gnunet/src/transport
Date: Mon, 27 Feb 2012 16:23:32 +0100

Author: wachs
Date: 2012-02-27 16:23:32 +0100 (Mon, 27 Feb 2012)
New Revision: 20071

Modified:
   gnunet/src/transport/plugin_transport_udp.c
Log:
- improved nat handling


Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2012-02-27 15:23:15 UTC (rev 
20070)
+++ gnunet/src/transport/plugin_transport_udp.c 2012-02-27 15:23:32 UTC (rev 
20071)
@@ -762,6 +762,8 @@
 {
   struct Session * s = NULL;
   struct Plugin * plugin = cls;
+  struct IPv6UdpAddress * udp_a6;
+  struct IPv4UdpAddress * udp_a4;
 
   GNUNET_assert (plugin != NULL);
   GNUNET_assert (address != NULL);
@@ -775,15 +777,24 @@
     return NULL;
   }
 
-  if ((address->address_length == sizeof (struct IPv4UdpAddress)) &&
-      (plugin->sockv4 == NULL))
-    return NULL;
+  if (address->address_length == sizeof (struct IPv4UdpAddress))
+  {
+    if (plugin->sockv4 == NULL)
+      return NULL;
+    udp_a4 = (struct IPv4UdpAddress *) address->address;
+    if (udp_a4->u4_port == 0)
+      return NULL;
+  }
 
-  if ((address->address_length == sizeof (struct IPv6UdpAddress)) &&
-      (plugin->sockv6 == NULL))
-    return NULL;
+  if (address->address_length == sizeof (struct IPv6UdpAddress))
+  {
+    if (plugin->sockv6 == NULL)
+      return NULL;
+    udp_a6 = (struct IPv6UdpAddress *) address->address;
+    if (udp_a6->u6_port == 0)
+      return NULL;
+  }
 
-
   /* check if session already exists */
   struct SessionCompareContext cctx;
   cctx.addr = address;




reply via email to

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