-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
netdb:Add macro to control DNS using TCP transmission #15069
base: master
Are you sure you want to change the base?
Conversation
[Experimental Bot, please feedback here] Does this PR meet the NuttX Requirements?No. The provided information is insufficient to determine if the PR meets the NuttX requirements. While the summary explains the what and why, it lacks the how. The impact and testing sections are essentially placeholders. Specifically lacking:
To make this PR acceptable, the author needs to:
|
please remove Gerrit Change-ID's before submitting upstream. |
Done. |
@@ -237,6 +237,11 @@ config NETDB_DNSSERVER_IPv4ADDR | |||
Default DNS server IPv4 address in host byte order. Default value | |||
10.0.0.1. This may be changed via dns_add_nameserver(). | |||
|
|||
config NETDB_DNS_STREAM |
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.
the original code already support both TCP/UDP, why do you make this patch?
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.
When DNS resolution returns the truncate response, this function will establish TCP connection and return the complete response. However, the complete response can easily exceed the RECV_BUFFER_SIZE, causing the resolution to fail, so I wrote a simple solution to solve this problem. There are two better solutions. One is to recycle the buffer and finally splice the buffer. The second is to use molloc to create a length that matches the response. I would like to ask if there is a better solution. @yamt
ping failed.log
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.
the simplest solution, if it's acceptable for your configuration, would be to bump your CONFIG_NETDB_DNSCLIENT_MAXRESPONSE.
i agree it makes sense to try to use malloc when it doesn't fit RECV_BUFFER_SIZE.
it shouldn't be too difficult to make our client decide after receiving the record size (the first two bytes of the response) with tcp.
i'm not sure how difficult buffer recycling is.
depending on your configurations and environment, you might also want to implement EDNS buffer size.
some servers "tweak" their responses to fit the specified size.
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.
thank you for your suggestion!
config NETDB_DNS_STREAM | ||
bool "DNS supports TCP transmission" | ||
depends on LIBC_NETDB | ||
default n |
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.
Please include a --help-- to explain exactly what is this feature, when it should be used, etc
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.
Done
0e53657
to
165528e
Compare
Signed-off-by: yangjianqing <[email protected]>
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.
When dns uses tcp for transmission, it is easy to exceed RECV_BUFFER_SIZE, causing resolution failure. Therefore a macro was added to limit whether this feature is enabled or not.
well, tcp is used only when the response is truncated in the first place.
thus, disabling tcp does not solve resolution failure problems you are seeing at all.
am i missing something?
Actually, when tcp is turned off, the truncate reply can be resolve normally. |
ok. |
Summary
When dns uses tcp for transmission, it is easy to exceed RECV_BUFFER_SIZE, causing resolution failure. Therefore a macro was added to limit whether this feature is enabled or not.
Impact
Update this section, where applicable, on how change affects users,
build process, hardware, documentation, security, compatibility, etc.
Testing
Update this section with details on how did you verify the change,
what Host was used for build (OS, CPU, compiler, ..), what Target was
used for verification (arch, board:config, ..), etc. Providing build
and runtime logs from before and after change is highly appreciated.