Bug 10611

Summary: busybox fails to connect to IPv6-and-V4 targets from v6-only hosts
Product: Busybox Reporter: luisapsilva <luis.apsilva1901>
Component: NetworkingAssignee: unassigned
Status: NEW ---    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: 1.23.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description luisapsilva 2017-12-21 17:17:10 UTC
Hello,

I am experiencing a problem similar to the one reported in Bug# 5402 - which his still open - however, in this case I see it the other way around - busybox's tftp fails to connect to V6-and-V4 targets from my V6-only box. The use of AI_ADDRCONFIG, as proposed during the investigation of 5402, addressed that problem, and at least in my configuration (busybox 1.23, glibc 2.22, linux ARM 4.1.12) I could not identify any of the side effects reported at that time.

Is there any plan to revisit the patch below?

https://bugs.busybox.net/attachment.cgi?id=4730

Thanks. 

==============================
Steps to recreate the problem:
==============================

1 - Configure a Linux box with only IPv6 addressing.

2 - Make sure you have a TFTP client running on a dual IPv4-and-IPv6 host
Ex: [root@localhost ~]#  dig silvaws.smd.devops.dell.com. any
silvaws.smd.devops.dell.com. 86400 IN   A       10.36.1.2
silvaws.smd.devops.dell.com. 86400 IN   AAAA    fd76:6c:61:6e36:a0b2:e2a7:c09:3d59

3 - Attempt to get a file from this host's TFTP server.
tftp -g -r hello.txt silvaws.smd.devops.dell.com

Actual Results
==============
tftp: sendto: Network is unreachable

Analysis
========
The call to getaddrinfo (routine str2sockaddr() in libbb/xconnect.c) 
returns both IPv6 and IPv4 address in that oerder. However, due to the configuration option ENABLE_FEATURE_PREFER_IPV4_ADDRESS, the IPv4 address is chosen.
When the AI_ADDRCONFIG is passed, no IPv4 is returned, so the IPv6 address is used.
Comment 1 Denys Vlasenko 2018-02-06 20:10:26 UTC
(In reply to luisapsilva from comment #0)
> 1 - Configure a Linux box with only IPv6 addressing.
> ...
> The call to getaddrinfo (routine str2sockaddr() in libbb/xconnect.c) 
returns both IPv6 and IPv4 address in that oerder.

The resolver returning IPv4 addresses for a pure IPv6 box would cause problems all over the place, not only in bbox.

Configure resolver not to do that. Perhaps /etc/resolv.conf "options inet6".

If resolver can't be configured this way, try running DNS cache service locally, configure it to only return IPv6, and point resolver to 127.0.0.1.