[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #33618 [Core Tor/Tor]: Add IPv6 Support to is_local_addr()



#33618: Add IPv6 Support to is_local_addr()
------------------------------------------+--------------------------------
 Reporter:  kimimaro                      |          Owner:  (none)
     Type:  enhancement                   |         Status:  new
 Priority:  Medium                        |      Milestone:  Tor:
                                          |  0.4.4.x-final
Component:  Core Tor/Tor                  |        Version:
 Severity:  Normal                        |     Resolution:
 Keywords:  outreachy-ipv6 ipv6  prop312  |  Actual Points:
Parent ID:                                |         Points:  1
 Reviewer:                                |        Sponsor:  Sponsor55-can
------------------------------------------+--------------------------------

Comment (by MrSquanchee):

 If I may help, I can see that `tor_addr_is_valid(const tor_addr_t *addr,
 int for_listening)` does not check for ipv6 addresses here:
 [https://github.com/torproject/tor/blob/686494f0f71b9235399b8241aba3e0c2fcb03ea1/src/lib/net/address.c#L831].
 You can check the addresses validity manually.

 {{{
 int tor_addr_ipv6_is_valid(const tor_addr_t *addr){
     if (! addr->sa_family_t == AF_INET6)
         return 0;
     const uint32_t *a32 = tor_addr_to_in6_addr32(addr);
     iph6[0] = ntohl(a32[0]);
     iph6[1] = ntohl(a32[1]);
     iph6[2] = ntohl(a32[2]);
     iph6[3] = ntohl(a32[3]);
     if (!iph6[0] && !iph6[1] && !iph6[2] && !iph6[3]) /* :: */
         return 0;
     return 1;
 }
 }}}

 Hope this helps.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/33618#comment:8>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs