bug-jwhois
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-jwhois] jwhois bug on freebsd, with patch


From: Mark Costlow
Subject: [Bug-jwhois] jwhois bug on freebsd, with patch
Date: Thu, 24 Aug 2017 16:37:47 -0600
User-agent: Mutt/1.7.2 (2016-11-26)

Hi, I found that jwhois would not work on my FreeBSD systems.  It
seemed to be trying to make an ipv6 connection even though the
system had no ipv6 interfaces.  I found some forum posts of people
having similar problems over the years, but they were focused on
it as a FreeBSD issue.

The issue is in utils.c make_connect().  After calling
lookup_host_addrinfo(), res has a list of potential addresses to
use.  The while() iterates through them to find one that succeeds.
However, it doesn't break out when it finds one, it goes through
the whole list.  So if the ipv6 address is first, on a system with
no ipv6 support, it will skip it, find the ipv4 address, and succeed.

However, if the ipv4 address is first on a system with no ipv6
support, it will continue after making the successful ipv4 connection,
then fail on ipv6 and return bad sockfd.

The patch just breaks out of the loop if a connection worked.

------------------8<---snip---8<----------------------------------
--- utils.c.orig        2017-08-24 16:29:18.116613000 -0600
+++ utils.c     2017-08-24 16:30:03.708574000 -0600
@@ -291,10 +291,13 @@
       if (error < 0 || retval)
        {
          break;
        }
 
+      /* If no errors, break out and return sockfd for this connection */
+      if (error >= 0 && !retval) break;
+
       res = res->ai_next;
     }
   if (error < 0 || retval) return -1;
 #endif
------------------8<---snip---8<----------------------------------

Thanks,

Mark
-- 
Mark Costlow    | Southwest Cyberport | Fax:   +1-505-232-7975
address@hidden | Web:   www.swcp.com | Voice: +1-505-232-7992

Mail Minder - Intelligent Push Notifications for Email on the iPhone
http://mailminderapp.com/download  or in the App Store




reply via email to

[Prev in Thread] Current Thread [Next in Thread]