Resolv::DNS unable to handle responses larger than default size
The actual implementation of Resolve::DNS defines UDPSize = 512 as default. There is no way to initialize a Resolv::DNS instance having non-default UDPSize, as well all socket reads will be limited to this size. Also, queries responding with larger and/or fragmented packets will result in an empty set after timeout and no error is raised.
Currently, Resolv::DNS is therefore limited usable in use-cases when a DNS response is larger than 512 bytes.
Desirable would be to have UDPSize as configurable attribute, instead of a hard coded constant.
Updated by jeremyevans0 (Jeremy Evans) about 2 months ago
- Backport deleted (
2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN)
- ruby -v deleted (
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin18])
- Status changed from Open to Rejected
- Tracker changed from Bug to Feature
RFC 1035 Section 2.3.4 specifies that UDP messages are limited to 512 octets or less. RFC 6891 confirms this number unless you are using EDNS(0) extensions. It does not appear that
Resolv::DNS supports EDNS(0), therefore the limit of 512 bytes seems reasonable. You can use
Resolv::DNS.const_set(:UDPSize, 1400) or something like that if you would like to override the limit.