From a16b067e609d072b12963fb93143e8672e48f4bb Mon Sep 17 00:00:00 2001
From: denis <>
Date: Mon, 15 Sep 2008 00:55:17 +0000
Subject: now checking for the correct connection-id we gave out

---
 ot_udp.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/ot_udp.c b/ot_udp.c
index c841375..0a6458e 100644
--- a/ot_udp.c
+++ b/ot_udp.c
@@ -30,7 +30,6 @@ static void udp_make_connectionid( uint32_t * connid, const char * remoteip ) {
   memcpy( connid, g_static_connid, 8 );
 }
 
-#if 0
 static int udp_test_connectionid( const uint32_t * const connid, const char * remoteip ) {
   /* Touch unused variable */
   (void)remoteip;
@@ -38,7 +37,6 @@ static int udp_test_connectionid( const uint32_t * const connid, const char * re
   /* Test against our static secret */
   return !memcmp( connid, g_static_connid, 8 );
 }
-#endif
 
 /* UDP implementation according to http://xbtt.sourceforge.net/udp_tracker_protocol.html */
 void handle_udp4( int64 serversocket ) {
@@ -81,8 +79,8 @@ void handle_udp4( int64 serversocket ) {
       if( r < 98 )
         return;
 
-/*      if( !udp_test_connectionid( inpacket, remoteip ))
-        fprintf( stderr, "UDP Connection id missmatch.\n" ); */
+        if( !udp_test_connectionid( inpacket, remoteip ))
+        fprintf( stderr, "UDP connect Connection id missmatch.\n" );
 
       /* We do only want to know, if it is zero */
       left  = inpacket[64/4] | inpacket[68/4];
@@ -125,8 +123,8 @@ void handle_udp4( int64 serversocket ) {
       break;
 
     case 2: /* This is a scrape action */
-/*      if( !udp_test_connectionid( inpacket, remoteip ))
-        fprintf( stderr, "UDP Connection id missmatch.\n" ); */
+        if( !udp_test_connectionid( inpacket, remoteip ))
+        fprintf( stderr, "UDP scrape Connection id missmatch.\n" );
 
       outpacket[0] = htonl( 2 );    /* scrape action */
       outpacket[1] = inpacket[12/4];
-- 
cgit v1.2.3