[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #33679 [Core Tor/Tor]: Make sure every address function that takes for_listening supports IPv6
#33679: Make sure every address function that takes for_listening supports IPv6
-------------------------------------------+-------------------------------
Reporter: teor | Owner: MrSquanchee
Type: task | Status: needs_review
Priority: Medium | Milestone: Tor:
| 0.4.4.x-final
Component: Core Tor/Tor | Version:
Severity: Normal | Resolution:
Keywords: prop312, ipv6, outreachy-ipv6 | Actual Points:
Parent ID: #33049 | Points: 0.5
Reviewer: | Sponsor:
| Sponsor55-must
-------------------------------------------+-------------------------------
Comment (by MrSquanchee):
> Should we make a function similar to tor_addr_is_valid_ipv4h
I provided functions (network and host order) for both ipv4 and ipv6.
{{{
int
tor_addr_is_valid_ipvn(const tor_addr_t *addr, int for_listening) {
return tor_addr_is_valid(addr, for_listening);
}
int
tor_addr_is_valid_ipvh(const tor_addr_t *addr, int for_listening) {
tor_assert(addr);
if (for_listening) {
return 1;
}
if (addr->family == AF_INET) {
return htonl(addr->addr->in_addr) != 0;
} else if (addr->family == AF_INET6) {
uint32_t *ipv6 = tor_addr_to_in6_addr32(addr);
return !(htonl(ipv6[0]) == 0 &&
htonl(ipv6[1]) == 0 &&
htonl(ipv6[2]) == 0 &&
htonl(ipv6[3]) == 0);
} else {
return 1;
}
}
}}}
The other only ipv4 functions are tor_addr_port_is_valid_ipv4[h/n].
I think we should leave them as it is.
What do you say ??
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/33679#comment:6>
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