Changeset 7448
- Timestamp:
- Dec 21, 2008, 7:13:52 PM (12 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/net.c
r7439 r7448 69 69 } 70 70 71 void 72 tr_suspectAddress( const tr_address * a, const char * source ) 73 { 74 /* be really aggressive in what we report */ 75 if( a->type == TR_AF_INET && !( a->addr.addr4.s_addr & 0xff000000 ) ) 76 tr_dbg( "Funny looking address %s from %s", tr_ntop_non_ts( a ), source ); 77 /* /16s taken from ipv6 rib on 21 dec, 2008 */ 78 /* this is really, really ugly. expedience over quality */ 79 if( a->type == TR_AF_INET6 ) 80 { 81 uint16_t slash16; 82 uint16_t valid[] = { 0x339, 0x2002, 0x2003, 0x2400, 0x2401, 0x2402, 83 0x2403, 0x2404, 0x2405, 0x2406, 0x2407, 0x2600, 0x2607, 0x2610, 84 0x2620, 0x2800, 0x2801, 0x2a00, 0x2a01, 0x0a02, 0x2001, 0x0000 }; 85 uint16_t *p; 86 tr_bool good = FALSE; 87 p = valid; 88 memcpy( &slash16, &a->addr, 2 ); 89 slash16 = ntohs( slash16 ); 90 while( *p ) 91 { 92 if( slash16 == *p ) 93 good = TRUE; 94 p++; 95 } 96 if( !good ) 97 tr_dbg( "Funny looking address %s from %s", tr_ntop_non_ts( a ), source ); 98 } 99 } 100 71 101 tr_bool 72 102 tr_isAddress( const tr_address * a ) -
trunk/libtransmission/net.h
r7436 r7448 86 86 void tr_normalizeV4Mapped( tr_address * const addr ); 87 87 88 void tr_suspectAddress( const tr_address * a, const char * source ); 88 89 tr_bool tr_isAddress( const tr_address * a ); 89 90 -
trunk/libtransmission/peer-mgr.c
r7441 r7448 1433 1433 for( i = 0 ; i < n ; i++ ) { 1434 1434 memcpy( &pex[i].addr, walk, sizeof( tr_address ) ); 1435 tr_suspectAddress( &pex[i].addr, "tracker" ); 1435 1436 memcpy( &pex[i].port, walk + sizeof( tr_address ), 2 ); 1436 1437 pex[i].flags = 0x00; -
trunk/libtransmission/peer-msgs.c
r7447 r7448 2103 2103 for( i = 0; i < diffs.addedCount; ++i ) 2104 2104 { 2105 tr_suspectAddress( &diffs.added[i].addr, "pex" ); 2105 2106 memcpy( walk, &diffs.added[i].addr.addr, 4 ); walk += 4; 2106 2107 memcpy( walk, &diffs.added[i].port, 2 ); walk += 2; … … 2133 2134 for( i = 0; i < diffs6.addedCount; ++i ) 2134 2135 { 2136 tr_suspectAddress( &diffs6.added[i].addr, "pex6" ); 2135 2137 memcpy( walk, &diffs6.added[i].addr.addr.addr6.s6_addr, 16 ); 2136 2138 walk += 16; -
trunk/libtransmission/tracker.c
r7404 r7448 261 261 memcpy( &addr.addr.addr4, compactWalk, 4 ); 262 262 memcpy( &port, compactWalk + 4, 2 ); 263 tr_suspectAddress( &addr, "compact" ); 263 264 264 265 memcpy( walk, &addr, sizeof( addr ) ); … … 292 293 memcpy( &addr.addr.addr6, compactWalk, 16 ); 293 294 memcpy( &port, compactWalk + 16, 2 ); 295 tr_suspectAddress( &addr, "compact6" ); 294 296 295 297 memcpy( walk, &addr, sizeof( addr ) ); … … 356 358 int64_t itmp; 357 359 tr_address addr; 358 tr_port port;359 tr_benc *peer = &bePeers->val.l.vals[i];360 tr_port port; 361 tr_benc * peer = &bePeers->val.l.vals[i]; 360 362 361 363 if( tr_bencDictFindStr( peer, "ip", &s ) ) … … 369 371 370 372 memcpy( walk, &addr, sizeof( tr_address ) ); 373 tr_suspectAddress( &addr, "old tracker" ); 371 374 port = htons( itmp ); 372 375 memcpy( walk + sizeof( tr_address ), &port, 2 );
Note: See TracChangeset
for help on using the changeset viewer.