Changeset 11611


Ignore:
Timestamp:
Dec 30, 2010, 7:17:33 PM (10 years ago)
Author:
charles
Message:

(2.1x libT) #3528 "TR_PREFS_KEY_BIND_ADDRESS_IPV4 breaks IPv6-only trackers" -- fixed.

Location:
branches/2.1x/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.1x/libtransmission/net.c

    r11494 r11611  
    317317
    318318    /* set source address */
    319     source_addr = tr_sessionGetPublicAddress( session, addr->type );
     319    source_addr = tr_sessionGetPublicAddress( session, addr->type, NULL );
    320320    assert( source_addr );
    321321    sourcelen = setup_sockaddr( source_addr, 0, &source_sock );
  • branches/2.1x/libtransmission/session.c

    r11496 r11611  
    218218
    219219const tr_address*
    220 tr_sessionGetPublicAddress( const tr_session * session, int tr_af_type )
    221 {
     220tr_sessionGetPublicAddress( const tr_session * session, int tr_af_type, tr_bool * is_default_value )
     221{
     222    const char * default_value;
    222223    const struct tr_bindinfo * bindinfo;
    223224
    224225    switch( tr_af_type )
    225226    {
    226         case TR_AF_INET:  bindinfo = session->public_ipv4; break;
    227         case TR_AF_INET6: bindinfo = session->public_ipv6; break;
    228         default:          bindinfo = NULL;                 break;
    229     }
     227        case TR_AF_INET:
     228            bindinfo = session->public_ipv4;
     229            default_value = TR_DEFAULT_BIND_ADDRESS_IPV4;
     230            break;
     231
     232        case TR_AF_INET6:
     233            bindinfo = session->public_ipv6;
     234            default_value = TR_DEFAULT_BIND_ADDRESS_IPV6;
     235            break;
     236
     237        default:
     238            bindinfo = NULL;
     239            default_value = "";
     240            break;
     241    }
     242
     243    if( is_default_value != NULL )
     244        *is_default_value = !strcmp( default_value, tr_ntop_non_ts( &bindinfo->addr ) );
    230245
    231246    return bindinfo ? &bindinfo->addr : NULL;
  • branches/2.1x/libtransmission/session.h

    r11368 r11611  
    219219tr_bool      tr_sessionIsLocked( const tr_session * );
    220220
    221 const struct tr_address*  tr_sessionGetPublicAddress( const tr_session *, int tr_af_type );
     221const struct tr_address*  tr_sessionGetPublicAddress( const tr_session  * session,
     222                                                      int                 tr_af_type,
     223                                                      tr_bool           * is_default_value );
     224
    222225
    223226struct tr_bindsockets * tr_sessionGetBindSockets( tr_session * );
  • branches/2.1x/libtransmission/web.c

    r11398 r11611  
    143143{
    144144    const tr_address * addr;
     145    tr_bool is_default_value;
    145146    CURL * e = curl_easy_init( );
    146147    const long verbose = getenv( "TR_CURL_VERBOSE" ) != NULL;
     
    167168    curl_easy_setopt( e, CURLOPT_WRITEFUNCTION, writeFunc );
    168169
    169     if(( addr = tr_sessionGetPublicAddress( s, TR_AF_INET )))
     170    if((( addr = tr_sessionGetPublicAddress( s, TR_AF_INET, &is_default_value ))) && !is_default_value )
     171        curl_easy_setopt( e, CURLOPT_INTERFACE, tr_ntop_non_ts( addr ) );
     172    else if ((( addr = tr_sessionGetPublicAddress( s, TR_AF_INET6, &is_default_value ))) && !is_default_value )
    170173        curl_easy_setopt( e, CURLOPT_INTERFACE, tr_ntop_non_ts( addr ) );
    171174
Note: See TracChangeset for help on using the changeset viewer.