gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r4978 - in GNUnet/src: applications/advertising application


From: gnunet
Subject: [GNUnet-SVN] r4978 - in GNUnet/src: applications/advertising applications/identity applications/session applications/transport server transports
Date: Sat, 9 Jun 2007 00:43:06 -0600 (MDT)

Author: grothoff
Date: 2007-06-09 00:43:06 -0600 (Sat, 09 Jun 2007)
New Revision: 4978

Modified:
   GNUnet/src/applications/advertising/advertising.c
   GNUnet/src/applications/identity/identity.c
   GNUnet/src/applications/session/connect.c
   GNUnet/src/applications/transport/transport.c
   GNUnet/src/server/connection.c
   GNUnet/src/transports/nat.c
   GNUnet/src/transports/tcp.c
   GNUnet/src/transports/udp.c
Log:
commenting out debug-only messages

Modified: GNUnet/src/applications/advertising/advertising.c
===================================================================
--- GNUnet/src/applications/advertising/advertising.c   2007-06-09 06:17:04 UTC 
(rev 4977)
+++ GNUnet/src/applications/advertising/advertising.c   2007-06-09 06:43:06 UTC 
(rev 4978)
@@ -60,7 +60,7 @@
 #define ACJ_FORWARD 2
 #define ACJ_ALL (ACJ_ANNOUNCE | ACJ_FORWARD)
 
-#define DEBUG_ADVERTISING YES
+#define DEBUG_ADVERTISING NO
 
 static CoreAPIForApplication * coreAPI;
 
@@ -199,9 +199,14 @@
   }
   if (SYSERR == transport->verifyhello(msg)) {
 #if DEBUG_ADVERTISING
+    IF_GELOG(ectx,
+            GE_INFO | GE_BULK | GE_USER,
+            hash2enc(&msg->senderIdentity.hashPubKey,
+                     &enc));    
     GE_LOG(ectx,
-          GE_INFO | GE_BULK | GE_USER,
-          "Transport verification of HELLO message failed (%u).\n",
+          GE_DEBUG | GE_BULK | GE_USER,
+          "Transport verification of HELLO message from `%s' failed (%u).\n",
+          &enc,
           ntohs(msg->protocol));
 #endif
     return OK; /* not good, but do process rest of message */

Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2007-06-09 06:17:04 UTC (rev 
4977)
+++ GNUnet/src/applications/identity/identity.c 2007-06-09 06:43:06 UTC (rev 
4978)
@@ -800,6 +800,7 @@
                       ANY_PROTOCOL_NUMBER,
                       YES);
   if (hello == NULL) {
+#if DEBUG_IDENTITY
     EncName enc;
 
     IF_GELOG(ectx,
@@ -810,6 +811,7 @@
           GE_INFO | GE_USER | GE_BULK,
           _("Signature failed verification: peer `%s' not known.\n"),
           &enc);
+#endif
     return SYSERR;
   }
   res = verifySig(message, size, sig,

Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c   2007-06-09 06:17:04 UTC (rev 
4977)
+++ GNUnet/src/applications/session/connect.c   2007-06-09 06:43:06 UTC (rev 
4978)
@@ -262,11 +262,11 @@
           &enc);
     return SYSERR;
   }
-  if (OK != identity->verifyPeerSignature
-      (hostId,
-       sks,
-       rsize - sizeof(Signature),
-       signature)) {
+  if (OK != identity->verifyPeerSignature(hostId,
+                                         sks,
+                                         rsize - sizeof(Signature),
+                                         signature)) {
+#if DEBUG_SESSION
     EncName enc;
 
     IF_GELOG(ectx,
@@ -277,6 +277,7 @@
           GE_INFO | GE_USER | GE_REQUEST,
           _("Session key from peer `%s' could not be verified.\n"),
           &enc);
+#endif
     return SYSERR; /*reject!*/
   }
   return OK; /* ok */
@@ -515,8 +516,8 @@
     hello = transport->createhello(ANY_PROTOCOL_NUMBER);
   if (NULL == hello) {
     GE_LOG(ectx,
-          GE_INFO | GE_USER | GE_REQUEST,
-          "Could not create any HELLO.  Not good.");
+          GE_ERROR | GE_USER | GE_IMMEDIATE,
+          _("Could not create any HELLO for myself!\n"));
   }
 #if DEBUG_SESSION
   GE_LOG(ectx,
@@ -649,12 +650,14 @@
                  sessionkeySigned,
                  sig);
   if (OK != ret) {
+#if DEBUG_SESSION
     if (ret == SYSERR)
       GE_LOG(ectx,
             GE_INFO | GE_USER | GE_REQUEST | GE_DEVELOPER,
             "Signature of session key from `%s' failed"
             " verification (discarded).\n",
             &enc);
+#endif
     if (stats != NULL)
       stats->change(stat_skeyRejected,
                    1);

Modified: GNUnet/src/applications/transport/transport.c
===================================================================
--- GNUnet/src/applications/transport/transport.c       2007-06-09 06:17:04 UTC 
(rev 4977)
+++ GNUnet/src/applications/transport/transport.c       2007-06-09 06:43:06 UTC 
(rev 4978)
@@ -230,6 +230,7 @@
   FREE(perm);
   MUTEX_UNLOCK(tapis_lock);
   if (ret == NULL) {
+#if DEBUG_TRANSPORT
     hash2enc(&peer->hashPubKey,
             &enc);
     GE_LOG(ectx,
@@ -237,6 +238,7 @@
           _("Transport failed to connect to peer `%s' (%u HELLOs known, none 
worked)\n"),
           &enc,
           hc);
+#endif
   }
   return ret;
 }

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2007-06-09 06:17:04 UTC (rev 4977)
+++ GNUnet/src/server/connection.c      2007-06-09 06:43:06 UTC (rev 4978)
@@ -2697,10 +2697,12 @@
   be = lookForHost(sender);
   if((be == NULL) ||
      (be->status == STAT_DOWN) || (be->status == STAT_SETKEY_SENT)) {
+#if DEBUG_CONNECTION
     GE_LOG(ectx,
           GE_INFO | GE_BULK | GE_USER,
           "Decrypting message from host `%s' failed, no sessionkey (yet)!\n",
           &enc);
+#endif
     /* try to establish a connection, that way, we don't keep
        getting bogus messages until the other one times out. */
     if((be == NULL) || (be->status == STAT_DOWN))

Modified: GNUnet/src/transports/nat.c
===================================================================
--- GNUnet/src/transports/nat.c 2007-06-09 06:17:04 UTC (rev 4977)
+++ GNUnet/src/transports/nat.c 2007-06-09 06:43:06 UTC (rev 4978)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     (C) 2003, 2004, 2005 Christian Grothoff (and other contributing authors)
+     (C) 2003, 2004, 2005, 2007 Christian Grothoff (and other contributing 
authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -60,9 +60,8 @@
 static int verifyHello(const P2P_hello_MESSAGE * hello) {
   if ( (ntohs(hello->senderAddressSize) != sizeof(HostAddress)) ||
        (ntohs(hello->header.size) != P2P_hello_MESSAGE_size(hello)) ||
-       (ntohs(hello->header.type) != p2p_PROTO_hello) ) {
-    return SYSERR; /* obviously invalid */
-  }
+       (ntohs(hello->header.type) != p2p_PROTO_hello) ) 
+    return SYSERR; /* obviously invalid */  
   if (YES == GC_get_configuration_value_yesno(coreAPI->cfg,
                                              "NAT",
                                              "LIMITED",
@@ -73,8 +72,7 @@
                    &hello->senderIdentity.hashPubKey,
                    sizeof(HashCode512)))
       return OK;
-    else
-      return SYSERR;
+    return SYSERR;
   }
   return OK;  
 }
@@ -157,7 +155,7 @@
  *
  * @return OK on success, SYSERR if the operation failed
  */
-static int startTransportServer(void) {
+static int startTransportServer() {
   return OK;
 }
 

Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2007-06-09 06:17:04 UTC (rev 4977)
+++ GNUnet/src/transports/tcp.c 2007-06-09 06:43:06 UTC (rev 4978)
@@ -258,7 +258,7 @@
     }
     return NULL; /* TCP transport is configured SEND-only! */
   }
-  msg = (P2P_hello_MESSAGE *) MALLOC(sizeof(P2P_hello_MESSAGE) + 
sizeof(HostAddress));
+  msg = MALLOC(sizeof(P2P_hello_MESSAGE) + sizeof(HostAddress));
   haddr = (HostAddress*) &msg[1];
 
   if (! ( ( (upnp != NULL) &&
@@ -274,12 +274,10 @@
           _("TCP: Could not determine my public IP address.\n"));
     return NULL;
   }
-#if DEBUG_TCP
   GE_LOG(ectx,
-        GE_DEBUG | GE_USER | GE_REQUEST,
+        GE_INFO | GE_USER | GE_BULK,
         "TCP uses IP address %u.%u.%u.%u.\n",
         PRIP(ntohl(*(int*)&haddr->ip)));
-#endif
   haddr->port = htons(port);
   haddr->reserved = htons(0);
   msg->senderAddressSize = htons(sizeof(HostAddress));

Modified: GNUnet/src/transports/udp.c
===================================================================
--- GNUnet/src/transports/udp.c 2007-06-09 06:17:04 UTC (rev 4977)
+++ GNUnet/src/transports/udp.c 2007-06-09 06:43:06 UTC (rev 4978)
@@ -233,12 +233,23 @@
   haddr = (const HostAddress*) &hello[1];
   if ( (ntohs(hello->senderAddressSize) != sizeof(HostAddress)) ||
        (ntohs(hello->header.size) != P2P_hello_MESSAGE_size(hello)) ||
-       (ntohs(hello->header.type) != p2p_PROTO_hello) ||
-       (YES == isBlacklisted(&haddr->senderIP,
+       (ntohs(hello->header.type) != p2p_PROTO_hello) ) {
+    GE_BREAK(NULL, 0);
+    return SYSERR;
+  }
+  if ( (YES == isBlacklisted(&haddr->senderIP,
                             sizeof(IPaddr))) ||
        (YES != isWhitelisted(&haddr->senderIP,
-                            sizeof(IPaddr))) )
+                            sizeof(IPaddr))) ) {
+#if DEBUG_UDP
+    GE_LOG(ectx,
+          GE_DEBUG | GE_USER | GE_BULK,
+          "Rejecting UDP HELLO from %u.%u.%u.%u:%u due to configuration.\n",
+          PRIP(ntohl(*(int*)&haddr->senderIP.addr)),
+          ntohs(haddr->senderPort));
+#endif
     return SYSERR; /* obviously invalid */
+  }
 #if DEBUG_UDP
   GE_LOG(ectx,
         GE_DEBUG | GE_USER | GE_BULK,
@@ -282,12 +293,10 @@
           _("UDP: Could not determine my public IP address.\n"));
     return NULL;
   }
-#if DEBUG_UDP
   GE_LOG(ectx,
-        GE_DEBUG | GE_USER | GE_BULK,
+        GE_INFO | GE_USER | GE_BULK,
         "UDP uses IP address %u.%u.%u.%u.\n",
         PRIP(ntohl(*(int*)&haddr->senderIP)));
-#endif
   haddr->senderPort      = htons(port);
   haddr->reserved        = htons(0);
   msg->senderAddressSize = htons(sizeof(HostAddress));





reply via email to

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