git: ceb716ddd375 - main - net/libndp: + Neighbor discovery protocol library.

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Mon, 06 Mar 2023 19:26:45 UTC
The branch main has been updated by arrowd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ceb716ddd375d47c6519e24ba4dcf63e1d0022d1

commit ceb716ddd375d47c6519e24ba4dcf63e1d0022d1
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2023-03-06 19:12:47 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2023-03-06 19:26:35 +0000

    net/libndp: + Neighbor discovery protocol library.
    
    Sponsored by:   Serenity Cybersecurity, LLC
---
 net/Makefile                           |  1 +
 net/libndp/Makefile                    | 21 +++++++++++++++++++++
 net/libndp/distinfo                    |  3 +++
 net/libndp/files/patch-libndp_libndp.c | 29 +++++++++++++++++++++++++++++
 net/libndp/pkg-descr                   |  3 +++
 net/libndp/pkg-plist                   |  8 ++++++++
 6 files changed, 65 insertions(+)

diff --git a/net/Makefile b/net/Makefile
index 14f22947d29c..f31d9f07b85d 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -388,6 +388,7 @@
     SUBDIR += libmdf
     SUBDIR += libmediawiki
     SUBDIR += libnatpmp
+    SUBDIR += libndp
     SUBDIR += libnet
     SUBDIR += libnfs
     SUBDIR += libngtcp2
diff --git a/net/libndp/Makefile b/net/libndp/Makefile
new file mode 100644
index 000000000000..b5a010672312
--- /dev/null
+++ b/net/libndp/Makefile
@@ -0,0 +1,21 @@
+PORTNAME=	libndp
+PORTVERSION=	1.8
+CATEGORIES=	net
+
+MAINTAINER=	arrowd@FreeBSD.org
+COMMENT=	Neighbor discovery library
+WWW=		https://github.com/jpirko/libndp
+
+LICENSE=	LGPL21
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+USES=		autoreconf libtool
+
+GNU_CONFIGURE=	yes
+USE_LDCONFIG=	yes
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	jpirko
+GH_TAGNAME=	v${PORTVERSION}
+
+.include <bsd.port.mk>
diff --git a/net/libndp/distinfo b/net/libndp/distinfo
new file mode 100644
index 000000000000..9497b9359526
--- /dev/null
+++ b/net/libndp/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1678114865
+SHA256 (jpirko-libndp-1.8-v1.8_GH0.tar.gz) = c3ea76e253def89869651686a827da75b56896fe94fabd87d8c14b1d4588fd05
+SIZE (jpirko-libndp-1.8-v1.8_GH0.tar.gz) = 29145
diff --git a/net/libndp/files/patch-libndp_libndp.c b/net/libndp/files/patch-libndp_libndp.c
new file mode 100644
index 000000000000..ff0855a4302b
--- /dev/null
+++ b/net/libndp/files/patch-libndp_libndp.c
@@ -0,0 +1,29 @@
+--- libndp/libndp.c.orig	2021-05-20 09:39:25 UTC
++++ libndp/libndp.c
+@@ -35,6 +35,17 @@
+ #include <net/if.h>
+ #include <sys/ioctl.h>
+ 
++#ifdef __FreeBSD__
++#define s6_addr8  __u6_addr.__u6_addr8
++#define s6_addr16 __u6_addr.__u6_addr16
++#define s6_addr32 __u6_addr.__u6_addr32
++#define SIOCGIFHWADDR			SIOCGIFMAC
++#define ND_RA_FLAG_HOME_AGENT	ND_RA_FLAG_HA
++#define ND_OPT_PI_FLAG_RADDR	0x20
++#define ifr_hwaddr				ifr_addr
++#define ETH_ALEN				6
++#endif
++
+ #include "ndp_private.h"
+ #include "list.h"
+ 
+@@ -209,7 +220,7 @@ resend:
+ 	memcpy(&sin6.sin6_addr, addr, sizeof(sin6.sin6_addr));
+ 	sin6.sin6_scope_id = ifindex;
+ resend:
+-	ret = sendto(sockfd, buf, buflen, flags, &sin6, sizeof(sin6));
++	ret = sendto(sockfd, buf, buflen, flags, (struct sockaddr*)&sin6, sizeof(sin6));
+ 	if (ret == -1) {
+ 		switch(errno) {
+ 		case EINTR:
diff --git a/net/libndp/pkg-descr b/net/libndp/pkg-descr
new file mode 100644
index 000000000000..a10fed9ee2f3
--- /dev/null
+++ b/net/libndp/pkg-descr
@@ -0,0 +1,3 @@
+This package contains a library which provides a wrapper for IPv6 Neighbor
+Discovery Protocol.  It also provides a tool named ndptool for sending and
+receiving NDP messages.
diff --git a/net/libndp/pkg-plist b/net/libndp/pkg-plist
new file mode 100644
index 000000000000..3de754a2be60
--- /dev/null
+++ b/net/libndp/pkg-plist
@@ -0,0 +1,8 @@
+bin/ndptool
+include/ndp.h
+lib/libndp.a
+lib/libndp.so
+lib/libndp.so.0
+lib/libndp.so.0.2.0
+libdata/pkgconfig/libndp.pc
+man/man8/ndptool.8.gz