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>
| // 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.
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.
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.
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.
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.
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.
@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.
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.
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. |
rakeshdatta
left a comment
There was a problem hiding this comment.
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.
|
|
||
| // 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.
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.
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_queriesinDNSResolverOptionsto limit max UDP queries.Additional Description: This change does following:
cares_dns_resolver.prototo expose the option to passudp_max_querieswhich can then be passed toc-ares.udp_max_queriesis set,ARES_OPT_UDP_MAX_QUERIESflag 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:]