autonatv2: fix server dial data request policy#3247
Merged
Conversation
f796e0f to
dd21c0d
Compare
MarcoPolo
reviewed
Mar 24, 2025
Collaborator
MarcoPolo
left a comment
There was a problem hiding this comment.
one thing around the test, but otherwise good
|
|
||
| // amplificationAttackPrevention is a dialDataRequestPolicy which requests data when the peer's observed | ||
| // IP address is different from the dial back IP address | ||
| func amplificationAttackPrevention(s network.Stream, dialAddr ma.Multiaddr) bool { |
Collaborator
There was a problem hiding this comment.
dialAddr was previously unused? That seems like it should have been caught by a lint check.
Member
Author
There was a problem hiding this comment.
agreed. Made #3248 to track this.
I've configured my editor, but we should enable lint checks in ci too.
| require.Error(t, err) | ||
|
|
||
| // ipv6 address should work fine with dial data | ||
| res, err = c.GetReachability(context.Background(), []Request{{Addr: quicv6Addr, SendDialData: true}}) |
Collaborator
There was a problem hiding this comment.
I don't think this check actually asserts that dial data was requested, right?
Is there a way to assert that we were requested dial data?
Member
Author
There was a problem hiding this comment.
added this to the checks:
require.ErrorContains(t, err, "invalid dial data request: low priority addr")
The policy was comparing the connection local addr to the observed addr. This should be comparing the connection remote addr to the requested dial addr. The impact here is: if we refresh reachability for addresses every hour, we will be spending 100kB per address per hour. That's equivalent to 30 B/s. For 10 addrs this will be 300 B/s or 3kb/s
dd21c0d to
77eba57
Compare
MarcoPolo
approved these changes
Mar 24, 2025
sukunrt
added a commit
that referenced
this pull request
Mar 24, 2025
sukunrt
added a commit
that referenced
this pull request
Mar 24, 2025
sukunrt
added a commit
that referenced
this pull request
Mar 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The policy was comparing the connection local addr to the observed addr. This should be comparing the connection remote addr to the requested dial addr.
The impact here is:
if we refresh reachability for addresses every hour, we will be spending 100kB per address per hour. That's equivalent to 30 B/s. For 10 addrs this will be 300 B/s or 3kb/s