diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-01-17 08:06:37 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-01-17 08:06:37 +0000 |
commit | e74bddc195533f6d160ee96220f5cfcc205bda1c (patch) | |
tree | 147bf202fd80bf604f6d289e985630f30b5a8438 /dev-libs/libdnet | |
parent | 20c23c152d2e7b44a6f93ec9476b808659e5ff1e (diff) |
gentoo auto-resync : 17:01:2024 - 08:06:37
Diffstat (limited to 'dev-libs/libdnet')
-rw-r--r-- | dev-libs/libdnet/Manifest | 8 | ||||
-rw-r--r-- | dev-libs/libdnet/files/libdnet-1.14-ndisc.patch | 796 | ||||
-rw-r--r-- | dev-libs/libdnet/files/libdnet-1.14-strlcpy.patch | 10 | ||||
-rw-r--r-- | dev-libs/libdnet/libdnet-1.14-r2.ebuild | 84 | ||||
-rw-r--r-- | dev-libs/libdnet/libdnet-1.16.1.ebuild | 79 | ||||
-rw-r--r-- | dev-libs/libdnet/libdnet-1.16.2.ebuild | 12 |
6 files changed, 6 insertions, 983 deletions
diff --git a/dev-libs/libdnet/Manifest b/dev-libs/libdnet/Manifest index 7f58d0627a13..d3c27a67fdbe 100644 --- a/dev-libs/libdnet/Manifest +++ b/dev-libs/libdnet/Manifest @@ -1,13 +1,7 @@ -AUX libdnet-1.14-ndisc.patch 18209 BLAKE2B a295d81c247f884293efdf8d4740e2a4fd80c9febd8a5eed02db725151f886ad32e3a52ee7a62cabd31c0a218b23a9acf7d9c52b48c0d9aa597524886e38cfc4 SHA512 6da36c0f421b58819410df9507a973199fcafebb6447765c5de97fde6bdb16607f32dcb8b86da4216656c4d4ad4d21e153f15906a400249a7d44766d0539ecfb -AUX libdnet-1.14-strlcpy.patch 233 BLAKE2B fb35015b16a206e55cbc1dc39c032dd43f74cc17e173252227707bef616df827c0ce0d7a7e4349ebc442a9198ee8953c45739b03b306ddc2af2753e31a15ebbd SHA512 8cabaf75382537755d79b588b629978d47a4b8e7c4bda22d7098bba09b5b1fec8dabeacb1727a821df2d29040a3e420803ebfdc66df5824630fae8da1059d164 -DIST libdnet-1.14.tar.gz 520833 BLAKE2B 97e241fc374fc9489e70d440db5e19199f4e653650af85e24af56bbbc0167db1c451349c43fcb630a26c61f8ca15c58f5c879e0d82654e275189ca3e140bb22a SHA512 ce8d95228f5175e4d9a8ff71bb99eb1ccc3ccd599a85dd07adbfd9842fc54066235d362c8060828fb3ba8129d0e1e8e071e93d60d69c6d03be310c80e61cea93 -DIST libdnet-1.16.1.tar.gz 666619 BLAKE2B 74472af1bc97c4771909e926eb9b27193c50d665036672fc89ff21159408daeef090e682c5e76e19f31d04e802fb73edf01d1aa057b543568f534d31f8db375b SHA512 9c6899b42502f3892463f1ec694934cc3b02831222fa15b5a899868229366ed4e9cc728ea2c70ec857ee9d676d763b1e390f6878a597a33f7d1cd5a7bd870586 DIST libdnet-1.16.2.tar.gz 675191 BLAKE2B 04e4533dbe45700decec4755c7db608d0ca68be05431bf44e6984b2c6a4aec55888fc0f0159916c8ac4a60ec5f743047d2a0a541786cd13fda61739bd7eef0fb SHA512 4b1902553a57eeb56952968e15be032de92d8106dc6e0ebf8e10470605c9c2ed69cb015f4057a5c119d01509c6795fc0dcda85a311d14124dddefdeb6223f848 DIST libdnet-1.16.4.tar.gz 684358 BLAKE2B 40be891c9004288329aaee0c79a29ebf0f095dfaaca4da98fd5ecfd759e22b8d10dc6b906200db1ac5b0a8cfbbea8fbe509da393e60cddeb5f875ad179cdc67a SHA512 6c5556e365047afcc5da3f76b1c99aa70723c076a7cf75c03d96a661a583dfa6d0ab605076e68efffe5ddca2d69875e4bc4938e0874b8aa24915fcfbfe3f3ff9 DIST libdnet-1.17.0.tar.gz 684645 BLAKE2B b208cb41201145411b1949531cb1ab27b4edc6026b8ca703c24231fdb021f46bfe922eb1da11090c271f439339f5384c93168fad3130ed2f89b3d2eca5c7f89f SHA512 b207b2f61e3759a2b17827eabf37b0eb68cb9fa27418f99ee4efd754b01dfe8504dff465664b14054d54df334195d43963d142c7104dc603b2b8b1491590d2a7 -EBUILD libdnet-1.14-r2.ebuild 1556 BLAKE2B c549d9c5e392f2f15df9c2c2bcc474f2c408a3236743a19432b519cb7208574684c7d63947d037d1aba8412ef84497381d52e48edd869268046aa0ac26ad939b SHA512 0e45ffea4a32f5c105882f74c2234642dffbe2401ba4c8ac1d123cd201d7ce26476f4d7fe0024aed7aa97e33d75fed4d919d35460dc5ca8bdb4d05f55f279989 -EBUILD libdnet-1.16.1.ebuild 1553 BLAKE2B dbcf406178927cd3a534870b65410c43c7ac596635bc4892acd95d8791c63623024afc2775a2c8b3dfb72489e62678a68b3e26ade7c9616a3ae7f7c89321a96d SHA512 289bced20031cd4a2098848af0681a723f59154b0ada4fc123dfd2c0379f341f35734e217d45321c5f36790efc5a0127e2c90f69151bd0f2d5d0651f06d397cc -EBUILD libdnet-1.16.2.ebuild 1553 BLAKE2B d5a9091bffff2432a91da5835f4c8bd2d84622ec7a89de2c44befebde0f82db4bbe9f1ddb6c6b41088053793f540982874b6929e24ef0a70ac159d456518cc27 SHA512 38b7ff68ef2790c0dd3fb6e3700bf79313371e9587e0244a13a2ebed27c1bac1f0da9bc86b3ae5402c30b2f94bce5a229ec2d336a9c3108a4410e13bd0d0a9c2 +EBUILD libdnet-1.16.2.ebuild 1487 BLAKE2B 4d64d85c38a042642cfa408c8efde1959a291c6e11cd87c8030e258f4196c52d5bdc21017b6b554609c52e977e3f619e55fe1e32505374b64e5634e0f7c43b02 SHA512 a0fa5cd49edb6cecc2ae4f8ca5fd3018cde8d926bedfc8dac40b8598d9b1ca269d9ed28ae0d9c69ad411aa3a0d9f2e20954acfe04a872f7bacd3b4b6209b1d01 EBUILD libdnet-1.16.4.ebuild 1656 BLAKE2B ae80580d5bc7356f15656301952d32ab8cb378c6c04f34bfa48322140dfa815c6f5f2f9de9148b8c1576c00e041807b322b4e20155f6c8d9fa0771de80da2c13 SHA512 d1c6d190c359f12bdeb25440f89c32d29145da43d3de90900db79670420067fce15eccfaaef9d7dd5a17d24f3dedcbb8b8ab5ff0d5c89a1d46af48eef03657ee EBUILD libdnet-1.17.0.ebuild 1694 BLAKE2B 28220e61da04de8acdb0b9ccf8b9639877e46ba9cdb2b931dbedc83f78dae485fd9c7df60556922df06de37c83bdefeea614ceb8314906ebe2f4796a2229c2c3 SHA512 0c5f36eb0445327af59cf4296c06f37ab3f49702458a3d0e4706c898f67e3cde690309cf113f2c1a87e101c6d21792d8459e21ce616b282011ccc4a137df81ba MISC metadata.xml 413 BLAKE2B 91e8ea8dfe7585b6bcce394bc63e466cd7094b8b12ecb4f6b03303b37575387250f81c85a3be03cf8b36cbe10ef724794c86afec5decb5f042d0cde5db2bfdc6 SHA512 af7f752fa0811cb6e57b2398a86f5c57bbc0af1e3392ff3c26af27568ae3ed5232f765558f5e3b01cb6a6e3debfe2b0b893fc2c3598776d94eb6318744ca6fce diff --git a/dev-libs/libdnet/files/libdnet-1.14-ndisc.patch b/dev-libs/libdnet/files/libdnet-1.14-ndisc.patch deleted file mode 100644 index 439ffb7cb927..000000000000 --- a/dev-libs/libdnet/files/libdnet-1.14-ndisc.patch +++ /dev/null @@ -1,796 +0,0 @@ -From 1c324828f4c6c64c9340f169bc059152dba1f998 Mon Sep 17 00:00:00 2001 -From: Stas Grabois <finpushack@gmail.com> -Date: Sat, 5 Sep 2020 13:15:32 +0300 -Subject: [PATCH] IPv6 support - ---- - configure | 20 ++++ - configure.ac | 7 ++ - include/dnet.h | 1 + - include/dnet/Makefile.am | 2 +- - include/dnet/Makefile.in | 2 +- - include/dnet/ip6.h | 3 + - include/dnet/ndisc.h | 35 +++++++ - include/dnet/route.h | 3 + - src/Makefile.in | 2 +- - src/intf.c | 101 +++++++++++++------- - src/ip6.c | 56 +++++++++++ - src/ndisc-linux.c | 197 +++++++++++++++++++++++++++++++++++++++ - src/ndisc-none.c | 55 +++++++++++ - src/route-linux.c | 95 ++++++++++++++++++- - 14 files changed, 541 insertions(+), 38 deletions(-) - create mode 100644 include/dnet/ndisc.h - create mode 100644 src/ndisc-linux.c - create mode 100644 src/ndisc-none.c - ---- a/configure -+++ b/configure -@@ -22025,6 +22025,26 @@ - - fi - -+if test "$ac_cv_dnet_linux_procfs" = yes ; then -+ case $LIBOBJS in -+ "ndisc-linux.$ac_objext" | \ -+ *" ndisc-linux.$ac_objext" | \ -+ "ndisc-linux.$ac_objext "* | \ -+ *" ndisc-linux.$ac_objext "* ) ;; -+ *) LIBOBJS="$LIBOBJS ndisc-linux.$ac_objext" ;; -+esac -+ -+else -+ case $LIBOBJS in -+ "ndisc-none.$ac_objext" | \ -+ *" ndisc-none.$ac_objext" | \ -+ "ndisc-none.$ac_objext "* | \ -+ *" ndisc-none.$ac_objext "* ) ;; -+ *) LIBOBJS="$LIBOBJS ndisc-none.$ac_objext" ;; -+esac -+ -+fi -+ - if test "$ac_cv_header_linux_if_tun_h" = yes ; then - case $LIBOBJS in - "tun-linux.$ac_objext" | \ ---- a/configure.ac -+++ b/configure.ac -@@ -303,6 +303,13 @@ - AC_LIBOBJ([route-none]) - fi - -+dnl Check for ndisc interface. -+if test "$ac_cv_dnet_linux_procfs" = yes ; then -+ AC_LIBOBJ([ndisc-linux]) -+else -+ AC_LIBOBJ([ndisc-none]) -+fi -+ - dnl Check for tun interface. - if test "$ac_cv_header_linux_if_tun_h" = yes ; then - AC_LIBOBJ([tun-linux]) ---- a/include/dnet.h -+++ b/include/dnet.h -@@ -16,6 +16,7 @@ - #include <dnet/ip6.h> - #include <dnet/addr.h> - #include <dnet/arp.h> -+#include <dnet/ndisc.h> - #include <dnet/icmp.h> - #include <dnet/tcp.h> - #include <dnet/udp.h> ---- a/include/dnet/Makefile.am -+++ b/include/dnet/Makefile.am -@@ -5,4 +5,4 @@ - dnetincludedir = $(includedir)/dnet - - dnetinclude_HEADERS = addr.h arp.h blob.h eth.h fw.h icmp.h intf.h ip.h \ -- ip6.h os.h rand.h route.h tcp.h tun.h udp.h sctp.h -+ ip6.h os.h rand.h route.h tcp.h tun.h udp.h sctp.h ndisc.h ---- a/include/dnet/Makefile.in -+++ b/include/dnet/Makefile.in -@@ -106,7 +106,7 @@ - dnetincludedir = $(includedir)/dnet - - dnetinclude_HEADERS = addr.h arp.h blob.h eth.h fw.h icmp.h intf.h ip.h \ -- ip6.h os.h rand.h route.h tcp.h tun.h udp.h sctp.h -+ ip6.h os.h rand.h route.h tcp.h tun.h udp.h sctp.h ndisc.h - - subdir = include/dnet - mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs ---- a/include/dnet/ip6.h -+++ b/include/dnet/ip6.h -@@ -179,6 +179,9 @@ - char *ip6_ntoa(const ip6_addr_t *ip6); - #define ip6_aton ip6_pton - -+ssize_t ip6_add_option(void *buf, size_t len, -+ int proto, const void *optbuf, size_t optlen); -+ - void ip6_checksum(void *buf, size_t len); - __END_DECLS - -new file mode 100644 ---- a//dev/null -+++ b/include/dnet/ndisc.h -@@ -0,0 +1,35 @@ -+/* -+ * ndisc.c -+ * -+ * Kernel arp/ndisc table operations. -+ * -+ * Copyright (c) 2000 Dug Song <dugsong@monkey.org> -+ * -+ */ -+ -+#ifndef DNET_NDISC_H -+#define DNET_NDISC_H -+ -+/* -+ * NDISC cache entry -+ */ -+struct ndisc_entry { -+ int intf_index; -+ struct addr ndisc_pa; /* protocol address */ -+ struct addr ndisc_ha; /* hardware address */ -+}; -+ -+typedef struct ndisc_handle ndisc_t; -+ -+typedef int (*ndisc_handler)(const struct ndisc_entry *entry, void *arg); -+ -+__BEGIN_DECLS -+ndisc_t *ndisc_open(void); -+int ndisc_add(ndisc_t *n, const struct ndisc_entry *entry); -+int ndisc_delete(ndisc_t *n, const struct ndisc_entry *entry); -+int ndisc_get(ndisc_t *n, struct ndisc_entry *entry); -+int ndisc_loop(ndisc_t *n, ndisc_handler callback, void *arg); -+ndisc_t *ndisc_close(ndisc_t *r); -+__END_DECLS -+ -+#endif /* DNET_NDISC_H */ ---- a/include/dnet/route.h -+++ b/include/dnet/route.h -@@ -26,7 +26,10 @@ - __BEGIN_DECLS - route_t *route_open(void); - int route_add(route_t *r, const struct route_entry *entry); -+int route_add_dev(route_t *r, const struct route_entry *entry, const char* dev); -+int route6_add(route_t *r, const struct route_entry *entry, int intf_index); - int route_delete(route_t *r, const struct route_entry *entry); -+int route6_delete(route_t *r, const struct route_entry *entry, int intf_index); - int route_get(route_t *r, struct route_entry *entry); - int route_loop(route_t *r, route_handler callback, void *arg); - route_t *route_close(route_t *r); ---- a/src/Makefile.in -+++ b/src/Makefile.in -@@ -144,7 +144,7 @@ - intf-win32.c intf.c ip-cooked.c ip-win32.c ip.c memcmp.c \ - route-bsd.c route-hpux.c route-linux.c route-none.c \ - route-win32.c strlcat.c strlcpy.c strsep.c tun-bsd.c \ -- tun-linux.c tun-none.c tun-solaris.c -+ tun-linux.c tun-none.c tun-solaris.c ndisc-linux.c ndisc-none.c - SOURCES = $(libdnet_la_SOURCES) - - all: all-am ---- a/src/intf.c -+++ b/src/intf.c -@@ -20,6 +20,9 @@ - # define IP_MULTICAST - #endif - #include <net/if.h> -+#ifdef HAVE_NET_IF_DL_H -+# include <net/if_dl.h> -+#endif - #ifdef HAVE_NET_IF_VAR_H - # include <net/if_var.h> - #endif -@@ -79,6 +82,21 @@ - u_char ifcbuf[4192]; - }; - -+/* TODO: move to .h */ -+union sockunion { -+#ifdef HAVE_NET_IF_DL_H -+ struct sockaddr_dl sdl; -+#endif -+ struct sockaddr_in sin; -+#ifdef HAVE_SOCKADDR_IN6 -+ struct sockaddr_in6 sin6; -+#endif -+ struct sockaddr sa; -+#ifdef AF_RAW -+ struct sockaddr_raw sr; -+#endif -+}; -+ - static int - intf_flags_to_iff(u_short flags, int iff) - { -@@ -129,14 +147,10 @@ - - setsockopt(intf->fd, SOL_SOCKET, SO_BROADCAST, - (const char *) &one, sizeof(one)); --#ifdef SIOCGIFNETMASK_IN6 - if ((intf->fd6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { --# ifdef EPROTONOSUPPORT - if (errno != EPROTONOSUPPORT) --# endif - return (intf_close(intf)); - } --#endif - } - return (intf); - } -@@ -586,34 +600,50 @@ - return (_intf_get_aliases(intf, entry)); - } - -+static int -+get_max_bits(const struct addr *a) -+{ -+ if (a->addr_type == ADDR_TYPE_IP) { -+ return IP_ADDR_BITS; -+ } else if (a->addr_type == ADDR_TYPE_IP6) { -+ return IP6_ADDR_BITS; -+ } else { -+ return 0; -+ } -+} -+ - static int - _match_intf_src(const struct intf_entry *entry, void *arg) - { -- int matched = 0; -- int cnt; - struct intf_entry *save = (struct intf_entry *)arg; -- -- if (entry->intf_addr.addr_type == ADDR_TYPE_IP && -- entry->intf_addr.addr_ip == save->intf_addr.addr_ip) { -- matched = 1; -- } else { -- for (cnt = 0; !matched && cnt < (int) entry->intf_alias_num; cnt++) { -- if (entry->intf_alias_addrs[cnt].addr_type != ADDR_TYPE_IP) -- continue; -- if (entry->intf_alias_addrs[cnt].addr_ip == save->intf_addr.addr_ip) -- matched = 1; -- } -+ int len = save->intf_len < entry->intf_len ? save->intf_len : entry->intf_len; -+ int i; -+ -+ struct addr a, saved_addr; -+ -+ saved_addr = save->intf_addr; -+ saved_addr.addr_bits = get_max_bits(&saved_addr); -+ -+ a = entry->intf_addr; -+ a.addr_bits = get_max_bits(&a); -+ -+ if (addr_cmp(&a, &saved_addr) == 0) { -+ memcpy(save, entry, len); -+ return 1; - } - -- if (matched) { -- /* XXX - truncated result if entry is too small. */ -- if (save->intf_len < entry->intf_len) -- memcpy(save, entry, save->intf_len); -- else -- memcpy(save, entry, entry->intf_len); -- return (1); -+ for (i = 0; i < (int)entry->intf_alias_num; i++) { -+ a = entry->intf_alias_addrs[i]; -+ a.addr_bits = get_max_bits(&a); -+ -+ if (addr_cmp(&a, &saved_addr) == 0) { -+ memcpy(save, entry, len); -+ save->intf_addr = entry->intf_alias_addrs[i]; -+ return 1; -+ } - } -- return (0); -+ -+ return 0; - } - - int -@@ -631,24 +661,27 @@ - int - intf_get_dst(intf_t *intf, struct intf_entry *entry, struct addr *dst) - { -- struct sockaddr_in sin; -+ union sockunion sun; - socklen_t n; - -- if (dst->addr_type != ADDR_TYPE_IP) { -+ int fd; -+ -+ if (dst->addr_type != ADDR_TYPE_IP && dst->addr_type != ADDR_TYPE_IP6) { - errno = EINVAL; - return (-1); - } -- addr_ntos(dst, (struct sockaddr *)&sin); -- sin.sin_port = htons(666); -- -- if (connect(intf->fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) -+ addr_ntos(dst, (struct sockaddr *)&sun); -+ sun.sin.sin_port = htons(666); -+ -+ fd = dst->addr_type == ADDR_TYPE_IP6 ? intf->fd6 : intf->fd; -+ if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) < 0) - return (-1); - -- n = sizeof(sin); -- if (getsockname(intf->fd, (struct sockaddr *)&sin, &n) < 0) -+ n = sizeof(sun); -+ if (getsockname(fd, (struct sockaddr *)&sun, &n) < 0) - return (-1); - -- addr_ston((struct sockaddr *)&sin, &entry->intf_addr); -+ addr_ston((struct sockaddr *)&sun, &entry->intf_addr); - - if (intf_loop(intf, _match_intf_src, entry) != 1) - return (-1); ---- a/src/ip6.c -+++ b/src/ip6.c -@@ -9,6 +9,8 @@ - #include "config.h" - - #include "dnet.h" -+#include <string.h> -+#include <errno.h> - - #define IP6_IS_EXT(n) \ - ((n) == IP_PROTO_HOPOPTS || (n) == IP_PROTO_DSTOPTS || \ -@@ -70,3 +72,57 @@ - } - } - } -+ -+ssize_t -+ip6_add_option(void *buf, size_t len, int proto, -+ const void *optbuf, size_t optlen) -+{ -+ struct ip6_hdr *ip6; -+ struct tcp_hdr *tcp = NULL; -+ u_char *p; -+ int hl, datalen, padlen; -+ -+ if (proto != IP_PROTO_TCP) { -+ errno = EINVAL; -+ return (-1); -+ } -+ -+ ip6 = (struct ip6_hdr *)buf; -+ p = (u_char *)buf + IP6_HDR_LEN; -+ -+ tcp = (struct tcp_hdr *)p; -+ hl = tcp->th_off << 2; -+ p = (u_char *)tcp + hl; -+ -+ datalen = ntohs(ip6->ip6_plen) + IP6_HDR_LEN - (p - (u_char *)buf); -+ -+ /* Compute padding to next word boundary. */ -+ if ((padlen = 4 - (optlen % 4)) == 4) -+ padlen = 0; -+ -+ /* XXX - IP_HDR_LEN_MAX == TCP_HDR_LEN_MAX */ -+ if (hl + optlen + padlen > IP_HDR_LEN_MAX || -+ ntohs(ip6->ip6_plen) + IP6_HDR_LEN + optlen + padlen > len) { -+ errno = EINVAL; -+ return (-1); -+ } -+ -+ /* Shift any existing data. */ -+ if (datalen) { -+ memmove(p + optlen + padlen, p, datalen); -+ } -+ /* XXX - IP_OPT_NOP == TCP_OPT_NOP */ -+ if (padlen) { -+ memset(p, IP_OPT_NOP, padlen); -+ p += padlen; -+ } -+ memmove(p, optbuf, optlen); -+ p += optlen; -+ optlen += padlen; -+ -+ tcp->th_off = (p - (u_char *)tcp) >> 2; -+ -+ ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) + optlen); -+ -+ return (optlen); -+} -new file mode 100644 ---- a//dev/null -+++ b/src/ndisc-linux.c -@@ -0,0 +1,197 @@ -+/* -+ * ndisc-linux.c -+ * -+ * Copyright (c) 2000 Dug Song <dugsong@monkey.org> -+ * -+ */ -+ -+#include "config.h" -+ -+#include <sys/types.h> -+#include <sys/ioctl.h> -+#include <sys/socket.h> -+#include <sys/uio.h> -+ -+#include <asm/types.h> -+#include <netinet/in.h> -+#include <linux/netlink.h> -+#include <linux/rtnetlink.h> -+ -+#include <net/route.h> -+ -+#include <ctype.h> -+#include <errno.h> -+#include <stdio.h> -+#include <stdlib.h> -+#include <string.h> -+#include <unistd.h> -+ -+#include "dnet.h" -+ -+struct ndisc_handle -+{ -+ int nlfd; -+ int seq; -+}; -+ -+ndisc_t * -+ndisc_open(void) -+{ -+ struct sockaddr_nl snl; -+ ndisc_t *n; -+ -+ if ((n = calloc(1, sizeof(*n))) != NULL) { -+ n->nlfd = -1; -+ -+ if ((n->nlfd = socket(AF_NETLINK, SOCK_RAW, -+ NETLINK_ROUTE)) < 0) -+ return (ndisc_close(n)); -+ -+ memset(&snl, 0, sizeof(snl)); -+ snl.nl_family = AF_NETLINK; -+ -+ if (bind(n->nlfd, (struct sockaddr *)&snl, sizeof(snl)) < 0) -+ return (ndisc_close(n)); -+ } -+ return (n); -+} -+ -+static int -+netlink_addattr(struct nlmsghdr *n, int type, const void *data, int data_len) -+{ -+ int len = RTA_LENGTH(data_len); -+ struct rtattr *rta; -+ -+ rta = (struct rtattr *)((uint8_t*)n + NLMSG_ALIGN(n->nlmsg_len)); -+ rta->rta_type = type; -+ rta->rta_len = len; -+ memcpy(RTA_DATA(rta), data, data_len); -+ n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len); -+ return 0; -+} -+ -+int -+ndisc_modify(ndisc_t *n, const struct ndisc_entry *entry, int type, int flags) -+{ -+ struct nlmsghdr *nmsg; -+ struct ndmsg *ndm; -+ struct rtattr *rta; -+ struct sockaddr_nl snl; -+ struct iovec iov; -+ struct msghdr msg; -+ u_char buf[512]; -+ int i, af, alen; -+ -+ switch (entry->ndisc_pa.addr_type) { -+ case ADDR_TYPE_IP: -+ af = AF_INET; -+ alen = IP_ADDR_LEN; -+ break; -+ case ADDR_TYPE_IP6: -+ af = AF_INET6; -+ alen = IP6_ADDR_LEN; -+ break; -+ default: -+ errno = EINVAL; -+ return (-1); -+ } -+ memset(buf, 0, sizeof(buf)); -+ -+ nmsg = (struct nlmsghdr *)buf; -+ nmsg->nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)); -+ nmsg->nlmsg_flags = NLM_F_REQUEST | flags; -+ nmsg->nlmsg_type = type; -+ nmsg->nlmsg_seq = ++n->seq; -+ -+ nmsg->nlmsg_flags |= NLM_F_ACK; -+ -+ ndm = (struct ndmsg *)(nmsg + 1); -+ ndm->ndm_family = af; -+ ndm->ndm_state = NUD_PERMANENT; -+ ndm->ndm_ifindex = entry->intf_index; -+ -+ netlink_addattr(nmsg, NDA_DST, &entry->ndisc_pa.addr_data8[0], -+ alen); -+ -+ if (type == RTM_NEWNEIGH) { -+ netlink_addattr(nmsg, NDA_LLADDR, -+ &entry->ndisc_ha.addr_data8[0], ETH_ADDR_LEN); -+ } -+ -+ memset(&snl, 0, sizeof(snl)); -+ snl.nl_family = AF_NETLINK; -+ -+ iov.iov_base = nmsg; -+ iov.iov_len = nmsg->nlmsg_len; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.msg_name = &snl; -+ msg.msg_namelen = sizeof(snl); -+ msg.msg_iov = &iov; -+ msg.msg_iovlen = 1; -+ -+ if (sendmsg(n->nlfd, &msg, 0) < 0) -+ return (-1); -+ -+ iov.iov_base = buf; -+ iov.iov_len = sizeof(buf); -+ -+ if ((i = recvmsg(n->nlfd, &msg, 0)) <= 0) -+ return (-1); -+ -+ if (nmsg->nlmsg_len < (int)sizeof(*nmsg) || nmsg->nlmsg_len > i || -+ nmsg->nlmsg_seq != n->seq) { -+ errno = EINVAL; -+ return (-1); -+ } -+ if (nmsg->nlmsg_type == NLMSG_ERROR) { -+ struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(nmsg); -+ errno = -err->error; -+ if (errno == 0) { -+ return 0; -+ } -+ -+ return (-1); -+ } -+ -+ return (-1); -+} -+ -+int -+ndisc_add(ndisc_t *n, const struct ndisc_entry *entry) -+{ -+ return ndisc_modify(n, entry, RTM_NEWNEIGH, NLM_F_CREATE | NLM_F_EXCL); -+} -+ -+int -+ndisc_delete(ndisc_t *n, const struct ndisc_entry *entry) -+{ -+ return ndisc_modify(n, entry, RTM_DELNEIGH, 0); -+} -+ -+int -+ndisc_get(ndisc_t *n, struct ndisc_entry *entry) -+{ -+ /* TBD */ -+ errno = ENOSYS; -+ return (-1); -+} -+ -+int -+nsidc_loop(ndisc_t *n, ndisc_handler callback, void *arg) -+{ -+ /* TBD */ -+ errno = ENOSYS; -+ return (-1); -+} -+ -+ndisc_t * -+ndisc_close(ndisc_t *n) -+{ -+ if (n != NULL) { -+ if (n->nlfd >= 0) -+ close(n->nlfd); -+ free(n); -+ } -+ return (NULL); -+} -new file mode 100644 ---- a//dev/null -+++ b/src/ndisc-none.c -@@ -0,0 +1,55 @@ -+/* -+ * ndisc-linux.c -+ * -+ * Copyright (c) 2000 Dug Song <dugsong@monkey.org> -+ * -+ */ -+ -+#include "config.h" -+ -+#include <errno.h> -+#include <stdio.h> -+#include <stdlib.h> -+ -+#include "dnet.h" -+ -+ndisc_t * -+ndisc_open(void) -+{ -+ errno = ENOSYS; -+ return (NULL); -+} -+ -+int -+ndisc_add(ndisc_t *n, const struct ndisc_entry *entry) -+{ -+ errno = ENOSYS; -+ return (-1); -+} -+ -+int -+ndisc_delete(ndisc_t *n, const struct ndisc_entry *entry) -+{ -+ errno = ENOSYS; -+ return (-1); -+} -+ -+int -+ndisc_get(ndisc_t *n, struct ndisc_entry *entry) -+{ -+ errno = ENOSYS; -+ return (-1); -+} -+ -+int -+nsidc_loop(ndisc_t *n, ndisc_handler callback, void *arg) -+{ -+ errno = ENOSYS; -+ return (-1); -+} -+ -+ndisc_t * -+ndisc_close(ndisc_t *n) -+{ -+ return (NULL); -+} ---- a/src/route-linux.c -+++ b/src/route-linux.c -@@ -39,6 +39,7 @@ - - struct route_handle { - int fd; -+ int fd6; - int nlfd; - }; - -@@ -49,10 +50,13 @@ - route_t *r; - - if ((r = calloc(1, sizeof(*r))) != NULL) { -- r->fd = r->nlfd = -1; -+ r->fd = r->fd6 = r->nlfd = -1; - - if ((r->fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - return (route_close(r)); -+ -+ if ((r->fd6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) -+ return (route_close(r)); - - if ((r->nlfd = socket(AF_NETLINK, SOCK_RAW, - NETLINK_ROUTE)) < 0) -@@ -90,6 +94,67 @@ - return (ioctl(r->fd, SIOCADDRT, &rt)); - } - -+int -+route_add_dev(route_t *r, const struct route_entry *entry, const char* dev) -+{ -+ struct rtentry rt; -+ struct addr dst; -+ -+ memset(&rt, 0, sizeof(rt)); -+ rt.rt_flags = RTF_UP; -+ rt.rt_dev = (char*)dev; -+ -+ if (ADDR_ISHOST(&entry->route_dst)) { -+ rt.rt_flags |= RTF_HOST; -+ memcpy(&dst, &entry->route_dst, sizeof(dst)); -+ } else -+ addr_net(&entry->route_dst, &dst); -+ -+ if (entry->route_gw.addr_ip != 0) { -+ rt.rt_flags |= RTF_GATEWAY; -+ } -+ -+ if (addr_ntos(&dst, &rt.rt_dst) < 0 || -+ addr_ntos(&entry->route_gw, &rt.rt_gateway) < 0 || -+ addr_btos(entry->route_dst.addr_bits, &rt.rt_genmask) < 0) -+ return (-1); -+ -+ int ret = (ioctl(r->fd, SIOCADDRT, &rt)); -+ return ret; -+} -+ -+int -+route6_add(route_t *r, const struct route_entry *entry, int intf_index) -+{ -+ struct in6_rtmsg rt; -+ struct addr dst; -+ -+ memset(&rt, 0, sizeof(rt)); -+ rt.rtmsg_flags = RTF_UP; -+ -+ if (ADDR_ISHOST(&entry->route_dst)) { -+ rt.rtmsg_flags |= RTF_HOST; -+ memcpy(&dst, &entry->route_dst, sizeof(dst)); -+ } else { -+ addr_net(&entry->route_dst, &dst); -+ } -+ -+ rt.rtmsg_dst_len = entry->route_dst.addr_bits; -+ rt.rtmsg_ifindex = intf_index; -+ rt.rtmsg_metric = 1; -+ -+ memcpy(&rt.rtmsg_dst, &dst.addr_ip6, sizeof(rt.rtmsg_dst)); -+ -+ if (!IN6_IS_ADDR_UNSPECIFIED(&entry->route_gw.addr_ip6)) { -+ rt.rtmsg_flags |= RTF_GATEWAY; -+ memcpy(&rt.rtmsg_gateway, &entry->route_gw.addr_ip6, -+ sizeof(rt.rtmsg_gateway)); -+ } -+ -+ int ret = (ioctl(r->fd6, SIOCADDRT, &rt)); -+ return ret; -+} -+ - int - route_delete(route_t *r, const struct route_entry *entry) - { -@@ -112,6 +177,32 @@ - return (ioctl(r->fd, SIOCDELRT, &rt)); - } - -+int -+route6_delete(route_t *r, const struct route_entry *entry, int intf_index) -+{ -+ struct in6_rtmsg rt; -+ struct addr dst; -+ -+ memset(&rt, 0, sizeof(rt)); -+ rt.rtmsg_flags = RTF_UP; -+ -+ if (ADDR_ISHOST(&entry->route_dst)) { -+ rt.rtmsg_flags |= RTF_HOST; -+ memcpy(&dst, &entry->route_dst, sizeof(dst)); -+ } else -+ addr_net(&entry->route_dst, &dst); -+ -+ rt.rtmsg_dst_len = entry->route_dst.addr_bits; -+ rt.rtmsg_ifindex = intf_index; -+ rt.rtmsg_metric = 1; -+ -+ memcpy(&rt.rtmsg_dst, &dst, sizeof(rt.rtmsg_dst)); -+ memcpy(&rt.rtmsg_gateway, &entry->route_gw, sizeof(rt.rtmsg_gateway)); -+ -+ int ret = (ioctl(r->fd6, SIOCDELRT, &rt)); -+ return ret; -+} -+ - int - route_get(route_t *r, struct route_entry *entry) - { -@@ -278,6 +369,8 @@ - if (r != NULL) { - if (r->fd >= 0) - close(r->fd); -+ if (r->fd6 >= 0) -+ close(r->fd6); - if (r->nlfd >= 0) - close(r->nlfd); - free(r); diff --git a/dev-libs/libdnet/files/libdnet-1.14-strlcpy.patch b/dev-libs/libdnet/files/libdnet-1.14-strlcpy.patch deleted file mode 100644 index abc3a6b0f2d3..000000000000 --- a/dev-libs/libdnet/files/libdnet-1.14-strlcpy.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/python/dnet.c -+++ b/python/dnet.c -@@ -22,6 +22,7 @@ - #endif - __PYX_EXTERN_C double pow(double, double); - #include "dnet.h" -+#include "config.h" - - - typedef struct {const char *s; const void **p;} __Pyx_CApiTabEntry; /*proto*/ diff --git a/dev-libs/libdnet/libdnet-1.14-r2.ebuild b/dev-libs/libdnet/libdnet-1.14-r2.ebuild deleted file mode 100644 index 90dbdead4409..000000000000 --- a/dev-libs/libdnet/libdnet-1.14-r2.ebuild +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright 1999-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -AT_M4DIR="config" -PYTHON_COMPAT=( python3_{9..10} ) -DISTUTILS_OPTIONAL=1 -inherit autotools distutils-r1 - -DESCRIPTION="simplified, portable interface to several low-level networking routines" -HOMEPAGE="https://github.com/ofalk/libdnet" -SRC_URI="https://github.com/ofalk/${PN}/archive/${P}.tar.gz" -S="${WORKDIR}/${PN}-${P}" - -LICENSE="LGPL-2" -SLOT="0" -KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~mips ppc ppc64 ~riscv sparc x86" -IUSE="python test" -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" -RESTRICT="!test? ( test )" - -DEPEND="python? ( ${PYTHON_DEPS} )" -RDEPEND="${DEPEND}" -BDEPEND=" - python? ( - dev-python/cython[${PYTHON_USEDEP}] - ) -" - -DOCS=( README.md THANKS ) - -PATCHES=( - "${FILESDIR}/${PN}-1.14-ndisc.patch" - "${FILESDIR}/${PN}-1.14-strlcpy.patch" -) - -src_prepare() { - default - - sed -i \ - -e 's/libcheck.a/libcheck.so/g' \ - -e 's|AM_CONFIG_HEADER|AC_CONFIG_HEADERS|g' \ - configure.ac || die - sed -i \ - -e 's|-L$libdir ||g' \ - dnet-config.in || die - sed -i \ - -e '/^SUBDIRS/s|python||g' \ - Makefile.am || die - - eautoreconf - - if use python; then - cd python || die - distutils-r1_src_prepare - fi -} - -src_configure() { - econf \ - --disable-static \ - $(use_with python) -} - -src_compile() { - default - if use python; then - cd python || die - distutils-r1_src_compile - fi -} - -src_install() { - default - - if use python; then - cd python || die - unset DOCS - distutils-r1_src_install - fi - - find "${ED}" -name '*.la' -delete || die -} diff --git a/dev-libs/libdnet/libdnet-1.16.1.ebuild b/dev-libs/libdnet/libdnet-1.16.1.ebuild deleted file mode 100644 index 6321f1a10785..000000000000 --- a/dev-libs/libdnet/libdnet-1.16.1.ebuild +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright 1999-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -PYTHON_COMPAT=( python3_{9..10} ) -DISTUTILS_OPTIONAL=1 -inherit autotools distutils-r1 - -DESCRIPTION="Simplified, portable interface to several low-level networking routines" -HOMEPAGE="https://github.com/ofalk/libdnet" -SRC_URI="https://github.com/ofalk/${PN}/archive/${P}.tar.gz" -S="${WORKDIR}/${PN}-${P}" - -LICENSE="LGPL-2" -SLOT="0" -KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~mips ppc ppc64 ~riscv sparc x86" -IUSE="python test" -RESTRICT="!test? ( test )" - -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" - -DEPEND="dev-libs/libbsd - python? ( ${PYTHON_DEPS} )" -RDEPEND="${DEPEND}" -BDEPEND="python? ( dev-python/cython[${PYTHON_USEDEP}] ) - test? ( dev-libs/check )" - -DOCS=( README.md THANKS ) - -src_prepare() { - default - - sed -i \ - -e 's/libcheck.a/libcheck.so/g' \ - configure.ac || die - sed -i \ - -e 's|-L$libdir ||g' \ - dnet-config.in || die - sed -i \ - -e '/^SUBDIRS/s|python||g' \ - Makefile.am || die - - # Stale e.g. pkg-config macros w/ bashisms - rm aclocal.m4 {config,m4}/libtool.m4 || die - - AT_M4DIR="config" eautoreconf - - if use python; then - cd python || die - distutils-r1_src_prepare - fi -} - -src_configure() { - econf \ - $(use_with python) \ - $(use_enable test check) -} - -src_compile() { - default - if use python; then - cd python || die - distutils-r1_src_compile - fi -} - -src_install() { - default - - if use python; then - cd python || die - unset DOCS - distutils-r1_src_install - fi - - find "${ED}" -name '*.la' -delete || die -} diff --git a/dev-libs/libdnet/libdnet-1.16.2.ebuild b/dev-libs/libdnet/libdnet-1.16.2.ebuild index 7b853da8a2fc..8ed52eca9704 100644 --- a/dev-libs/libdnet/libdnet-1.16.2.ebuild +++ b/dev-libs/libdnet/libdnet-1.16.2.ebuild @@ -1,9 +1,9 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 -PYTHON_COMPAT=( python3_{9..11} ) +PYTHON_COMPAT=( python3_{10..11} ) DISTUTILS_OPTIONAL=1 inherit autotools distutils-r1 @@ -15,16 +15,14 @@ S="${WORKDIR}/${PN}-${P}" LICENSE="LGPL-2" SLOT="0" KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~mips ppc ppc64 ~riscv sparc x86" -IUSE="python test" -RESTRICT="!test? ( test )" +IUSE="python" REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" DEPEND="dev-libs/libbsd python? ( ${PYTHON_DEPS} )" RDEPEND="${DEPEND}" -BDEPEND="python? ( dev-python/cython[${PYTHON_USEDEP}] ) - test? ( dev-libs/check )" +BDEPEND="python? ( dev-python/cython[${PYTHON_USEDEP}] )" DOCS=( README.md THANKS ) @@ -55,7 +53,7 @@ src_prepare() { src_configure() { econf \ $(use_with python) \ - $(use_enable test check) + --without-check } src_compile() { |