Changeset 11749


Ignore:
Timestamp:
Jan 22, 2011, 1:49:15 PM (12 years ago)
Author:
jordan
Message:

(trunk libT) #3906 "DHT ignores bind-address-ipv6" -- test fix.

Add code to honor the ipv6 bind address. Thanks to jch for saving me a little work by confirming the bug and pointing out where in the code the change needed to be made.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tr-udp.c

    r11662 r11749  
    3939rebind_ipv6(tr_session *ss, tr_bool force)
    4040{
     41    tr_bool is_default;
     42    const struct tr_address * public_addr;
    4143    struct sockaddr_in6 sin6;
    4244    const unsigned char *ipv6 = tr_globalIPv6();
     
    7274        memcpy(&sin6.sin6_addr, ipv6, 16);
    7375    sin6.sin6_port = htons(ss->udp_port);
     76    public_addr = tr_sessionGetPublicAddress(ss, TR_AF_INET6, &is_default);
     77    if(public_addr && !is_default)
     78        sin6.sin6_addr = public_addr->addr.addr6;
     79
    7480    rc = bind(s, (struct sockaddr*)&sin6, sizeof(sin6));
    7581    if(rc < 0)
Note: See TracChangeset for help on using the changeset viewer.