Ignore:
Timestamp:
Jun 20, 2016 10:10:42 AM (3 years ago)
Author:
nanang
Message:

Close #1927: IPv6 support in DNS SRV:

  • support DNS A and AAAA resolution for each target in DNS SRV record
  • support fallback to DNS A and DNS AAAA resolution when DNS SRV record is not available
  • support IPv6 nameservers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/src/pjnath/stun_sock.c

    r5296 r5349  
    417417        pj_assert(stun_sock->q == NULL); 
    418418 
    419         opt = PJ_DNS_SRV_FALLBACK_A; 
    420         if (stun_sock->af == pj_AF_INET6()) { 
    421             opt |= (PJ_DNS_SRV_RESOLVE_AAAA | PJ_DNS_SRV_FALLBACK_AAAA); 
    422         } 
     419        /* Init DNS resolution option */ 
     420        if (stun_sock->af == pj_AF_INET6()) 
     421            opt = (PJ_DNS_SRV_RESOLVE_AAAA_ONLY | PJ_DNS_SRV_FALLBACK_AAAA); 
     422        else 
     423            opt = PJ_DNS_SRV_FALLBACK_A; 
    423424 
    424425        status = pj_dns_srv_resolve(domain, &res_name, default_port,  
     
    575576    pj_assert(rec->count); 
    576577    pj_assert(rec->entry[0].server.addr_count); 
    577  
    578     PJ_TODO(SUPPORT_IPV6_IN_RESOLVER); 
    579     pj_assert(stun_sock->af == pj_AF_INET()); 
     578    pj_assert(rec->entry[0].server.addr[0].af == stun_sock->af); 
    580579 
    581580    /* Set the address */ 
    582     pj_sockaddr_in_init(&stun_sock->srv_addr.ipv4, NULL, 
    583                         rec->entry[0].port); 
    584     stun_sock->srv_addr.ipv4.sin_addr = rec->entry[0].server.addr[0]; 
     581    pj_sockaddr_init(stun_sock->af, &stun_sock->srv_addr, NULL, 
     582                     rec->entry[0].port); 
     583    if (stun_sock->af == pj_AF_INET6()) { 
     584        stun_sock->srv_addr.ipv6.sin6_addr =  
     585                                    rec->entry[0].server.addr[0].ip.v6; 
     586    } else { 
     587        stun_sock->srv_addr.ipv4.sin_addr =  
     588                                    rec->entry[0].server.addr[0].ip.v4; 
     589    } 
    585590 
    586591    /* Start sending Binding request */ 
Note: See TracChangeset for help on using the changeset viewer.