-
Notifications
You must be signed in to change notification settings - Fork 891
libpcap uses stub ether_hostton() from musl libc #1462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
A little tricky for cross-compilation, but maybe we can't do any more for people doing cross-builds (building for some embedded Linux, probably). |
An alternative could be a build option such as |
Another potential solution could be combining the above two means. Cross-compilation does not start spontaneously, so whoever is rigging it up it could add And yet another one would be to use |
The latter works and exposes a bug in libpcap's
All three BSD platforms also implement |
For the original problem there is a simple bug fix in my working copy, it is going to be a part of a pull request when other changes become ready. Case-sensitivity of Case-sensitivity of |
When libpcap compiles with musl libc, the "ether host HOSTNAME" syntax cannot resolve any hostnames: $ grep -F host.example /etc/ethers 12:34:56:78:9a:bc host.example $ ./testprogs/filtertest EN10MB 'ether src host.example' filtertest: unknown ether host 'host.example' $ /usr/lib/libc.so musl libc (aarch64) Version 1.2.5 Dynamic Program Loader Usage: /usr/lib/libc.so [options] [--] pathname [args] This is because the functions always returns -1, so if it is Linux and the libc does no identify, assume musl libc and compile the "no system ether_hostton()" code path: $ ./testprogs/filtertest EN10MB 'ether src host.example' (000) ld [8] (001) jeq #0x56789abc jt 2 jf 5 (002) ldh [6] (003) jeq #0x1234 jt 4 jf 5 (004) ret #262144 (005) ret #0 See also GitHub bug report the-tcpdump-group#1462.
The workaround is in the master branch, keeping open until the follow-ups are done. |
musl libc bug report about case-sensitive |
Linux with GNU libc:
Linux with musl libc:
This is because musl libc implements
ether_hostton()
as follows:This is good enough to be detected by the build system:
Then libpcap
nametoaddr.c
uses that instead of its substitute implementation.A potential solution could be adding a "this is musl" factor into the decision process. This isn't straightforward because musl libc, unlike GNU libc, does not identify itself in headers (see the FAQ, no comments). However, it does, like GNU libc, identify itself if one executes the libc shared library:
So perhaps the build process could translate this into something such as
HAVE_MUSL_LIBC
and thennametoaddr.c
could use that to disregardHAVE_ETHER_HOSTTON
.The text was updated successfully, but these errors were encountered: