Changeset 7448


Ignore:
Timestamp:
Dec 21, 2008, 7:13:52 PM (12 years ago)
Author:
jhujhiti
Message:

add some debugging stuff to track down where some bogus addresses are coming from

Location:
trunk/libtransmission
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/net.c

    r7439 r7448  
    6969}
    7070
     71void
     72tr_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
    71101tr_bool
    72102tr_isAddress( const tr_address * a )
  • trunk/libtransmission/net.h

    r7436 r7448  
    8686void tr_normalizeV4Mapped( tr_address * const addr );
    8787
     88void tr_suspectAddress( const tr_address * a, const char * source );
    8889tr_bool tr_isAddress( const tr_address * a );
    8990
  • trunk/libtransmission/peer-mgr.c

    r7441 r7448  
    14331433    for( i = 0 ; i < n ; i++ ) {
    14341434        memcpy( &pex[i].addr, walk, sizeof( tr_address ) );
     1435        tr_suspectAddress( &pex[i].addr, "tracker"  );
    14351436        memcpy( &pex[i].port, walk + sizeof( tr_address ), 2 );
    14361437        pex[i].flags = 0x00;
  • trunk/libtransmission/peer-msgs.c

    r7447 r7448  
    21032103            for( i = 0; i < diffs.addedCount; ++i )
    21042104            {
     2105                tr_suspectAddress( &diffs.added[i].addr, "pex" );
    21052106                memcpy( walk, &diffs.added[i].addr.addr, 4 ); walk += 4;
    21062107                memcpy( walk, &diffs.added[i].port, 2 ); walk += 2;
     
    21332134            for( i = 0; i < diffs6.addedCount; ++i )
    21342135            {
     2136                tr_suspectAddress( &diffs6.added[i].addr, "pex6" );
    21352137                memcpy( walk, &diffs6.added[i].addr.addr.addr6.s6_addr, 16 );
    21362138                walk += 16;
  • trunk/libtransmission/tracker.c

    r7404 r7448  
    261261        memcpy( &addr.addr.addr4, compactWalk, 4 );
    262262        memcpy( &port, compactWalk + 4, 2 );
     263        tr_suspectAddress( &addr, "compact" );
    263264       
    264265        memcpy( walk, &addr, sizeof( addr ) );
     
    292293        memcpy( &addr.addr.addr6, compactWalk, 16 );
    293294        memcpy( &port, compactWalk + 16, 2 );
     295        tr_suspectAddress( &addr, "compact6" );
    294296       
    295297        memcpy( walk, &addr, sizeof( addr ) );
     
    356358        int64_t      itmp;
    357359        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];
    360362
    361363        if( tr_bencDictFindStr( peer, "ip", &s ) )
     
    369371
    370372        memcpy( walk, &addr, sizeof( tr_address ) );
     373        tr_suspectAddress( &addr, "old tracker" );
    371374        port = htons( itmp );
    372375        memcpy( walk + sizeof( tr_address ), &port, 2 );
Note: See TracChangeset for help on using the changeset viewer.