[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MiNT] gethostbyname() fails on the FireBee
After recompiling ping, I noticed that gethostbyname() fails to do DNS
lookups on the FireBee. I suspect it is a timing problem.
See the attached testcase. It just does a simple gethostbyname().
On the FireBee, it is extremely strange:
- if I run it normally, it fails
- but if I run it with strace, it succeeds!
On ARAnyM, it always works.
I sniffed the packets, here is what happens when it fails:
- the DNS request is sent 3 times, very quickly
- as a result, the DNS server answers 3 times
- then FreeMiNT answers an ICMP "Port unreachable", 3 times
It looks like FreeMiNT sends a DNS request, then quickly closes the socket
and retries, before the answer is received.
However, ping works fine with IP addresses or static hosts put in
/etc/hosts. This is not surprising as such cases don't produce DNS lookups.
The fact it works fine on the FireBee with strace is very weird. This is why
I suspect a timing problem.
In the case where it works, strace outputs:
That Fpoll() reminds me some recent select() issues in the kernel.
Could it be related?
Maybe something is too fast or wrong in mintv4e.prg...
Alan and others, do you have any idea?
NB: I compile with MiNTLib CVS-20140312.
* Compile with:
* m68k-atari-mint-gcc -Wall gethost.c -o gethost
const char* hostname = "atari.org";
printf("%s: %s\n", hostname, hstrerror(h_errno));
printf("%s: OK\n", hostname);