community/libndp: fix incompatible pointer type

see:
https://github.com/jpirko/libndp/pull/28
https://github.com/jpirko/libndp/issues/25
This commit is contained in:
Jingyun Hua 2024-08-26 08:55:35 +00:00 committed by Ariadne Conill
parent ae2048290f
commit 00406a9c69
2 changed files with 68 additions and 1 deletions

View File

@ -0,0 +1,65 @@
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

View File

@ -2,7 +2,7 @@
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=libndp
pkgver=1.9
pkgrel=0
pkgrel=1
pkgdesc="Library for IPv6 Neighbor Discovery Protocol"
url="http://libndp.org"
arch="all"
@ -11,6 +11,7 @@ makedepends="autoconf automake libtool"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/jpirko/libndp/archive/v$pkgver.tar.gz
0001-remove-bash-dependency.patch
0001-Patch-libndp.c.patch
"
prepare() {
@ -42,4 +43,5 @@ package() {
sha512sums="
f1494e8413c022ed8ac93022c3fc3155622f1e7fd5a1d9a1a91986852565a5e620308fe525e1ba0fa549e677384d00f49efbad35a6b53765e52ec7cee13d1fd5 libndp-1.9.tar.gz
e0cdeb09b757c8b8ed199ae9178dedcbb64769fee775be73f6c704fcb7fd749a91fda6c85b11f6ffcc010cef05a5ecc1d5b334374fa5056ab1cfae170e8afd6a 0001-remove-bash-dependency.patch
d3d860139c3e2c7ea286106966ff418c8b974b2e27bcdc416dbec2f6a1d16e5accff18ad6c75edf1ddec38d64c683837096b69b470669bfcb7864884c633c39c 0001-Patch-libndp.c.patch
"