gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6483 - GNUnet/src/transports


From: gnunet
Subject: [GNUnet-SVN] r6483 - GNUnet/src/transports
Date: Thu, 28 Feb 2008 00:08:28 -0700 (MST)

Author: grothoff
Date: 2008-02-28 00:08:28 -0700 (Thu, 28 Feb 2008)
New Revision: 6483

Modified:
   GNUnet/src/transports/common.c
Log:
better reporting

Modified: GNUnet/src/transports/common.c
===================================================================
--- GNUnet/src/transports/common.c      2008-02-28 05:58:12 UTC (rev 6482)
+++ GNUnet/src/transports/common.c      2008-02-28 07:08:28 UTC (rev 6483)
@@ -206,27 +206,34 @@
 
   haddr = (HostAddress *) & hello[1];
   if ((ntohs (hello->senderAddressSize) != sizeof (HostAddress)) ||
-      (ntohs (hello->header.size) != GNUNET_sizeof_hello (hello)) ||
-      (ntohs (hello->header.type) != GNUNET_P2P_PROTO_HELLO) ||
-      (ntohs (hello->protocol) != myAPI.protocolNumber) ||
-      (0 ==
-       (ntohs (haddr->availability) &
-        (VERSION_AVAILABLE_IPV6 | VERSION_AVAILABLE_IPV4)))
-      || ((0 != (ntohs (haddr->availability) & VERSION_AVAILABLE_IPV4))
-          &&
-          ((GNUNET_YES ==
-            is_blacklisted_ipv4 (&haddr->ipv4))
-           || (GNUNET_YES !=
-               is_whitelisted_ipv4 (&haddr->ipv4))))
-      || ((0 != (ntohs (haddr->availability) & VERSION_AVAILABLE_IPV6))
-          &&
-          ((GNUNET_YES ==
-            is_blacklisted_ipv6 (&haddr->ipv6))
-           || (GNUNET_YES != is_whitelisted_ipv6 (&haddr->ipv6)))))
+      (ntohs (hello->header.size) != GNUNET_sizeof_hello (hello)) )
     {
       GNUNET_GE_BREAK_OP (NULL, 0);
-      return GNUNET_SYSERR;     /* invalid */
+      return GNUNET_SYSERR;     /* invalid (external error) */
     }
+  if ( (ntohs (hello->protocol) != myAPI.protocolNumber) ||
+       (ntohs (hello->header.type) != GNUNET_P2P_PROTO_HELLO) )     
+    {
+      GNUNET_GE_BREAK (NULL, 0);
+      return GNUNET_SYSERR;     /* invalid (internal error) */
+    }
+  if ( (0 ==
+       (ntohs (haddr->availability) &
+        (VERSION_AVAILABLE_IPV6 | VERSION_AVAILABLE_IPV4)))
+       || ((0 != (ntohs (haddr->availability) & VERSION_AVAILABLE_IPV4))
+          &&
+          ((GNUNET_YES ==
+            is_blacklisted_ipv4 (&haddr->ipv4))
+           || (GNUNET_YES !=
+               is_whitelisted_ipv4 (&haddr->ipv4))))
+       || ((0 != (ntohs (haddr->availability) & VERSION_AVAILABLE_IPV6))
+          &&
+          ((GNUNET_YES ==
+            is_blacklisted_ipv6 (&haddr->ipv6))
+           || (GNUNET_YES != is_whitelisted_ipv6 (&haddr->ipv6)))))
+    {
+      return GNUNET_SYSERR;     /* invalid, incompatible with us */
+    }
   return GNUNET_OK;
 }
 





reply via email to

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