Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 604542 - net-misc/iputils[idn] doesn't fully work on musl
Summary: net-misc/iputils[idn] doesn't fully work on musl
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo musl team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-03 19:45 UTC by Pierre-Olivier Mercier
Modified: 2019-02-21 16:49 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre-Olivier Mercier 2017-01-03 19:45:56 UTC
With the current stable version of iputils (20151218), ping6 always respond: "unknown host" if compiled with +idn USE flag.

Using 99999999 gives a more accurate response: "Invalid Flags", right after a call to getaddrinfo with AI_CANONNAME | AI_IDN | AI_CANONIDN.

Indeed, according to http://wiki.musl-libc.org/wiki/Roadmap: "IDN support in DNS resolver" will be supported in musl 1.1.17 or 1.2.0.

Others packages I tested (net-dns/bind-tools and net-misc/wget) doesn't seem to suffer from this lack: dig solves internalized domain name correctly, wget doesn't resolve IDN (even with +idn USE flag) but it solves non-IDN correctly.

May I suggest to add to package.use.mask: net-utils/iputils idn
Comment 1 David Heidelberg (okias) 2017-08-02 14:54:53 UTC
Could you try version from: https://github.com/iputils/iputils ?
Comment 2 Pierre-Olivier Mercier 2017-08-03 17:36:12 UTC
tl;dr: yes, same behavior with musl-1.1.16.


Without any patch, I got:

armv7a-hardfloat-linux-musleabi-gcc -O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -fno-strict-aliasing -Wstrict-prototypes -Wall -D_GNU_SOURCE  -c ping_common.c -DCAPABILITIES -DUSE_IDN -DUSE_OPENSSL  -o ping_common.o
In file included from ping.c:56:0:
ping.c: In function ‘main’:
ping.h:41:43: error: ‘AI_IDN’ undeclared (first use in this function)
 #define getaddrinfo_flags (AI_CANONNAME | AI_IDN | AI_CANONIDN)
                                           ^
ping.c:204:119: note: in expansion of macro ‘getaddrinfo_flags’
  struct addrinfo hints = { .ai_family = AF_UNSPEC, .ai_protocol = IPPROTO_UDP, .ai_socktype = SOCK_DGRAM, .ai_flags = getaddrinfo_flags };
                                                                                                                       ^
ping.h:41:43: note: each undeclared identifier is reported only once for each function it appears in
 #define getaddrinfo_flags (AI_CANONNAME | AI_IDN | AI_CANONIDN)
                                           ^
ping.c:204:119: note: in expansion of macro ‘getaddrinfo_flags’
  struct addrinfo hints = { .ai_family = AF_UNSPEC, .ai_protocol = IPPROTO_UDP, .ai_socktype = SOCK_DGRAM, .ai_flags = getaddrinfo_flags };
                                                                                                                       ^
ping.h:41:52: error: ‘AI_CANONIDN’ undeclared (first use in this function)
 #define getaddrinfo_flags (AI_CANONNAME | AI_IDN | AI_CANONIDN)
                                                    ^
ping.c:204:119: note: in expansion of macro ‘getaddrinfo_flags’
  struct addrinfo hints = { .ai_family = AF_UNSPEC, .ai_protocol = IPPROTO_UDP, .ai_socktype = SOCK_DGRAM, .ai_flags = getaddrinfo_flags };
                                                                                                                       ^
ping.c: In function ‘ping4_run’:
ping.h:41:43: error: ‘AI_IDN’ undeclared (first use in this function)
 #define getaddrinfo_flags (AI_CANONNAME | AI_IDN | AI_CANONIDN)
                                           ^
ping.c:546:103: note: in expansion of macro ‘getaddrinfo_flags’
  static const struct addrinfo hints = { .ai_family = AF_INET, .ai_protocol = IPPROTO_UDP, .ai_flags = getaddrinfo_flags };
                                                                                                       ^
ping.h:41:52: error: ‘AI_CANONIDN’ undeclared (first use in this function)
 #define getaddrinfo_flags (AI_CANONNAME | AI_IDN | AI_CANONIDN)
                                                    ^
ping.c:546:103: note: in expansion of macro ‘getaddrinfo_flags’
  static const struct addrinfo hints = { .ai_family = AF_INET, .ai_protocol = IPPROTO_UDP, .ai_flags = getaddrinfo_flags };
                                                                                                       ^
ping.c: In function ‘pr_addr’:
ping.h:42:27: error: ‘NI_IDN’ undeclared (first use in this function)
 #define getnameinfo_flags NI_IDN
                           ^
ping.c:1587:59: note: in expansion of macro ‘getnameinfo_flags’
  getnameinfo(sa, salen, address, sizeof address, NULL, 0, getnameinfo_flags | NI_NUMERICHOST);
                                                           ^
make: *** [Makefile:138: ping.o] Error 1
make: *** Waiting for unfinished jobs....


With a patch similar to https://gitweb.gentoo.org/proj/musl.git/tree/net-misc/iputils/files/iputils-20150815-missing-AI_IDN-AI_CANONIDN-NI_IDN.patch, it compiles, but:

# ping 1.2.3.4
ping: 1.2.3.4: Invalid flags

# ping gentoo.org
ping: gentoo.org: Invalid flags

# ping -6 2001:470:ea4a:1:225:90ff:fe02:16e5
ping: 2001:470:ea4a:1:225:90ff:fe02:16e5: Invalid flags


No problem when idn USE flag disabled.
Comment 3 David Heidelberg (okias) 2017-08-18 22:12:09 UTC
We have some patches for moving forward to libidn2 in progress, could it improve situation?

https://github.com/iputils/iputils/pull/97 

it also has to be slightly modified to compile at this moment (ping6_common.c)
Comment 4 tt_1 2018-01-03 17:54:09 UTC
should be fixed in net-misc/iputils-20171016_pre
Comment 5 Pierre-Olivier Mercier 2018-01-04 12:46:26 UTC
Compilation of net-misc/iputils-20171016_pre[idn] works well now: no error.

ATM, musl release is 1.1.18, and support for IDN is now expected for 1.1.20.
Consequently, iputils are still unusable when compiled with idn USE flag, due to lack of support in musl:

# ping 1.2.3.4
ping: 1.2.3.4: Invalid flags

# ping gentoo.org
ping: gentoo.org: Invalid flags

# ping -6 2001:470:ea4a:1:225:90ff:fe02:16e5
ping: 2001:470:ea4a:1:225:90ff:fe02:16e5: Invalid flags


Utils works as expected with idn USE flag disabled: IPs and non-IDN domains respond.
Comment 6 Anthony Basile gentoo-dev 2018-01-16 00:51:14 UTC
I've masked it for now.  If I forget, ping me when musl-1.1.20 lands and I'll remove the mask.
Comment 7 Sven E. 2018-09-03 13:40:38 UTC
(In reply to Anthony Basile from comment #6)
> I've masked it for now.  If I forget, ping me when musl-1.1.20 lands and
> I'll remove the mask.

Unfortunately emerging iputils fails:
ping.c:212:23: error: ‘AI_CANONIDN’ undeclared (first use in this function); did you mean ‘AI_CANONNAME’?
   hints.ai_flags &= ~ AI_CANONIDN;
                       ^~~~~~~~~~~
                       AI_CANONNAME

Looks like there's some conditional compilation magic missing.
Comment 8 Nicholas Fish 2018-09-03 14:23:56 UTC
This should work again once a release is issued with the commit in https://github.com/iputils/iputils/pull/138
Comment 9 tt_1 2018-09-08 11:49:20 UTC
@Sven and Nicholas: were you already using the new musl-1.1.20 by the time of writing this?
Comment 10 Nicholas Fish 2019-02-21 16:49:20 UTC
(In reply to tt_1 from comment #9)
> @Sven and Nicholas: were you already using the new musl-1.1.20 by the time
> of writing this?

I was still on musl-1.1.19.