diff options
author | denis <> | 2008-09-15 00:55:17 +0000 |
---|---|---|
committer | denis <> | 2008-09-15 00:55:17 +0000 |
commit | a16b067e609d072b12963fb93143e8672e48f4bb (patch) | |
tree | d9f711fc8cf3eea9babac3234cb4b1f7ea3c1c30 /ot_udp.c | |
parent | 36559762234cd334d107bcc909962ebdceb7bdf5 (diff) |
now checking for the correct connection-id we gave out
Diffstat (limited to 'ot_udp.c')
-rw-r--r-- | ot_udp.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -30,7 +30,6 @@ static void udp_make_connectionid( uint32_t * connid, const char * remoteip ) { | |||
30 | memcpy( connid, g_static_connid, 8 ); | 30 | memcpy( connid, g_static_connid, 8 ); |
31 | } | 31 | } |
32 | 32 | ||
33 | #if 0 | ||
34 | static int udp_test_connectionid( const uint32_t * const connid, const char * remoteip ) { | 33 | static int udp_test_connectionid( const uint32_t * const connid, const char * remoteip ) { |
35 | /* Touch unused variable */ | 34 | /* Touch unused variable */ |
36 | (void)remoteip; | 35 | (void)remoteip; |
@@ -38,7 +37,6 @@ static int udp_test_connectionid( const uint32_t * const connid, const char * re | |||
38 | /* Test against our static secret */ | 37 | /* Test against our static secret */ |
39 | return !memcmp( connid, g_static_connid, 8 ); | 38 | return !memcmp( connid, g_static_connid, 8 ); |
40 | } | 39 | } |
41 | #endif | ||
42 | 40 | ||
43 | /* UDP implementation according to http://xbtt.sourceforge.net/udp_tracker_protocol.html */ | 41 | /* UDP implementation according to http://xbtt.sourceforge.net/udp_tracker_protocol.html */ |
44 | void handle_udp4( int64 serversocket ) { | 42 | void handle_udp4( int64 serversocket ) { |
@@ -81,8 +79,8 @@ void handle_udp4( int64 serversocket ) { | |||
81 | if( r < 98 ) | 79 | if( r < 98 ) |
82 | return; | 80 | return; |
83 | 81 | ||
84 | /* if( !udp_test_connectionid( inpacket, remoteip )) | 82 | if( !udp_test_connectionid( inpacket, remoteip )) |
85 | fprintf( stderr, "UDP Connection id missmatch.\n" ); */ | 83 | fprintf( stderr, "UDP connect Connection id missmatch.\n" ); |
86 | 84 | ||
87 | /* We do only want to know, if it is zero */ | 85 | /* We do only want to know, if it is zero */ |
88 | left = inpacket[64/4] | inpacket[68/4]; | 86 | left = inpacket[64/4] | inpacket[68/4]; |
@@ -125,8 +123,8 @@ void handle_udp4( int64 serversocket ) { | |||
125 | break; | 123 | break; |
126 | 124 | ||
127 | case 2: /* This is a scrape action */ | 125 | case 2: /* This is a scrape action */ |
128 | /* if( !udp_test_connectionid( inpacket, remoteip )) | 126 | if( !udp_test_connectionid( inpacket, remoteip )) |
129 | fprintf( stderr, "UDP Connection id missmatch.\n" ); */ | 127 | fprintf( stderr, "UDP scrape Connection id missmatch.\n" ); |
130 | 128 | ||
131 | outpacket[0] = htonl( 2 ); /* scrape action */ | 129 | outpacket[0] = htonl( 2 ); /* scrape action */ |
132 | outpacket[1] = inpacket[12/4]; | 130 | outpacket[1] = inpacket[12/4]; |