[Bug 3211] New: __dns_lookup and poll logic (unexpected timeouts) [PATCH]

bugzilla at busybox.net bugzilla at busybox.net
Tue Feb 8 11:15:52 UTC 2011


https://bugs.busybox.net/show_bug.cgi?id=3211

           Summary: __dns_lookup and poll logic (unexpected timeouts)
                    [PATCH]
           Product: uClibc
           Version: unspecified
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Networking
        AssignedTo: unassigned at uclibc.org
        ReportedBy: p.kosyh at gmail.com
                CC: uclibc-cvs at uclibc.org
   Estimated Hours: 0.0


Created attachment 2935
  --> https://bugs.busybox.net/attachment.cgi?id=2935
Patch

With empty /etc/resolv.conf we still have 10 sec. timeout while trying to
resolve names. The problem is in poll logic. It is not sufficient to check poll
retval. The revents field must be examined too.

Here is the patch, that works for me:

---

diff -Nur uClibc-0.9.31/libc/inet/resolv.c
uClibc-0.9.31-poll/libc/inet/resolv.c
--- uClibc-0.9.31/libc/inet/resolv.c    2010-04-02 19:34:27.000000000 +0400
+++ uClibc-0.9.31-poll/libc/inet/resolv.c       2011-02-08 17:38:28.000000000
+0300
@@ -1408,6 +1408,10 @@
                         * to next nameserver */
                        goto try_next_server;
                }
+               if (fds.revents & (POLLERR | POLLHUP | POLLNVAL)) {
+                       DPRINTF("Bad event\n");
+                       goto try_next_server;
+               }
 /*TODO: better timeout accounting?*/
                reply_timeout -= 1000;
 #endif

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the uClibc-cvs mailing list