Make sure every address function that takes for_listening supports IPv6
I see only one such function.
There are at least 5 such functions.
Of the ones I checked, 3 only support IPv4, and 1 already supports IPv6 for_listening.
Please double-check by searching address.c for for_listening.
Please update the function comment so it describes what the function does now.
And please add tests for the new code you just added.
It would also be great to simplify the IPv4 case the same way you simplified the IPv6 case.
(If for_listening is true, any IPv4 address is acceptable.)
And merge the IPv4 and IPv6 cases, if you can find a simple way to do it.
I have added the required tests.
And I didn't see any reasons to change tor_port_is_valid().
However I refactored tor_addr_is_valid_ipv4n() and We should not make a
similar function for ipv6 as it will only be checking whether it's null or not
and that could be done via tor_is_valid().
Should we make a function similar to tor_addr_is_valid_ipv4h() ??
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 ??
Should I push this with some tests on tor_addr_is_valid_ipv[h/n] ??
"n" stands for network-order, and "h" stands for host order. tor_addr_t is always in host order. So we don't need these extra functions. When we are refactoring, or adding features, we don't add extra functions. Unless we are going to actually use them.
I put some more comments on the pull request.
Thanks for trying to make these functions simpler. But they also need to be correct, and readable. Sometimes a function is more readable, if it is written using multiple lines.
Let's just focus on changing and testing tor_addr_is_valid() for now. I think the other functions are fine as they were.
Add all the tickets from sponsor 55 that are done and being worked on to the keyword #network-team-roadmap-2020Q1 so I can look at them in the wiki page...
It looks like the data returned is different on Windows vs macOS/Linux, when tor_inet_pton() gets some invalid addresses.
I opened #33768 (moved) to fix this bug - the functions should behave the same across all platforms.
It looks like the data returned is different on Windows vs macOS/Linux, when tor_inet_pton() gets some invalid addresses.
I opened #33768 (moved) to fix this bug - the functions should behave the same across all platforms.
Yeah !! sometimes stupidity proves to be useful. haha.