Browse Source

now checking for the correct connection-id we gave out

dynamic-accesslists
denis 16 years ago
parent
commit
a16b067e60
  1. 10
      ot_udp.c

10
ot_udp.c

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

Loading…
Cancel
Save