libndp: fix incompatible pointer types with gcc14 and musl#29
Open
oreo639 wants to merge 1 commit intojpirko:masterfrom
Open
libndp: fix incompatible pointer types with gcc14 and musl#29oreo639 wants to merge 1 commit intojpirko:masterfrom
oreo639 wants to merge 1 commit intojpirko:masterfrom
Conversation
When compiling with gcc14 and musl, the following error is produced:
libndp.c: In function 'mysendto6':
libndp.c:212:50: error: passing argument 5 of 'sendto' from incompatible pointer type [-Wincompatible-pointer-types]
212 | ret = sendto(sockfd, buf, buflen, flags, &sin6, sizeof(sin6));
| ^~~~~
| |
| struct sockaddr_in6 *
In file included from libndp.c:27:
/usr/include/sys/socket.h:343:49: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_in6 *'
343 | ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
| ^~~~~~~~~~~~~~~~~~~~~~~
In POSIX, sendto() takes a sockaddr pointer:
https://pubs.opengroup.org/onlinepubs/009604499/functions/sendto.html
While glibc uses the gcc __transparent_union__ extension to mark them as
compatible types, musl does not, as such we need to explicitly cast the pointer
to tell the compiler that it is fine.
Author
|
Submitted to the mailing list (waiting moderator approval): https://lists.fedorahosted.org/archives/list/libndp@lists.fedorahosted.org/latest |
arnout
pushed a commit
to buildroot/buildroot
that referenced
this pull request
Jun 17, 2025
Patch has been pending upstream for a while [1], Alpine has merged an older version that includes some whitespace damage but is functionally equivalent. [1] jpirko/libndp#29 Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> Signed-off-by: Julien Olivain <ju.o@free.fr>
arnout
pushed a commit
to buildroot/buildroot
that referenced
this pull request
Jun 26, 2025
Patch has been pending upstream for a while [1], Alpine has merged an older version that includes some whitespace damage but is functionally equivalent. [1] jpirko/libndp#29 Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> Signed-off-by: Julien Olivain <ju.o@free.fr> (cherry picked from commit 0c2aa35) Signed-off-by: Thomas Perale <thomas.perale@mind.be>
arnout
pushed a commit
to buildroot/buildroot
that referenced
this pull request
Jun 26, 2025
Patch has been pending upstream for a while [1], Alpine has merged an older version that includes some whitespace damage but is functionally equivalent. [1] jpirko/libndp#29 Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> Signed-off-by: Julien Olivain <ju.o@free.fr> (cherry picked from commit 0c2aa35) Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When compiling with gcc14 and musl, the following error is produced:
In POSIX, sendto() takes a sockaddr pointer:
https://pubs.opengroup.org/onlinepubs/009604499/functions/sendto.html
While glibc uses the gcc
__transparent_union__extension to mark them as compatible types, musl does not, as such we need to explicitly cast the pointer to tell the compiler that it is fine.#25