iputils / iputils

The iputils package is set of small old utilities for Linux networking.
Other
644 stars 262 forks source link

failure on musl when idn is enabled #117

Open prometheanfire opened 6 years ago

prometheanfire commented 6 years ago

Musl built with this patch, git master.

https://paste.pound-python.org/show/fL41zvIQn8jvybYXkfpm/

If built with idn (or idn2, both tested) enabled all lookups won't happen. Here's a strace.

strace -s 4096 -o /tmp/ping.strace.log /bin/ping -c 1 www.köln.de

https://paste.pound-python.org/show/qdiPCezgEoizMp1y0d3G/

even when not trying an idn I get failures

# ping google.com
ping: google.com: Invalid flags
okias commented 6 years ago

https://github.com/iputils/iputils/pull/111 there is already unfinished pull request for this fix.

prometheanfire commented 6 years ago

yep, he's updating the PR iirc, fixes the build, but not the runtime issues.

okias commented 6 years ago

if you can, please send pull request, it does build test etc. :)

I'll merge change as it pass build test.

prometheanfire commented 6 years ago

ok, now we just need runtime tests to work (ping totally fails with idn, whether or not pinging an idn address).

kerolasa commented 6 years ago

Mostly reproduced. idn name resolution does not work.

$ export CC=musl-clang
$ meson builddir -DBUILD_NINFOD=false -DUSE_CAP=false -DUSE_CRYPTO=none -DUSE_IDN=true
$ sudo chown root: builddir/ping
$ sudo setcap cap_net_raw+ep builddir/ping
$ ./builddir/ping éire.icom.museum
ping: éire.icom.museum: Name does not resolve

But my musl build worked fine when pinging IP or none-idn name.

kerolasa commented 6 years ago

musl libc site seems to be down (2018-10-20T10:01+00:00). Never mind, googling around gave me impression musl does not have support for IDN, so 'Name does not resolve' is pretty much as good as this gets right now.

okias commented 5 years ago

glibc supports IDN (non-ASCII name lookups via DNS) but requires the use of custom non-standard flags to getaddrinfo and getnameinfo to convert such names to/from the internal representation used in the DNS system (Punycode). musl does not yet support IDN conversions at all (but programs that know about IDN/Punycode and do the conversions themselves can of course lookup such names), but when support is added, it will always be enabled rather than requiring explicit options from the application.

[ https://wiki.musl-libc.org/functional-differences-from-glibc.html ]

pevik commented 5 years ago

It'd be nice to implement error message in our meson build configuration to treat this. Or at least document this problem.

kerolasa commented 5 years ago

It'd be nice to implement error message in our meson build configuration to treat this.

musl does not make it easy to notice it is in use[1][2]. And when looking into musl git[3] I see various IDN header requirements in place, so it is not obvious to me how to detect if IDN is or isn't implemented. Documentation snippet from @okias to gives me impression IDN support will be added later, transparently, so that downstream code does not need to do anything.

Just for record I am strictly against simple 'if musl do not allow IDN' exclusion. When musl delivers IDN that would harmful way nullify their efforts. In other words, only and only-if good IDN feature check can be found add build condition is ok.

Meanwhile I don't have anything better to offer than wait for musl folks. If someone has time and skills I'm sure musl folks do not mind getting IDN enabling contributions.

[1] https://wiki.musl-libc.org/faq.html#Q:-Why-is-there-no-%3Ccode%3E__MUSL__%3C/code%3E-macro? [2] http://git.savannah.gnu.org/cgit/automake.git/tree/lib/config.guess#n154 [3] git://git.musl-libc.org/musl see include/netdb.h file

Or at least document this problem.

I consider this issue to be documentation of the problem.