|
|
@ -27,14 +27,6 @@ static void udp_make_connectionid( uint32_t * connid, const ot_ip6 remoteip ) { |
|
|
|
memcpy( connid, g_static_connid, 8 ); |
|
|
|
memcpy( connid, g_static_connid, 8 ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int udp_test_connectionid( const uint32_t * const connid, const ot_ip6 remoteip ) { |
|
|
|
|
|
|
|
/* Touch unused variable */ |
|
|
|
|
|
|
|
(void)remoteip; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Test against our static secret */ |
|
|
|
|
|
|
|
return !memcmp( connid, g_static_connid, 8 ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 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_udp6( int64 serversocket, struct ot_workstruct *ws ) { |
|
|
|
void handle_udp6( int64 serversocket, struct ot_workstruct *ws ) { |
|
|
|
ot_peer peer; |
|
|
|
ot_peer peer; |
|
|
@ -73,9 +65,6 @@ void handle_udp6( int64 serversocket, struct ot_workstruct *ws ) { |
|
|
|
if( byte_count < 98 ) |
|
|
|
if( byte_count < 98 ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if( !udp_test_connectionid( inpacket, remoteip )) |
|
|
|
|
|
|
|
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]; |
|
|
|
|
|
|
|
|
|
|
@ -112,9 +101,6 @@ void handle_udp6( int64 serversocket, struct ot_workstruct *ws ) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case 2: /* This is a scrape action */ |
|
|
|
case 2: /* This is a scrape action */ |
|
|
|
if( !udp_test_connectionid( inpacket, remoteip )) |
|
|
|
|
|
|
|
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]; |
|
|
|
|
|
|
|
|
|
|
|