In Tor, we try to support v6-mapped IPv4 addresses.
We should either:
reject them unconditionally, or
audit all uses of tor_addr_t.family to see if we should be calling tor_addr_is_v4() instead, and add a comment to the struct that says we should consider using tor_addr_is_v4() rather than comparing family.
If no relay in the consensus is currently using these addresses, then maybe we should just call them internal on authorities, relays, and clients, and remove all the code that tries to deal with them.
We should also audit all uses of tor_addr_compare(a1, a2, CMP_EXACT) to see if they should be CMP_SEMANTIC instead.
The current uses of CMP_SEMANTIC seem reasonable, but not essential: they code would still work if we rejected mapped addresses and did exact comparisons instead.
These tickets were marked as removed, and nobody has said that they can fix them. Let's remember to look at 033-removed-20180320 as we re-evaluate our triage process, to see whether we're triaging out unnecessarily, and to evaluate whether we're deferring anything unnecessarily. But for now, we can't do these: we need to fix the 033-must stuff now.
Trac: Milestone: Tor: 0.3.3.x-final to Tor: unspecified
Should I change the a->family == AF_INET in address.h to tor_addr_is_v4(a) (along with changing addr->family == AF_INET to tor_addr_is_v4(addr))?
Is it okay if I implement a tor_addr_is_v6() which is like tor_addr_is_v4() but with IPv6/AF_INET, and replace addr->family == AF_INET6 and the like with tor_addr_is_v6(addr)?
If I do #2 (closed) on this list, then should I reject IPv6 mapped IPv4 addresses in tor_addr_is_v6()?
Should I change the a->family == AF_INET in address.h to tor_addr_is_v4(a) (along with changing addr->family == AF_INET to tor_addr_is_v4(addr))?
Yes, that's fine.
Is it okay if I implement a tor_addr_is_v6() which is like tor_addr_is_v4() but with IPv6/AF_INET, and replace addr->family == AF_INET6 and the like with tor_addr_is_v6(addr)?
Yes, and please add unit tests for the new function.
If I do #2 (closed) on this list, then should I reject IPv6 mapped IPv4 addresses in tor_addr_is_v6()?
You should reject IPv6-mapped IPv4 addresses in the v4 function. Tor doesn't use them, and we don't test for or support them.
We should also audit all uses of tor_addr_compare(a1, a2, CMP_EXACT) to see if they should be CMP_SEMANTIC instead.
The current uses of CMP_SEMANTIC seem reasonable, but not essential: they code would still work if we rejected mapped addresses and did exact comparisons instead.
The patches looks good to me, but there is a big merge conflict right now because of the recent refactoring work. This needs to be fixed before I can give it the final OK.
Actually, ignore my last comment. I'll take a look at rebasing this on top of master. We don't want to add extra work because of the big refactoring that happened recently.
Deferring 51 tickets from 0.4.0.x-final. Tagging them with 040-deferred-20190220 for visibility. These are the tickets that did not get 040-must, 040-can, or tor-ci.
src/core/or/policies.c: In function ‘exit_policy_remove_redundancies’:src/core/or/policies.c:1709:19: error: variable ‘family’ set but not used [-Werror=unused-but-set-variable] sa_family_t family; ^cc1: all warnings being treated as errorsmake: *** [src/core/or/src_core_libtor_app_testing_a-policies.o] Error 1make: *** Waiting for unfinished jobs....
Please make sure that the CI passes before putting it in needs_review again.
Also, the bugfix release in the changes file is the release where the bug was introduced, not the release where the bug was fixed. In this ticket, that's the release where tor_addr_is_v4() was introduced.
Here's how you can find the release that this bug was introduced in:
# find the first commit that talks about tor_addr_is_v4$ git log --reverse -S tor_addr_is_v4 mastercommit bbbf504281Author: Nick Mathewson <nickm@torproject.org>Date: Thu Jul 19 18:46:09 2007 +0000 r13827@catbus: nickm | 2007-07-19 14:42:25 -0400 Merge in some generic address manipulation code from croup. Needs some work....# find the release that contains that commit$ git describe --contains bbbf504281tor-0.2.0.3-alpha~82
Trac: Version: N/Ato Tor: unspecified Status: needs_review to needs_revision
Thanks for this pull request. I did a review on the code.
I am concerned about the size of the diff in commit 53ff26b. It changes over 100 lines. It contains at least one logic error that passed review. There could be more.
Here are our options for moving forward:
Use an automated tool like coccinelle to do the changes in 53ff26b. Then we can verify the output using the tool. We should also turn tor_addr_is_*() into inline header functions, so they are more efficient.
Delete the function tor_addr_is_v4(), and replace all its uses with tor_addr_family(addr) == AF_INET. There are only 13 uses of tor_addr_is_v4() in master, so the diff should be much smaller and easier to review.
I prefer option 2, because we will end up with fewer functions, and less code complexity. And the overall diff will be smaller.
What do you think?
Trac: Reviewer: ahf to ahf, teor Status: needs_review to needs_revision
I am concerned about the size of the diff in commit 53ff26b. It changes over 100 lines. It contains at least one logic error that passed review. There could be more.
Here are our options for moving forward:
Use an automated tool like coccinelle to do the changes in 53ff26b. Then we can verify the output using the tool. We should also turn tor_addr_is_*() into inline header functions, so they are more efficient.
I can understand that you don't want to use an automated tool. But we can't review a hundred lines of very similar changes effectively. We've already missed one mistake even though we did multiple reviews, and there could be more.
Delete the function tor_addr_is_v4(), and replace all its uses with tor_addr_family(addr) == AF_INET. There are only 13 uses of tor_addr_is_v4() in master, so the diff should be much smaller and easier to review.
I prefer option 2, because we will end up with fewer functions, and less code complexity. And the overall diff will be smaller.
Would you like to do a new pull request that removes tor_addr_is_v4()?
You could use your existing first and last commits 56ec375359032eee15cbda9a6d5960cdd5a28135 and 1d5c703ec2e2d418180f9cdeba1140b9dbaf730d. Then add a commit that removes tor_addr_is_v4(), which should only be about 20-30 changed lines.
Now that we have removed special handling for v4-mapped IPv6 addresses, there's some more code that we can remove. And we need to move the IPV6_V6ONLY code so that it applies to all sockets. See my detailed comments on the pull request.
Please make any further changes in separate commits on the same branch, then push the branch.
Trac: Status: needs_review to needs_revision Actualpoints: N/Ato 1