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

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

File:
1 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 )
Note: See TracChangeset for help on using the changeset viewer.