aports/community/libndp/0001-Patch-libndp.c.patch

66 lines
1.9 KiB
Diff

Patch from: https://github.com/jpirko/libndp/pull/28
From dbfeef256dd887038d257dfdc5fca571a2bb51b1 Mon Sep 17 00:00:00 2001
From: Solegaiter <159629996+Solegaiter@users.noreply.github.com>
Date: Tue, 18 Jun 2024 17:07:40 +0200
Subject: [PATCH] Patch libndp.c
This patches a bug that made it impossible to compile on gentoo musl. This is my first patch.
---
libndp/libndp.c | 36 ++++++++++++++++++++----------------
1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/libndp/libndp.c b/libndp/libndp.c
index 72ec92e..28548f7 100644
--- a/libndp/libndp.c
+++ b/libndp/libndp.c
@@ -200,25 +200,29 @@ static int myrecvfrom6(int sockfd, void *buf, size_t *buflen, int flags,
}
static int mysendto6(int sockfd, void *buf, size_t buflen, int flags,
- struct in6_addr *addr, uint32_t ifindex)
+ struct in6_addr *addr, uint32_t ifindex)
{
- struct sockaddr_in6 sin6;
- ssize_t ret;
+ struct sockaddr_in6 sin6;
+ ssize_t ret;
+ memset(&sin6, 0, sizeof(sin6));
+
+ memcpy(&sin6.sin6_addr, addr, sizeof(sin6.sin6_addr));
+
+ sin6.sin6_scope_id = ifindex;
- memset(&sin6, 0, sizeof(sin6));
- memcpy(&sin6.sin6_addr, addr, sizeof(sin6.sin6_addr));
- sin6.sin6_scope_id = ifindex;
resend:
- ret = sendto(sockfd, buf, buflen, flags, &sin6, sizeof(sin6));
- if (ret == -1) {
- switch(errno) {
- case EINTR:
- goto resend;
- default:
- return -errno;
- }
- }
- return 0;
+ ret = sendto(sockfd, buf, buflen, flags, (const struct sockaddr *)&sin6, sizeof(sin6));
+
+ if (ret == -1) {
+ switch(errno) {
+ case EINTR:
+ goto resend;
+ default:
+ return -errno;
+ }
+ }
+
+ return 0;
}
static const char *str_in6_addr(struct in6_addr *addr, char buf[static INET6_ADDRSTRLEN])
--
2.46.0