[Bug 270498] libc DNS resolver ignore timeout with tcp

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 28 Mar 2023 15:30:21 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270498

            Bug ID: 270498
           Summary: libc DNS resolver ignore timeout with tcp
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: freebsdbugzilla@agneau.org

Created attachment 241157
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=241157&action=edit
test program to reproduce the issue

The libc resolver functions don't use the timeout with TCP connections.
If a TCP connection hangs to the configured name server, the name resolution
functions will wait indefinitely and never return to the caller.

The timeout option should be used for tcp queries like for udp queries.

It looks like linux glibc as the same bug for years
https://sourceware.org/bugzilla/show_bug.cgi?id=19643 .

I reproduce it on 13.1, but it should be the same with all FreeBSD versions .

How-To-Reproduce: 

The attached C program written by Alain Thivillon <athivillon@corp.free.fr> who
warn me about this bug can be used to reproduce the issue.
It makes a DNS query over tcp to 127.0.0.1:8888 .
Launch "nc -l 8888"  in a shell and ./test in an other .
You will see a connection in the first shell and the test program will be
blocked on the DNS query in the second indefinitely or until you answer
something or close the nc.

-- 
You are receiving this mail because:
You are the assignee for the bug.