-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
c-ares: add option for udp_max_queries #33551
c-ares: add option for udp_max_queries #33551
Conversation
Signed-off-by: deveshkandpal1224 <deveshkandpal1224@gmail.com>
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
Signed-off-by: deveshkandpal1224 <deveshkandpal1224@gmail.com>
@yanjunxiang-google can you please take a first pass? |
Signed-off-by: deveshkandpal1224 <deveshkandpal1224@gmail.com>
Signed-off-by: deveshkandpal1224 <deveshkandpal1224@gmail.com>
@@ -194,7 +202,7 @@ void DnsResolverImpl::AddrInfoPendingResolution::onAresGetAddrInfoCallback( | |||
// | |||
// The channel cannot be destroyed and reinitialized here because that leads to a c-ares | |||
// segfault. | |||
if (status == ARES_ECONNREFUSED) { | |||
if (status == ARES_ECONNREFUSED || status == ARES_EREFUSED) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This change is for updating c-ares library to 1.20, but have nothing to do with the udp_max_queries option support. Does it make sense to separate it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DestroyChannelOnRefused
and CustomResolverValidAfterChannelDestruction
test fail in dns_impl_test.cc
after upgrading the c-ares library to 1.20 if this isn't added, while udp_max_queries
is supported in 1.20 so kind of tied together if that makes sense ? Or do you suggest splitting this into 2 PRs ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you split into two PRs? It will make it easier to review the dependency updates vs. the UDP query specific change proposed. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure I can split it. Let me send out a PR for library update.
Signed-off-by: deveshkandpal1224 <deveshkandpal1224@gmail.com>
|
||
// Validate that c_ares flag `ARES_OPT_UDP_MAX_QUERIES` is set when UInt32 property | ||
// `udp_max_queries` is set. | ||
TEST_P(DnsImplAresFlagsForMaxUdpQueriesinTest, UdpMaxQueriesIsSet) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
Is there a way to verify the UdpMaxQueries number actually is enforced by the c-ares library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yanjunxiang-google - do you mean by checking opts.udp_max_queries or something more involved ? I tried poking in that area but couldn't find anything obvious - if you have suggestions - happy to look into it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was pushing c'ares team for this change : c-ares/c-ares#444
I believe you can test like this:
- set this value as n
- keep pumping traffic.
- Dont turn on dns over tcp
- Sniffing ('ngrep -W single -l -q -d any -i "" udp port 53') the DNS packets
- The src port should keep changing after every n DNS resolution requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change should be ok as is, since we rely on c-ares to test the behavior of the ARES_OPT_UDP_MAX_QUERIES flag. I do not think it is important to validate that this flag is working in c-ares.
LGTM in high level except a few nit comments. |
Signed-off-by: deveshkandpal1224 <deveshkandpal1224@gmail.com>
Signed-off-by: deveshkandpal1224 <deveshkandpal1224@gmail.com>
Signed-off-by: deveshkandpal1224 <deveshkandpal1224@gmail.com>
Signed-off-by: deveshkandpal1224 <deveshkandpal1224@gmail.com>
LGTM |
/lgtm api @yanavlasov for cares DNS resolver owner. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was pushing c'ares team for this change : c-ares/c-ares#444
I believe you can test like this:
- set this value as n
- keep pumping traffic.
- Dont turn on dns over tcp
- Sniffing ('ngrep -W single -l -q -d any -i "" udp port 53') the DNS packets
The src port should keep changing after every n DNS resolution requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/wait-any
|
||
// This option allows for number of UDP based DNS queries to be capped. Note, this | ||
// is only applicable to c-ares DNS resolver currently. | ||
google.protobuf.UInt32Value udp_max_queries = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to move this option in c-ares specific configuration: https://github.com/envoyproxy/envoy/blob/main/api/envoy/extensions/network/dns_resolver/cares/v3/cares_dns_resolver.proto ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was in two minds thinking that if tomorrow there was an option for apple dns resolver, it could be leveraged. But happy to move this to c-ares if that makes more sense.
Signed-off-by: deveshkandpal1224 <deveshkandpal1224@gmail.com>
Signed-off-by: deveshkandpal1224 <deveshkandpal1224@gmail.com>
Signed-off-by: deveshkandpal1224 <deveshkandpal1224@gmail.com>
Signed-off-by: deveshkandpal1224 <deveshkandpal1224@gmail.com>
Signed-off-by: deveshkandpal1224 <deveshkandpal1224@gmail.com>
Commit Message: Provides an option to set
udp_max_queries
inDNSResolverOptions
to limit max UDP queries.Additional Description: This change does following:
cares_dns_resolver.proto
to expose the option to passudp_max_queries
which can then be passed toc-ares
.udp_max_queries
is set,ARES_OPT_UDP_MAX_QUERIES
flag is set as well.Risk Level: Low
Testing: Unit test
Docs Changes: n/a
Release Notes: updated
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]