Project

General

Profile

Actions

Bug #13513

open

Resolv::DNS::Message.decode hangs after detecting truncation in UDP messages

Added by iamasmith (Andrew Smith) over 4 years ago. Updated 9 months ago.

Status:
Assigned
Priority:
Normal
Target version:
-
[ruby-core:80885]
Tags:

Description

ruby-core:32407 introduced support for a TCP requestor in fetch_resource if Resolv::DNS::Message.decode returned RCode::NoError and a reply tc of 1.

Unfortunately Resolv::DNS::Message.decode proceeds to attempt to unpack all answers based upon the answer count from the message regardless of truncation which causes exception behaviour which is then silently retried as this is seen as the response to the request never being seen (see begin, ensure).

To avoid this issue I add a return to Message.decode once the truncation is detected.

To patch this in a portable fashion I use the attached monkey patch which causes the truncation to propagate correctly back to fetch_resource and allows it to proceed correctly with the TCP based query.


Files

resolv-monkey-tc.rb (757 Bytes) resolv-monkey-tc.rb Monkey patch for issue. See detail of description for actual problem. iamasmith (Andrew Smith), 04/26/2017 04:12 PM
Actions

Also available in: Atom PDF