[Xastir] Networking issue for Cygwin (and possible solution)

Tom Russo russo at bogodyn.org
Sat Oct 30 10:06:28 PDT 2021


The call to getaddrinfo in forked_getaddrinfo should not be universally zeriong
the hints.  In fact, for most systems the hints are deliberately set in 
interface.c's "net_init" function and passed down into forked_getaddrinfo.

Zeroing them after that is just wrong in all the cases that already work.

There must be something special about Cygwin that makes the specific hints
chosen not work there:

  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_protocol = 0;
  hints.ai_flags = AI_NUMERICSERV|AI_ADDRCONFIG;


If you can figure out what is wrong with this specific set of hints that
lets it work everywhere *except* cygwin then perhaps it can be dealt with
somehow.  But these hints have been working for quite some time with all 
other systems, so it would be wrong simply to zero them unconditionally.

The specific hints added here were done in commit bbab5f92 in 2018 in order
to add IPv6 support, so that explains why it stopped working on Cygwin
relatively recently.

Perhaps Jason (who wrote that code) can investigate the right fix.

On Sat, Oct 30, 2021 at 12:58:39PM -0400, we recorded a bogon-computron collision of the <easternontariotracks at gmail.com> flavor, containing:
> Hi everyone,
> 
>  
> 
> I have been running Xastir on Cygwin for many years but had to stop taking
> updates at one point because recent versions will not connect to internet
> servers.  (Host IP lookup failure, port 0, rc 4, DEVICE_ERROR ***).  I even
> tried a clean install on another machine (also 64-bit) to rule out anything
> else as a cause and the same error occurred. I was fortunate enough today to
> find some discussions which led me to a possible solution: zero-fill the
> hints block immediately before the call to getaddrinfo (in
> forked_getaddrinfo.c), i.e.:
> 
> memset (&hints, 0, sizeof hints);  //"prepare" the hints block
> 
> rc = getaddrinfo(hostname, servname, hints, &res0);
> 
>  
> 
> I am not yet sure why this works for Xastir but I figured I would share now
> in case it is readily apparent to someone with greater insight.  The initial
> theory involved a discrepancy in structure sizes in the 64-bit Cygwin.
> However, to validate this theory I set up another machine with 32-bit Cygwin
> (which will not be updated beyond the current version) and I experienced the
> same problem which required that same fix above.
> 
>  
> 
> Thanks and regards,
> 
> Russell Lees       VE3TUK
> 
>  
> 
>  
> 
> _______________________________________________
> Xastir mailing list
> Xastir at lists.xastir.org
> http://xastir.org/mailman/listinfo/xastir

-- 
Tom Russo    KM5VY
Tijeras, NM  

 echo "prpv_a'rfg_cnf_har_cvcr" | sed -e 's/_/ /g' | tr [a-m][n-z] [n-z][a-m]



More information about the Xastir mailing list