commit 1dc3bad35bf784e5c991c8c3ce24a03398287f9a
parent b1777d62add911c3eaa956c2706ce733d6af524d
Author: parazyd <parazyd@dyne.org>
Date: Sun, 20 Nov 2016 14:36:46 +0100
net-libs/libnfnetlink: Add 1.0.1 with musl fix.
Diffstat:
3 files changed, 469 insertions(+), 0 deletions(-)
diff --git a/net-libs/libnfnetlink/Manifest b/net-libs/libnfnetlink/Manifest
@@ -0,0 +1 @@
+DIST libnfnetlink-1.0.1.tar.bz2 320641 SHA256 f270e19de9127642d2a11589ef2ec97ef90a649a74f56cf9a96306b04817b51a SHA512 2ec2cd389c04e21c8a02fb3f6d6f326fc33ca9589577f1739c23d883fe2ee9feaa16e83b6ed09063ad886432e49565dc3256277d035260aca5aab17954b46104 WHIRLPOOL a27bee0e096e695ed4661c50f1ab2fb16e7012f96cc94baae8d5d67224e8b5dcbd869e5001b73fde4c9788f0fd87f85ff6caa3c5b95bae25f3005caed377451c
diff --git a/net-libs/libnfnetlink/files/musl.patch b/net-libs/libnfnetlink/files/musl.patch
@@ -0,0 +1,417 @@
+diff --git a/include/libnfnetlink/libnfnetlink.h b/include/libnfnetlink/libnfnetlink.h
+index 1d8c49d..5f112ad 100644
+--- a/include/libnfnetlink/libnfnetlink.h
++++ b/include/libnfnetlink/libnfnetlink.h
+@@ -55,7 +55,7 @@ struct nfnlhdr {
+ struct nfnl_callback {
+ int (*call)(struct nlmsghdr *nlh, struct nfattr *nfa[], void *data);
+ void *data;
+- u_int16_t attr_count;
++ uint16_t attr_count;
+ };
+
+ struct nfnl_handle;
+@@ -69,7 +69,7 @@ extern struct nfnl_handle *nfnl_open(void);
+ extern int nfnl_close(struct nfnl_handle *);
+
+ extern struct nfnl_subsys_handle *nfnl_subsys_open(struct nfnl_handle *,
+- u_int8_t, u_int8_t,
++ uint8_t, uint8_t,
+ unsigned int);
+ extern void nfnl_subsys_close(struct nfnl_subsys_handle *);
+
+@@ -88,8 +88,8 @@ extern int nfnl_sendiov(const struct nfnl_handle *nfnlh,
+ const struct iovec *iov, unsigned int num,
+ unsigned int flags);
+ extern void nfnl_fill_hdr(struct nfnl_subsys_handle *, struct nlmsghdr *,
+- unsigned int, u_int8_t, u_int16_t, u_int16_t,
+- u_int16_t);
++ unsigned int, uint8_t, uint16_t, uint16_t,
++ uint16_t);
+ extern __attribute__((deprecated)) int
+ nfnl_talk(struct nfnl_handle *, struct nlmsghdr *, pid_t,
+ unsigned, struct nlmsghdr *,
+@@ -103,8 +103,8 @@ nfnl_listen(struct nfnl_handle *,
+ /* receiving */
+ extern ssize_t nfnl_recv(const struct nfnl_handle *h, unsigned char *buf, size_t len);
+ extern int nfnl_callback_register(struct nfnl_subsys_handle *,
+- u_int8_t type, struct nfnl_callback *cb);
+-extern int nfnl_callback_unregister(struct nfnl_subsys_handle *, u_int8_t type);
++ uint8_t type, struct nfnl_callback *cb);
++extern int nfnl_callback_unregister(struct nfnl_subsys_handle *, uint8_t type);
+ extern int nfnl_handle_packet(struct nfnl_handle *, char *buf, int len);
+
+ /* parsing */
+@@ -180,12 +180,12 @@ extern int nfnl_query(struct nfnl_handle *h, struct nlmsghdr *nlh);
+
+ /* nfnl attribute handling functions */
+ extern int nfnl_addattr_l(struct nlmsghdr *, int, int, const void *, int);
+-extern int nfnl_addattr8(struct nlmsghdr *, int, int, u_int8_t);
+-extern int nfnl_addattr16(struct nlmsghdr *, int, int, u_int16_t);
+-extern int nfnl_addattr32(struct nlmsghdr *, int, int, u_int32_t);
++extern int nfnl_addattr8(struct nlmsghdr *, int, int, uint8_t);
++extern int nfnl_addattr16(struct nlmsghdr *, int, int, uint16_t);
++extern int nfnl_addattr32(struct nlmsghdr *, int, int, uint32_t);
+ extern int nfnl_nfa_addattr_l(struct nfattr *, int, int, const void *, int);
+-extern int nfnl_nfa_addattr16(struct nfattr *, int, int, u_int16_t);
+-extern int nfnl_nfa_addattr32(struct nfattr *, int, int, u_int32_t);
++extern int nfnl_nfa_addattr16(struct nfattr *, int, int, uint16_t);
++extern int nfnl_nfa_addattr32(struct nfattr *, int, int, uint32_t);
+ extern int nfnl_parse_attr(struct nfattr **, int, struct nfattr *, int);
+ #define nfnl_parse_nested(tb, max, nfa) \
+ nfnl_parse_attr((tb), (max), NFA_DATA((nfa)), NFA_PAYLOAD((nfa)))
+@@ -197,7 +197,7 @@ extern int nfnl_parse_attr(struct nfattr **, int, struct nfattr *, int);
+ ({ (tail)->nfa_len = (void *) NLMSG_TAIL(nlh) - (void *) tail; })
+
+ extern void nfnl_build_nfa_iovec(struct iovec *iov, struct nfattr *nfa,
+- u_int16_t type, u_int32_t len,
++ uint16_t type, uint32_t len,
+ unsigned char *val);
+ extern unsigned int nfnl_rcvbufsiz(const struct nfnl_handle *h,
+ unsigned int size);
+diff --git a/include/libnfnetlink/linux_nfnetlink.h b/include/libnfnetlink/linux_nfnetlink.h
+index 76a8550..4315d15 100644
+--- a/include/libnfnetlink/linux_nfnetlink.h
++++ b/include/libnfnetlink/linux_nfnetlink.h
+@@ -25,9 +25,9 @@ enum nfnetlink_groups {
+ /* General form of address family dependent message.
+ */
+ struct nfgenmsg {
+- u_int8_t nfgen_family; /* AF_xxx */
+- u_int8_t version; /* nfnetlink version */
+- u_int16_t res_id; /* resource id */
++ uint8_t nfgen_family; /* AF_xxx */
++ uint8_t version; /* nfnetlink version */
++ uint16_t res_id; /* resource id */
+ };
+
+ #define NFNETLINK_V0 0
+@@ -59,7 +59,7 @@ struct nfnl_callback
+ int (*call)(struct sock *nl, struct sk_buff *skb,
+ struct nlmsghdr *nlh, struct nlattr *cda[]);
+ const struct nla_policy *policy; /* netlink attribute policy */
+- const u_int16_t attr_count; /* number of nlattr's */
++ const uint16_t attr_count; /* number of nlattr's */
+ };
+
+ struct nfnetlink_subsystem
+@@ -76,7 +76,7 @@ extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
+ extern int nfnetlink_has_listeners(unsigned int group);
+ extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group,
+ int echo);
+-extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags);
++extern int nfnetlink_unicast(struct sk_buff *skb, uint32_t pid, int flags);
+
+ #define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
+ MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
+diff --git a/include/libnfnetlink/linux_nfnetlink_compat.h b/include/libnfnetlink/linux_nfnetlink_compat.h
+index e145176..1a337d8 100644
+--- a/include/libnfnetlink/linux_nfnetlink_compat.h
++++ b/include/libnfnetlink/linux_nfnetlink_compat.h
+@@ -20,8 +20,8 @@
+
+ struct nfattr
+ {
+- u_int16_t nfa_len;
+- u_int16_t nfa_type; /* we use 15 bits for the type, and the highest
++ uint16_t nfa_len;
++ uint16_t nfa_type; /* we use 15 bits for the type, and the highest
+ * bit to indicate whether the payload is nested */
+ };
+
+diff --git a/src/iftable.c b/src/iftable.c
+index 0325335..fa5d501 100644
+--- a/src/iftable.c
++++ b/src/iftable.c
+@@ -27,10 +27,10 @@
+ struct ifindex_node {
+ struct list_head head;
+
+- u_int32_t index;
+- u_int32_t type;
+- u_int32_t alen;
+- u_int32_t flags;
++ uint32_t index;
++ uint32_t type;
++ uint32_t alen;
++ uint32_t flags;
+ char addr[8];
+ char name[16];
+ };
+diff --git a/src/iftable.h b/src/iftable.h
+index 8df7f24..655df6b 100644
+--- a/src/iftable.h
++++ b/src/iftable.h
+@@ -1,8 +1,8 @@
+ #ifndef _IFTABLE_H
+ #define _IFTABLE_H
+
+-int iftable_delete(u_int32_t dst, u_int32_t mask, u_int32_t gw, u_int32_t oif);
+-int iftable_insert(u_int32_t dst, u_int32_t mask, u_int32_t gw, u_int32_t oif);
++int iftable_delete(uint32_t dst, uint32_t mask, uint32_t gw, uint32_t oif);
++int iftable_insert(uint32_t dst, uint32_t mask, uint32_t gw, uint32_t oif);
+
+ int iftable_init(void);
+ void iftable_fini(void);
+diff --git a/src/libnfnetlink.c b/src/libnfnetlink.c
+index 4b2bcd0..dcf380d 100644
+--- a/src/libnfnetlink.c
++++ b/src/libnfnetlink.c
+@@ -72,9 +72,9 @@
+
+ struct nfnl_subsys_handle {
+ struct nfnl_handle *nfnlh;
+- u_int32_t subscriptions;
+- u_int8_t subsys_id;
+- u_int8_t cb_count;
++ uint32_t subscriptions;
++ uint8_t subsys_id;
++ uint8_t cb_count;
+ struct nfnl_callback *cb; /* array of callbacks */
+ };
+
+@@ -86,11 +86,11 @@ struct nfnl_handle {
+ int fd;
+ struct sockaddr_nl local;
+ struct sockaddr_nl peer;
+- u_int32_t subscriptions;
+- u_int32_t seq;
+- u_int32_t dump;
+- u_int32_t rcv_buffer_size; /* for nfnl_catch */
+- u_int32_t flags;
++ uint32_t subscriptions;
++ uint32_t seq;
++ uint32_t dump;
++ uint32_t rcv_buffer_size; /* for nfnl_catch */
++ uint32_t flags;
+ struct nlmsghdr *last_nlhdr;
+ struct nfnl_subsys_handle subsys[NFNL_MAX_SUBSYS+1];
+ };
+@@ -145,7 +145,7 @@ unsigned int nfnl_portid(const struct nfnl_handle *h)
+ static int recalc_rebind_subscriptions(struct nfnl_handle *nfnlh)
+ {
+ int i, err;
+- u_int32_t new_subscriptions = nfnlh->subscriptions;
++ uint32_t new_subscriptions = nfnlh->subscriptions;
+
+ for (i = 0; i < NFNL_MAX_SUBSYS; i++)
+ new_subscriptions |= nfnlh->subsys[i].subscriptions;
+@@ -273,8 +273,8 @@ void nfnl_set_rcv_buffer_size(struct nfnl_handle *h, unsigned int size)
+ * a valid address that points to a nfnl_subsys_handle structure is returned.
+ */
+ struct nfnl_subsys_handle *
+-nfnl_subsys_open(struct nfnl_handle *nfnlh, u_int8_t subsys_id,
+- u_int8_t cb_count, u_int32_t subscriptions)
++nfnl_subsys_open(struct nfnl_handle *nfnlh, uint8_t subsys_id,
++ uint8_t cb_count, uint32_t subscriptions)
+ {
+ struct nfnl_subsys_handle *ssh;
+
+@@ -435,10 +435,10 @@ int nfnl_sendiov(const struct nfnl_handle *nfnlh, const struct iovec *iov,
+ */
+ void nfnl_fill_hdr(struct nfnl_subsys_handle *ssh,
+ struct nlmsghdr *nlh, unsigned int len,
+- u_int8_t family,
+- u_int16_t res_id,
+- u_int16_t msg_type,
+- u_int16_t msg_flags)
++ uint8_t family,
++ uint16_t res_id,
++ uint16_t msg_type,
++ uint16_t msg_flags)
+ {
+ assert(ssh);
+ assert(nlh);
+@@ -848,14 +848,14 @@ int nfnl_nfa_addattr_l(struct nfattr *nfa, int maxlen, int type,
+ }
+
+ /**
+- * nfnl_addattr8 - Add u_int8_t attribute to nlmsghdr
++ * nfnl_addattr8 - Add uint8_t attribute to nlmsghdr
+ *
+ * @n: netlink message header to which attribute is to be added
+ * @maxlen: maximum length of netlink message header
+ * @type: type of new attribute
+ * @data: content of new attribute
+ */
+-int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, u_int8_t data)
++int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, uint8_t data)
+ {
+ assert(n);
+ assert(maxlen > 0);
+@@ -865,7 +865,7 @@ int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, u_int8_t data)
+ }
+
+ /**
+- * nfnl_nfa_addattr16 - Add u_int16_t attribute to struct nfattr
++ * nfnl_nfa_addattr16 - Add uint16_t attribute to struct nfattr
+ *
+ * @nfa: struct nfattr
+ * @maxlen: maximal length of nfattr buffer
+@@ -874,7 +874,7 @@ int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, u_int8_t data)
+ *
+ */
+ int nfnl_nfa_addattr16(struct nfattr *nfa, int maxlen, int type,
+- u_int16_t data)
++ uint16_t data)
+ {
+ assert(nfa);
+ assert(maxlen > 0);
+@@ -884,7 +884,7 @@ int nfnl_nfa_addattr16(struct nfattr *nfa, int maxlen, int type,
+ }
+
+ /**
+- * nfnl_addattr16 - Add u_int16_t attribute to nlmsghdr
++ * nfnl_addattr16 - Add uint16_t attribute to nlmsghdr
+ *
+ * @n: netlink message header to which attribute is to be added
+ * @maxlen: maximum length of netlink message header
+@@ -893,7 +893,7 @@ int nfnl_nfa_addattr16(struct nfattr *nfa, int maxlen, int type,
+ *
+ */
+ int nfnl_addattr16(struct nlmsghdr *n, int maxlen, int type,
+- u_int16_t data)
++ uint16_t data)
+ {
+ assert(n);
+ assert(maxlen > 0);
+@@ -903,7 +903,7 @@ int nfnl_addattr16(struct nlmsghdr *n, int maxlen, int type,
+ }
+
+ /**
+- * nfnl_nfa_addattr32 - Add u_int32_t attribute to struct nfattr
++ * nfnl_nfa_addattr32 - Add uint32_t attribute to struct nfattr
+ *
+ * @nfa: struct nfattr
+ * @maxlen: maximal length of nfattr buffer
+@@ -912,7 +912,7 @@ int nfnl_addattr16(struct nlmsghdr *n, int maxlen, int type,
+ *
+ */
+ int nfnl_nfa_addattr32(struct nfattr *nfa, int maxlen, int type,
+- u_int32_t data)
++ uint32_t data)
+ {
+ assert(nfa);
+ assert(maxlen > 0);
+@@ -922,7 +922,7 @@ int nfnl_nfa_addattr32(struct nfattr *nfa, int maxlen, int type,
+ }
+
+ /**
+- * nfnl_addattr32 - Add u_int32_t attribute to nlmsghdr
++ * nfnl_addattr32 - Add uint32_t attribute to nlmsghdr
+ *
+ * @n: netlink message header to which attribute is to be added
+ * @maxlen: maximum length of netlink message header
+@@ -931,7 +931,7 @@ int nfnl_nfa_addattr32(struct nfattr *nfa, int maxlen, int type,
+ *
+ */
+ int nfnl_addattr32(struct nlmsghdr *n, int maxlen, int type,
+- u_int32_t data)
++ uint32_t data)
+ {
+ assert(n);
+ assert(maxlen > 0);
+@@ -979,7 +979,7 @@ int nfnl_parse_attr(struct nfattr *tb[], int max, struct nfattr *nfa, int len)
+ *
+ */
+ void nfnl_build_nfa_iovec(struct iovec *iov, struct nfattr *nfa,
+- u_int16_t type, u_int32_t len, unsigned char *val)
++ uint16_t type, uint32_t len, unsigned char *val)
+ {
+ assert(iov);
+ assert(nfa);
+@@ -1114,7 +1114,7 @@ struct nlmsghdr *nfnl_get_msg_next(struct nfnl_handle *h,
+ * appropiately.
+ */
+ int nfnl_callback_register(struct nfnl_subsys_handle *ssh,
+- u_int8_t type, struct nfnl_callback *cb)
++ uint8_t type, struct nfnl_callback *cb)
+ {
+ assert(ssh);
+ assert(cb);
+@@ -1137,7 +1137,7 @@ int nfnl_callback_register(struct nfnl_subsys_handle *ssh,
+ * On sucess, 0 is returned. On error, -1 is returned and errno is
+ * set appropiately.
+ */
+-int nfnl_callback_unregister(struct nfnl_subsys_handle *ssh, u_int8_t type)
++int nfnl_callback_unregister(struct nfnl_subsys_handle *ssh, uint8_t type)
+ {
+ assert(ssh);
+
+@@ -1160,8 +1160,8 @@ int nfnl_check_attributes(const struct nfnl_handle *h,
+ assert(nfa);
+
+ int min_len;
+- u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
+- u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
++ uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
++ uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
+ const struct nfnl_subsys_handle *ssh;
+ struct nfnl_callback *cb;
+
+@@ -1211,8 +1211,8 @@ static int __nfnl_handle_msg(struct nfnl_handle *h, struct nlmsghdr *nlh,
+ int len)
+ {
+ struct nfnl_subsys_handle *ssh;
+- u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
+- u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
++ uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
++ uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
+ int err = 0;
+
+ if (subsys_id > NFNL_MAX_SUBSYS)
+@@ -1242,7 +1242,7 @@ int nfnl_handle_packet(struct nfnl_handle *h, char *buf, int len)
+ {
+
+ while (len >= NLMSG_SPACE(0)) {
+- u_int32_t rlen;
++ uint32_t rlen;
+ struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
+
+ if (nlh->nlmsg_len < sizeof(struct nlmsghdr)
+@@ -1284,8 +1284,8 @@ static int nfnl_is_error(struct nfnl_handle *h, struct nlmsghdr *nlh)
+ static int nfnl_step(struct nfnl_handle *h, struct nlmsghdr *nlh)
+ {
+ struct nfnl_subsys_handle *ssh;
+- u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
+- u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
++ uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
++ uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
+
+ /* Is this an error message? */
+ if (nfnl_is_error(h, nlh)) {
+diff --git a/src/rtnl.c b/src/rtnl.c
+index 5ccb272..48a60f8 100644
+--- a/src/rtnl.c
++++ b/src/rtnl.c
+@@ -30,7 +30,7 @@
+ #define rtnl_log(x, ...)
+
+ static inline struct rtnl_handler *
+-find_handler(struct rtnl_handle *rtnl_handle, u_int16_t type)
++find_handler(struct rtnl_handle *rtnl_handle, uint16_t type)
+ {
+ struct rtnl_handler *h;
+ for (h = rtnl_handle->handlers; h; h = h->next) {
+@@ -41,7 +41,7 @@ find_handler(struct rtnl_handle *rtnl_handle, u_int16_t type)
+ }
+
+ static int call_handler(struct rtnl_handle *rtnl_handle,
+- u_int16_t type,
++ uint16_t type,
+ struct nlmsghdr *hdr)
+ {
+ struct rtnl_handler *h = find_handler(rtnl_handle, type);
+diff --git a/src/rtnl.h b/src/rtnl.h
+index 0c403dc..2cb22a8 100644
+--- a/src/rtnl.h
++++ b/src/rtnl.h
+@@ -7,7 +7,7 @@
+ struct rtnl_handler {
+ struct rtnl_handler *next;
+
+- u_int16_t nlmsg_type;
++ uint16_t nlmsg_type;
+ int (*handlefn)(struct nlmsghdr *h, void *arg);
+ void *arg;
+ };
diff --git a/net-libs/libnfnetlink/libnfnetlink-1.0.1-r99.ebuild b/net-libs/libnfnetlink/libnfnetlink-1.0.1-r99.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+inherit linux-info eutils
+
+DESCRIPTION="the low-level library for netfilter related kernel/userspace communication"
+HOMEPAGE="http://www.netfilter.org/projects/libnfnetlink/"
+SRC_URI="http://www.netfilter.org/projects/${PN}/files/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+IUSE="static-libs"
+
+DOCS=( README )
+
+pkg_setup() {
+ linux-info_pkg_setup
+
+ if kernel_is lt 2 6 18 ; then
+ ewarn "${PN} requires at least 2.6.18 kernel version"
+ fi
+
+ #netfilter core team has changed some option names with kernel 2.6.20
+ error_common=' is not set when it should be. You can activate it in the Core Netfilter Configuration'
+ if kernel_is lt 2 6 20 ; then
+ CONFIG_CHECK="~IP_NF_CONNTRACK_NETLINK"
+ ERROR_IP_NF_CONNTRACK_NETLINK="CONFIG_IP_NF_CONNTRACK_NETLINK:\t${error_common}"
+ else
+ CONFIG_CHECK="~NF_CT_NETLINK"
+ ERROR_NF_CT_NETLINK="CONFIG_NF_CT_NETLINK:\t${error_common}"
+ fi
+
+ check_extra_config
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/musl.patch
+ default
+}
+
+src_configure() {
+ econf $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+ prune_libtool_files
+}