1From 14e036b5daf6b72483a1a21054b5133acabceabe Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 17 May 2024 18:14:04 -0700
4Subject: [PATCH] libndp: Fix signature of sendto API
5
6This fixes build with musl/gcc-14
7
8| ../../git/libndp/libndp.c: In function 'mysendto6':
9| ../../git/libndp/libndp.c:212:50: error: passing argument 5 of 'sendto' from incompatible pointer type [-Wincompatible-pointer-types]
10|   212 |         ret = sendto(sockfd, buf, buflen, flags, &sin6, sizeof(sin6));
11|       |                                                  ^~~~~
12|       |                                                  |
13|       |                                                  struct sockaddr_in6 *
14| In file included from ../../git/libndp/libndp.c:27:
15| /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/libndp/1.8/recipe-sysroot/usr/include/sys/socket.h:396:49: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_in6 *'
16|   396 | ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
17|       |                                                 ^~~~~~~~~~~~~~~~~~~~~~~
18
19Upstream-Status: Submitted [Sent to maintainer]
20Signed-off-by: Khem Raj <raj.khem@gmail.com>
21---
22 libndp/libndp.c | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/libndp/libndp.c b/libndp/libndp.c
26index 6314717..056df0f 100644
27--- a/libndp/libndp.c
28+++ b/libndp/libndp.c
29@@ -209,7 +209,7 @@ static int mysendto6(int sockfd, void *buf, size_t buflen, int flags,
30 	memcpy(&sin6.sin6_addr, addr, sizeof(sin6.sin6_addr));
31 	sin6.sin6_scope_id = ifindex;
32 resend:
33-	ret = sendto(sockfd, buf, buflen, flags, &sin6, sizeof(sin6));
34+	ret = sendto(sockfd, buf, buflen, flags, (struct sockaddr*)&sin6, sizeof(sin6));
35 	if (ret == -1) {
36 		switch(errno) {
37 		case EINTR:
38--
392.45.1
40
41