Skip to contentSkip to conversation

Convert libnetfilter_queue to not need libnfnetlink

PATCH New Duncan Roe 1 participant 16 messages Oct 12, 2024 netfilter

lore
Share & tools
lore

Duncan Roe

author
#0 lore raw

v3 cover Convert libnetfilter_queue to not need libnfnetlink

The general method is to make the opaque struct nfq_handle contain fully populated libnfnetlink-style and libmnl-style handles.
Patch 1 (nfq_open()) and patch 2 (nfq_open_nfnl()) sets this up. Patch 3 (nfq_close()) cleans it away.
Patches 3-10 convert the other nfq_* functions that used to use
libnfnetlink, except for the nfq_get_*_name functions that need nlif.
Patches 11-13 provide all the nlif_* functions that libnfnetlink used to
offer, converted to use libmnl.
Patch 14 removes all use of and reference to header files provided by
libnfnetlink. It provides prototypes as required.
Patch 15 removes libnfnetlink as a private library.

There is a tester for this patchset at
https://github.com/duncan-roe/nfqnltester
Some of the tests require checking out different branches, e.g. for testing the effect of loading libraries in a diffrernt order. There is more info in the README. In particular I checked that nlif still works with -lnfnetlink coming first
(app will use libnfnetlink's functions).

The nlif functions sit a little uneasily in libnetfilter_queue. ulogd2 and conntrack-tools both use them so perhaps they would be better placed in libmnl.
---
Changes in v3:
- Remove new kernel header includes as promised in
https://www.spinics.net/lists/netfilter-devel/msg87916.html
(The status of the v2 series changed to "Changes Requested":
I'm guessing that was because of that promise).
- Remove more libnfnetlink references
- Rebase on master commit f05b188

Changes in v2:
- 11/32 (Fix checkpatch whitespace and block comment warnings) is subsumed into previous patches
- 22/32 becomes 14
- 21/32 becomes 15
- 12/32 & 17/32 become 11, but rtnl.c is not copied
- 14/32 & 16/32 become 12
- 19/32 & (some of) 32/32 become 13
- The only changes to linux_list.h are to fix or suppress checkpatch errors. There is no attempt to document the circular linked list functions and macros, so no changes to build_man.sh. That is how the rest of the patches disappear.
- Other changes are documented in the individual patches

Duncan Roe (15):
src: Convert nfq_open() to use libmnl
src: Convert nfq_open_nfnl() to use libmnl
src: Convert nfq_close() to use libmnl
src: Convert nfq_create_queue(), nfq_bind_pf() & nfq_unbind_pf() to
use libmnl
src: Convert nfq_set_queue_flags(), nfq_set_queue_maxlen() &
nfq_set_mode() to use libmnl
src: Convert nfq_handle_packet(), nfq_get_secctx(), nfq_get_payload()
and all the nfq_get_ functions to use libmnl
src: Convert nfq_set_verdict() and nfq_set_verdict2() to use libmnl if
there is no data
src: Incorporate nfnl_rcvbufsiz() in libnetfilter_queue
src: Convert nfq_fd() to use libmnl
src: Convert remaining nfq_* functions to use libmnl
src: Copy nlif-related files from libnfnetlink
doc: Add iftable.c to the doxygen system
src: Convert all nlif_* functions to use libmnl
include: Use libmnl.h instead of libnfnetlink.h
build: Remove libnfnetlink from the build

 Make_global.am                                |   2 +-
 configure.ac                                  |   1 -
 doxygen/Makefile.am                           |   1 +
 doxygen/doxygen.cfg.in                        |   6 +
 .../libnetfilter_queue/libnetfilter_queue.h   |  38 +-
 include/libnetfilter_queue/linux_list.h       | 730 ++++++++++++++++++
 .../linux_nfnetlink_queue.h                   |   3 +-
 libnetfilter_queue.pc.in                      |   2 -
 src/Makefile.am                               |   3 +-
 src/iftable.c                                 | 373 +++++++++
 src/libnetfilter_queue.c                      | 543 ++++++++-----
 11 files changed, 1512 insertions(+), 190 deletions(-)
 create mode 100644 include/libnetfilter_queue/linux_list.h
 create mode 100644 src/iftable.c
Signature · 1 line
2.35.8
author
#1 lore raw

PATCH v3 1/15 src: Convert nfq_open() to use libmnl

Add copies of nfnl_handle, nfnl_subsys_handle & mnl_socket to libnetfilter_queue.c. After calling mnl_socket_open() & mnl_socket_bind(), fill in the libnfnetlink structs as if nfnl_open() had been called. Call a static extended version of nfq_open_nfnl(), __nfq_open_nfnl() which can tell how it was called via an extra argument: struct nfq_handle *qh. nfq_open() passes the qh returned by mnl_open(). nfq_open_nfnl() passes NULL.
__nfq_open_nfnl() creates and returns a qh if it wasn't given one. Otherwise it returns the qh it was given or NULL on error (but the passed-in qh is not freed).

---
Changes in v3: (none)

Changes in v2:
- Rather than inline nfnl subsys code, minimally modify nfq_open_nfnl() as per updated commit message
- Replace NFNL_BUFFSIZE with MNL_SOCKET_BUFFER_SIZE
- Use calloc instead of malloc + memset in new code
- Don't rename struct nfq_handle *qh to *h
- Fix checkpatch space before tab warnings in lines 143,147,159,165
- Keep nfq_errno

 doxygen/doxygen.cfg.in   |  3 ++
 src/libnetfilter_queue.c | 86 ++++++++++++++++++++++++++++++++++------
 2 files changed, 77 insertions(+), 12 deletions(-)
doxygen/doxygen.cfg.in +3 -0
index 97174ff..6dd7017 100644
@@ -13,6 +13,9 @@ EXCLUDE_SYMBOLS        = EXPORT_SYMBOL \
                          nfq_handle \
                          nfq_data \
                          nfq_q_handle \
+                         nfnl_handle \
+                         nfnl_subsys_handle \
+                         mnl_socket \
                          tcp_flag_word
 EXAMPLE_PATTERNS       =
 INPUT_FILTER           = "sed 's/EXPORT_SYMBOL//g'"
src/libnetfilter_queue.c +74 -12

141 lines not on this page · raw message

Signature · 1 line
2.35.8
author
#2 lore raw

PATCH v3 2/15 src: Convert nfq_open_nfnl() to use libmnl

In reply to Duncan Roe

__nfq_open_nfnl() manufactures a libmnl handle if called by nfq_open_nfnl().
Replace calls to nfnl_subsys_open() and nfnl_callback_register() with inline code.

---
Changes in v3: (none)

Changes in v2:
- Pretty much re-written as per updated commit message. In particular:
- Don't clear message sequencing - original didn't do that.
- Don't close the socket in any error path since it was open on entry.

 src/libnetfilter_queue.c | 56 ++++++++++++++++++++++++++++++++--------
 1 file changed, 45 insertions(+), 11 deletions(-)
src/libnetfilter_queue.c +45 -11
index f366198..bfb6482 100644
@@ -484,33 +484,67 @@ static struct nfq_handle *__nfq_open_nfnl(struct nfnl_handle *nfnlh,
 	};
 	struct nfq_handle *h;
 	int err;
+	int i;
+	uint32_t new_subscriptions;
 
 	h = qh ? qh : calloc(1, sizeof(*h));
 	if (!h)
 		return NULL;
 
+	if (!qh) {
+		/* Manufacture the libmnl handle */
+		h->nl = calloc(1, sizeof(*h->nl));
+		if (!h->nl)
+			goto out_free;
+		h->nl->fd = nfnlh->fd;
+		h->nl->addr = nfnlh->local;
+	}
 	h->nfnlh = nfnlh;
 
-	h->nfnlssh = nfnl_subsys_open(h->nfnlh, NFNL_SUBSYS_QUEUE,
-				      NFQNL_MSG_MAX, 0);
-	if (!h->nfnlssh) {
+	/* Replace nfnl_subsys_open() with code adapted from libnfnetlink */
+	h->nfnlssh = &h->nfnlh->subsys[NFNL_SUBSYS_QUEUE];
+	if (h->nfnlssh->cb) {
+		errno = EBUSY;
+		goto out_free;
+	}
+	h->nfnlssh->cb = calloc(NFQNL_MSG_MAX, sizeof(*(h->nfnlssh->cb)));
+	if (!h->nfnlssh->cb) {
 		/* FIXME: nfq_errno */
 		goto out_free;
 	}
+	h->nfnlssh->nfnlh = h->nfnlh;
+	h->nfnlssh->cb_count = NFQNL_MSG_MAX;
+	h->nfnlssh->subsys_id = NFNL_SUBSYS_QUEUE;
+
+	/* Replacement code for recalc_rebind_subscriptions() */
+	new_subscriptions = nfnlh->subscriptions;
+	for (i = 0; i < NFNL_MAX_SUBSYS; i++)
+		new_subscriptions |= nfnlh->subsys[i].subscriptions;
+	nfnlh->local.nl_groups = new_subscriptions;
+	err = bind(nfnlh->fd, (struct sockaddr *)&nfnlh->local,
+		   sizeof(nfnlh->local));
+	if (err == -1) {
+		free(h->nfnlssh->cb);
+		h->nfnlssh->cb = NULL;
+		goto out_free;
+	}
+	h->nfnlssh->subscriptions = new_subscriptions;
 
 	pkt_cb.data = h;
-	err = nfnl_callback_register(h->nfnlssh, NFQNL_MSG_PACKET, &pkt_cb);
-	if (err < 0) {
-		nfq_errno = err;
-		goto out_close;
-	}
+	/* Replacement code for nfnl_callback_register()
+	 * The only error return from nfnl_callback_register() is not possible
+	 * here: NFQNL_MSG_PACKET (= 0) will be less than h->nfnlssh->cb_count
+	 * (set to NFQNL_MSG_MAX (= 4) a few lines back).
+	 */
+	memcpy(&h->nfnlssh->cb[NFQNL_MSG_PACKET], &pkt_cb, sizeof(pkt_cb));
 
 	return h;
-out_close:
-	nfnl_subsys_close(h->nfnlssh);
 out_free:
-	if (!qh)
+	if (!qh) {
+		if (h->nl)
+			free(h->nl);
 		free(h);
+	}
 	return NULL;
 }
 
Signature · 1 line
2.35.8
author
#3 lore raw

PATCH v3 3/15 src: Convert nfq_close() to use libmnl

In reply to Duncan Roe

Use mnl_close() and clean up the NFNL_SUBSYS_QUEUE subsystem as nfnl_close() would have done

---
Changes in v3: manually merge f05b188f8b4c patch

Changes in v2:
- Propogate return from mnl_socket_close()
- Don't free callbacks in the qh_list since nfq_close() didn't (reported as a bug)
- Do a complete emulation of nfnl_close()
- Add explanatory comments

 src/libnetfilter_queue.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
src/libnetfilter_queue.c +24 -1
index b3d1835..8698431 100644
@@ -577,6 +577,7 @@ EXPORT_SYMBOL
 int nfq_close(struct nfq_handle *h)
 {
 	int ret;
+	int i;
 	struct nfq_q_handle *qh;
 
 	while (h->qh_list) {
@@ -584,7 +585,29 @@ int nfq_close(struct nfq_handle *h)
 		h->qh_list = qh->next;
 		free(qh);
 	}
-	ret = nfnl_close(h->nfnlh);
+
+	ret = mnl_socket_close(h->nl);
+	h->nl = NULL;              /* mnl_socket_close() always frees it */
+
+	/* Replacement code for nfnl_close().
+	 * It seems unlikely that we need to go through all 16 subsystems
+	 * instead of only subsys[NFNL_SUBSYS_QUEUE] which h->nfnlssh
+	 * conveniently points to, but better safe than sorry.
+	 */
+	for (i = 0; i < NFNL_MAX_SUBSYS; i++) {
+		h->nfnlh->subsys[i].subscriptions = 0;
+		h->nfnlh->subsys[i].cb_count = 0;
+		if (h->nfnlh->subsys[i].cb) {
+			free(h->nfnlh->subsys[i].cb);
+			h->nfnlh->subsys[i].cb = NULL;
+		}
+	}
+	if (ret == 0)
+		free(h->nfnlh);
+
+	/* nfnl_close() didn't free nfnlh if close() returned an error.
+	 * Presumably that's why nfq_close() doesn't free h in that case.
+	 */
 	if (ret == 0)
 		free(h);
 	return ret;
Signature · 1 line
2.39.4
author
#4 lore raw

PATCH v3 4/15 src: Convert nfq_create_queue(), nfq_bind_pf() & nfq_unbind_pf() to use libmnl

In reply to Duncan Roe

Convert static function __build_send_cfg_msg() to use libmnl. This by itself converts the 3 public functions.

---
Changes in v3: (none)

Changes in v2:
- Rename nfq_query to __nfq_query so as not to pollute Posix namespace
- rebase to account for updated patches 1 - 3

 src/libnetfilter_queue.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)
src/libnetfilter_queue.c +19 -13
index 0483780..b64f14a 100644
@@ -230,27 +230,33 @@ static struct nfq_q_handle *find_qh(struct nfq_handle *h, uint16_t id)
 	return NULL;
 }
 
+static int __nfq_query(struct nfq_handle *h, struct nlmsghdr *nlh, char *buf,
+		      size_t bufsiz)
+{
+	int ret;
+
+	ret = mnl_socket_sendto(h->nl, nlh, nlh->nlmsg_len);
+	if (ret != -1)
+		ret = mnl_socket_recvfrom(h->nl, buf, bufsiz);
+	if (ret != -1)
+		ret = mnl_cb_run(buf, ret, 0, mnl_socket_get_portid(h->nl),
+				 NULL, NULL);
+	return ret;
+}
+
 /* build a NFQNL_MSG_CONFIG message */
 	static int
 __build_send_cfg_msg(struct nfq_handle *h, uint8_t command,
 		uint16_t queuenum, uint16_t pf)
 {
-	union {
-		char buf[NFNL_HEADER_LEN
-			+NFA_LENGTH(sizeof(struct nfqnl_msg_config_cmd))];
-		struct nlmsghdr nmh;
-	} u;
-	struct nfqnl_msg_config_cmd cmd;
+	char buf[MNL_SOCKET_BUFFER_SIZE];
+	struct nlmsghdr *nlh;
 
-	nfnl_fill_hdr(h->nfnlssh, &u.nmh, 0, AF_UNSPEC, queuenum,
-			NFQNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
+	nlh = nfq_nlmsg_put2(buf, NFQNL_MSG_CONFIG, queuenum, NLM_F_ACK);
 
-	cmd._pad = 0;
-	cmd.command = command;
-	cmd.pf = htons(pf);
-	nfnl_addattr_l(&u.nmh, sizeof(u), NFQA_CFG_CMD, &cmd, sizeof(cmd));
+	nfq_nlmsg_cfg_put_cmd(nlh, AF_UNSPEC, command);
 
-	return nfnl_query(h->nfnlh, &u.nmh);
+	return __nfq_query(h, nlh, buf, sizeof(buf));
 }
 
 static int __nfq_rcv_pkt(struct nlmsghdr *nlh, struct nfattr *nfa[],
Signature · 1 line
2.35.8
author
#5 lore raw

PATCH v3 5/15 src: Convert nfq_set_queue_flags(), nfq_set_queue_maxlen() & nfq_set_mode() to use libmnl

In reply to Duncan Roe

Use a buffer of MNL_SOCKET_BUFFER_SIZE; no union required.

---
Changes in v3: rebased

Changes in v2:
- Rename nfq_query to __nfq_query so as not to pollute Posix namespace
- Also convert nfq_set_mode() here because of using the same strategy
- rebase to account for updated patches 1 - 3

 src/libnetfilter_queue.c | 58 ++++++++++++++++------------------------
 1 file changed, 23 insertions(+), 35 deletions(-)
src/libnetfilter_queue.c +23 -35
index b64f14a..0ef3bd3 100644
@@ -789,22 +789,21 @@ int nfq_handle_packet(struct nfq_handle *h, char *buf, int len)
 EXPORT_SYMBOL
 int nfq_set_mode(struct nfq_q_handle *qh, uint8_t mode, uint32_t range)
 {
-	union {
-		char buf[NFNL_HEADER_LEN
-			+NFA_LENGTH(sizeof(struct nfqnl_msg_config_params))];
-		struct nlmsghdr nmh;
-	} u;
-	struct nfqnl_msg_config_params params;
+	char buf[MNL_SOCKET_BUFFER_SIZE];
+	struct nlmsghdr *nlh;
+	int ret;
 
-	nfnl_fill_hdr(qh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, qh->id,
-			NFQNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
+	nlh = nfq_nlmsg_put2(buf, NFQNL_MSG_CONFIG, qh->id, NLM_F_ACK);
 
-	params.copy_range = htonl(range);
-	params.copy_mode = mode;
-	nfnl_addattr_l(&u.nmh, sizeof(u), NFQA_CFG_PARAMS, &params,
-			sizeof(params));
+	nfq_nlmsg_cfg_put_params(nlh, mode, range);
 
-	return nfnl_query(qh->h->nfnlh, &u.nmh);
+	ret = mnl_socket_sendto(qh->h->nl, nlh, nlh->nlmsg_len);
+	if (ret != -1)
+		ret = mnl_socket_recvfrom(qh->h->nl, buf, sizeof(buf));
+	if (ret != -1)
+		ret = mnl_cb_run(buf, ret, 0, mnl_socket_get_portid(qh->h->nl),
+		    NULL, NULL);
+	return ret;
 }
 
 /**
@@ -878,23 +877,18 @@ int nfq_set_mode(struct nfq_q_handle *qh, uint8_t mode, uint32_t range)
 EXPORT_SYMBOL
 int nfq_set_queue_flags(struct nfq_q_handle *qh, uint32_t mask, uint32_t flags)
 {
-	union {
-		char buf[NFNL_HEADER_LEN
-			+NFA_LENGTH(sizeof(mask)
-			+NFA_LENGTH(sizeof(flags)))];
-		struct nlmsghdr nmh;
-	} u;
+	char buf[MNL_SOCKET_BUFFER_SIZE];
+	struct nlmsghdr *nlh;
 
 	mask = htonl(mask);
 	flags = htonl(flags);
 
-	nfnl_fill_hdr(qh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, qh->id,
-		      NFQNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
+	nlh = nfq_nlmsg_put2(buf, NFQNL_MSG_CONFIG, qh->id, NLM_F_ACK);
 
-	nfnl_addattr32(&u.nmh, sizeof(u), NFQA_CFG_FLAGS, flags);
-	nfnl_addattr32(&u.nmh, sizeof(u), NFQA_CFG_MASK, mask);
+	mnl_attr_put_u32(nlh, NFQA_CFG_FLAGS, flags);
+	mnl_attr_put_u32(nlh, NFQA_CFG_MASK, mask);
 
-	return nfnl_query(qh->h->nfnlh, &u.nmh);
+	return __nfq_query(qh->h, nlh, buf, sizeof(buf));
 }
 
 /**
@@ -911,20 +905,14 @@ int nfq_set_queue_flags(struct nfq_q_handle *qh, uint32_t mask, uint32_t flags)
 EXPORT_SYMBOL
 int nfq_set_queue_maxlen(struct nfq_q_handle *qh, uint32_t queuelen)
 {
-	union {
-		char buf[NFNL_HEADER_LEN
-			+NFA_LENGTH(sizeof(struct nfqnl_msg_config_params))];
-		struct nlmsghdr nmh;
-	} u;
-	uint32_t queue_maxlen = htonl(queuelen);
+	char buf[MNL_SOCKET_BUFFER_SIZE];
+	struct nlmsghdr *nlh;
 
-	nfnl_fill_hdr(qh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, qh->id,
-			NFQNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
+	nlh = nfq_nlmsg_put2(buf, NFQNL_MSG_CONFIG, qh->id, NLM_F_ACK);
 
-	nfnl_addattr_l(&u.nmh, sizeof(u), NFQA_CFG_QUEUE_MAXLEN, &queue_maxlen,
-			sizeof(queue_maxlen));
+	mnl_attr_put_u32(nlh, NFQA_CFG_QUEUE_MAXLEN, htonl(queuelen));
 
-	return nfnl_query(qh->h->nfnlh, &u.nmh);
+	return __nfq_query(qh->h, nlh, buf, sizeof(buf));
 }
 
 /**
Signature · 1 line
2.35.8
author
#6 lore raw

PATCH v3 6/15 src: Convert nfq_handle_packet(), nfq_get_secctx(), nfq_get_payload() and all the nfq_get_ functions to use libmnl

In reply to Duncan Roe

The opaque struct nfq_data is now an array of struct nlattr instead of struct nfattr.

Because of using mnl_attr_parse(), the first array element is for attribute 0 instead of attribute 1 as previously. Because of this, all the nfq_get_ functions have to be converted for this commit.

Functions now using libmnl exclusively: nfq_get_msg_packet_hdr(), nfq_get_nfmark(), nfq_get_timestamp(), nfq_get_indev(), nfq_get_physindev(), nfq_get_outdev(), nfq_get_physoutdev(), nfqnl_msg_packet_hw(), nfq_get_uid() & nfq_get_gid().

---
Changes in v3:
- rebased
- Don't include a kernel header (don't need it anyway)

Changes in v2:
- Fix spelling error in commit message
- Fix checkpatch warning re space before __nfq_handle_msg declaration
- rebase to account for updated patches

 doxygen/doxygen.cfg.in   |   1 +
 src/libnetfilter_queue.c | 124 ++++++++++++++++++++++++++++-----------
 2 files changed, 92 insertions(+), 33 deletions(-)
doxygen/doxygen.cfg.in +1 -0
index 6dd7017..fcfc045 100644
@@ -16,6 +16,7 @@ EXCLUDE_SYMBOLS        = EXPORT_SYMBOL \
                          nfnl_handle \
                          nfnl_subsys_handle \
                          mnl_socket \
+                         nfnl_callback2 \
                          tcp_flag_word
 EXAMPLE_PATTERNS       =
 INPUT_FILTER           = "sed 's/EXPORT_SYMBOL//g'"
src/libnetfilter_queue.c +84 -33

258 lines not on this page · raw message

Signature · 1 line
2.35.8
author
#7 lore raw

PATCH v3 7/15 src: Convert nfq_set_verdict() and nfq_set_verdict2() to use libmnl if there is no data

In reply to Duncan Roe

static __set_verdict() uses mnl-API calls in enough places that the path for no (mangled) data doesn't use any nfnl-API functions. With no data, __set_verdict() uses sendto() (faster than sendmsg()). nfq_set_verdict2() must not use htonl() on the packet mark.

---
v3:
- rebased
- defer removal of libnfnetlink/libnfnetlink.h include to 13/15

v2:
- rebase to account for updated patches 1 - 3
- fix checkpatch warning re block comment termination

 src/libnetfilter_queue.c | 36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)
src/libnetfilter_queue.c +16 -18
index 6500fec..3fa8d2d 100644
@@ -951,13 +951,8 @@ static int __set_verdict(struct nfq_q_handle *qh, uint32_t id,
 		uint32_t data_len, const unsigned char *data,
 		enum nfqnl_msg_types type)
 {
-	struct nfqnl_msg_verdict_hdr vh;
-	union {
-		char buf[NFNL_HEADER_LEN
-			+NFA_LENGTH(sizeof(mark))
-			+NFA_LENGTH(sizeof(vh))];
-		struct nlmsghdr nmh;
-	} u;
+	char buf[MNL_SOCKET_BUFFER_SIZE];
+	struct nlmsghdr *nlh;
 
 	struct iovec iov[3];
 	int nvecs;
@@ -968,20 +963,23 @@ static int __set_verdict(struct nfq_q_handle *qh, uint32_t id,
 
 	memset(iov, 0, sizeof(iov));
 
-	vh.verdict = htonl(verdict);
-	vh.id = htonl(id);
-
-	nfnl_fill_hdr(qh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, qh->id,
-				type, NLM_F_REQUEST);
+	nlh = nfq_nlmsg_put(buf, NFQNL_MSG_VERDICT, qh->id);
 
 	/* add verdict header */
-	nfnl_addattr_l(&u.nmh, sizeof(u), NFQA_VERDICT_HDR, &vh, sizeof(vh));
+	nfq_nlmsg_verdict_put(nlh, id, verdict);
 
 	if (set_mark)
-		nfnl_addattr32(&u.nmh, sizeof(u), NFQA_MARK, mark);
+		nfq_nlmsg_verdict_put_mark(nlh, mark);
+
+	/* Efficiency gain: when there is only 1 iov,
+	 * sendto() is faster than sendmsg() because the kernel only has
+	 * 1 userspace address to validate instead of 2.
+	 */
+	if (!data_len)
+		return mnl_socket_sendto(qh->h->nl, nlh, nlh->nlmsg_len);
 
-	iov[0].iov_base = &u.nmh;
-	iov[0].iov_len = NLMSG_TAIL(&u.nmh) - (void *)&u.nmh;
+	iov[0].iov_base = nlh;
+	iov[0].iov_len = NLMSG_TAIL(nlh) - (void *)nlh;
 	nvecs = 1;
 
 	if (data_len) {
@@ -995,7 +993,7 @@ static int __set_verdict(struct nfq_q_handle *qh, uint32_t id,
 		 * header.  The size of the attribute is given in the
 		 * nla_len field and is set in the nfnl_build_nfa_iovec()
 		 * function. */
-		u.nmh.nlmsg_len += data_attr.nla_len;
+		nlh->nlmsg_len += data_attr.nla_len;
 	}
 
 	return nfnl_sendiov(qh->h->nfnlh, iov, nvecs, 0);
@@ -1052,7 +1050,7 @@ int nfq_set_verdict2(struct nfq_q_handle *qh, uint32_t id,
 		     uint32_t verdict, uint32_t mark,
 		     uint32_t data_len, const unsigned char *buf)
 {
-	return __set_verdict(qh, id, verdict, htonl(mark), 1, data_len,
+	return __set_verdict(qh, id, verdict, mark, 1, data_len,
 						buf, NFQNL_MSG_VERDICT);
 }
 
Signature · 1 line
2.35.8
author
#8 lore raw

PATCH v3 8/15 src: Incorporate nfnl_rcvbufsiz() in libnetfilter_queue

In reply to Duncan Roe

nfnl_rcvbufsiz() is the first bullet point in the Performance section of the libnetfilter_queue HTML main page.
We have to assume people have used it,
so supply a version that uses libmnl.

---
v3: rebased

v2: rebase to account for updated patches

 .../libnetfilter_queue/libnetfilter_queue.h   |  2 ++
 src/libnetfilter_queue.c                      | 36 +++++++++++++++++++
 2 files changed, 38 insertions(+)
include/libnetfilter_queue/libnetfilter_queue.h +2 -0
index f7e68d8..9327f8c 100644
@@ -35,6 +35,8 @@ typedef int  nfq_callback(struct nfq_q_handle *gh, struct nfgenmsg *nfmsg,
 		       struct nfq_data *nfad, void *data);
 
 
+extern unsigned int nfnl_rcvbufsiz(const struct nfnl_handle *h,
+				   unsigned int size);
 extern struct nfq_handle *nfq_open(void);
 extern struct nfq_handle *nfq_open_nfnl(struct nfnl_handle *nfnlh);
 extern int nfq_close(struct nfq_handle *h);
src/libnetfilter_queue.c +36 -0
index 3fa8d2d..f26b65f 100644
@@ -578,6 +578,42 @@ out_free:
  * @{
  */
 
+/**
+ * nfnl_rcvbufsiz - set the socket buffer size
+ * \param h nfnetlink connection handle obtained via call to \b nfq_nfnlh()
+ * \param size size of the buffer we want to set
+ *
+ * This nfnl-API function sets the new size of the socket buffer.
+ * Use this setting
+ * to increase the socket buffer size if your system is reporting ENOBUFS
+ * errors.
+ *
+ * \return new size of kernel socket buffer
+ */
+
+EXPORT_SYMBOL
+unsigned int nfnl_rcvbufsiz(const struct nfnl_handle *h, unsigned int size)
+{
+	int status;
+	socklen_t socklen = sizeof(size);
+	unsigned int read_size = 0;
+
+	/* first we try the FORCE option, which is introduced in kernel
+	 * 2.6.14 to give "root" the ability to override the system wide
+	 * maximum
+	 */
+	status = setsockopt(h->fd, SOL_SOCKET, SO_RCVBUFFORCE, &size, socklen);
+	if (status < 0) {
+		/* if this didn't work, we try at least to get the system
+		 * wide maximum (or whatever the user requested)
+		 */
+		setsockopt(h->fd, SOL_SOCKET, SO_RCVBUF, &size, socklen);
+	}
+	getsockopt(h->fd, SOL_SOCKET, SO_RCVBUF, &read_size, &socklen);
+
+	return read_size;
+}
+
 /**
  * nfq_close - close a nfqueue handler
  * \param h Netfilter queue connection handle obtained via call to nfq_open()
Signature · 1 line
2.35.8
author
#9 lore raw

PATCH v3 9/15 src: Convert nfq_fd() to use libmnl

In reply to Duncan Roe

struct nfq_handle has a struct mnl_socket * now, use that.

---
v3: rebased

v2: rebase to account for updated patches

 src/libnetfilter_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/libnetfilter_queue.c +1 -1
index f26b65f..8a11f41 100644
@@ -377,7 +377,7 @@ struct nfnl_handle *nfq_nfnlh(struct nfq_handle *h)
 EXPORT_SYMBOL
 int nfq_fd(struct nfq_handle *h)
 {
-	return nfnl_fd(nfq_nfnlh(h));
+	return mnl_socket_get_fd(h->nl);
 }
 /**
  * @}
Signature · 1 line
2.35.8
author
#10 lore raw

PATCH v3 10/15 src: Convert remaining nfq_* functions to use libmnl

In reply to Duncan Roe

Converted: nfq_set_verdict2(), nfq_set_verdict_batch2(),

           nfq_set_verdict_mark(), nfq_get_nfmark() [again] &
           nfq_get_skbinfo()

We only use 2 iovecs instead of 3
by tacking the data attribute onto the end of the first iovec buffer.

---
Changes in v3: (none)

Changes in v2:
- Move nfq_set_mode() conversion to patch 5
- Rebase to account for updated patches

 src/libnetfilter_queue.c | 67 +++++++++++++++++++++-------------------
 1 file changed, 35 insertions(+), 32 deletions(-)
src/libnetfilter_queue.c +35 -32
index 8a11f41..ecdd144 100644
@@ -989,17 +989,9 @@ static int __set_verdict(struct nfq_q_handle *qh, uint32_t id,
 {
 	char buf[MNL_SOCKET_BUFFER_SIZE];
 	struct nlmsghdr *nlh;
+	static struct sockaddr_nl snl = {.nl_family = AF_NETLINK };
 
-	struct iovec iov[3];
-	int nvecs;
-
-	/* This must be declared here (and not inside the data
-	 * handling block) because the iovec points to this. */
-	struct nlattr data_attr;
-
-	memset(iov, 0, sizeof(iov));
-
-	nlh = nfq_nlmsg_put(buf, NFQNL_MSG_VERDICT, qh->id);
+	nlh = nfq_nlmsg_put(buf, type, qh->id);
 
 	/* add verdict header */
 	nfq_nlmsg_verdict_put(nlh, id, verdict);
@@ -1013,26 +1005,38 @@ static int __set_verdict(struct nfq_q_handle *qh, uint32_t id,
 	 */
 	if (!data_len)
 		return mnl_socket_sendto(qh->h->nl, nlh, nlh->nlmsg_len);
+	{
+		struct iovec iov[2];
+		struct nlattr *data_attr = mnl_nlmsg_get_payload_tail(nlh);
+		const struct msghdr msg = {
+			.msg_name = &snl,
+			.msg_namelen = sizeof(snl),
+			.msg_iov = iov,
+			.msg_iovlen = 2,
+			.msg_control = NULL,
+			.msg_controllen = 0,
+			.msg_flags = 0,
+		};
+
+		mnl_attr_put(nlh, NFQA_PAYLOAD, 0, NULL);
+
+		iov[0].iov_base = nlh;
+		iov[0].iov_len = nlh->nlmsg_len;
+		/* The typecast here is to cast away data's const-ness: */
+		iov[1].iov_base = (unsigned char *)data;
+		iov[1].iov_len = data_len;
 
-	iov[0].iov_base = nlh;
-	iov[0].iov_len = NLMSG_TAIL(nlh) - (void *)nlh;
-	nvecs = 1;
-
-	if (data_len) {
-		/* Temporary cast until we get rid of nfnl_build_nfa_iovec() */
-		nfnl_build_nfa_iovec(&iov[1], (struct nfattr *)&data_attr,
-		//nfnl_build_nfa_iovec(&iov[1], &data_attr,
-				     NFQA_PAYLOAD, data_len,
-				     (unsigned char *) data);
-		nvecs += 2;
 		/* Add the length of the appended data to the message
-		 * header.  The size of the attribute is given in the
-		 * nla_len field and is set in the nfnl_build_nfa_iovec()
-		 * function. */
-		nlh->nlmsg_len += data_attr.nla_len;
-	}
+		 * header and attribute length.
+		 * No padding is needed: this is the end of the message.
+		 */
+
+		nlh->nlmsg_len += data_len;
 
-	return nfnl_sendiov(qh->h->nfnlh, iov, nvecs, 0);
+		data_attr->nla_len += data_len;
+
+		return sendmsg(qh->h->nfnlh->fd, &msg, 0);
+	}
 }
 
 /**
@@ -1121,7 +1125,7 @@ EXPORT_SYMBOL
 int nfq_set_verdict_batch2(struct nfq_q_handle *qh, uint32_t id,
 			   uint32_t verdict, uint32_t mark)
 {
-	return __set_verdict(qh, id, verdict, htonl(mark), 1, 0,
+	return __set_verdict(qh, id, verdict, mark, 1, 0,
 				NULL, NFQNL_MSG_VERDICT_BATCH);
 }
 
@@ -1144,7 +1148,7 @@ int nfq_set_verdict_mark(struct nfq_q_handle *qh, uint32_t id,
 			 uint32_t verdict, uint32_t mark,
 			 uint32_t data_len, const unsigned char *buf)
 {
-	return __set_verdict(qh, id, verdict, mark, 1, data_len, buf,
+	return __set_verdict(qh, id, verdict, ntohl(mark), 1, data_len, buf,
 						NFQNL_MSG_VERDICT);
 }
 
@@ -1212,7 +1216,6 @@ uint32_t nfq_get_nfmark(struct nfq_data *nfad)
 		return 0;
 
 	return ntohl(mnl_attr_get_u32(nfad->data[NFQA_MARK]));
-	return ntohl(nfnl_get_data(nfad->data, NFQA_MARK, uint32_t));
 }
 
 /**
@@ -1476,10 +1479,10 @@ struct nfqnl_msg_packet_hw *nfq_get_packet_hw(struct nfq_data *nfad)
 EXPORT_SYMBOL
 uint32_t nfq_get_skbinfo(struct nfq_data *nfad)
 {
-	if (!nfnl_attr_present(nfad->data, NFQA_SKB_INFO))
+	if (!nfad->data[NFQA_SKB_INFO])
 		return 0;
 
-	return ntohl(nfnl_get_data(nfad->data, NFQA_SKB_INFO, uint32_t));
+	return ntohl(mnl_attr_get_u32(nfad->data[NFQA_SKB_INFO]));
 }
 
 /**
Signature · 1 line
2.35.8
author
#11 lore raw

PATCH v3 11/15 src: Copy nlif-related files from libnfnetlink

In reply to Duncan Roe

Introduce include/libnetfilter_queue/linux_list.h and src/iftable.c. These are not exact copies: all tractable checkpatch errors are fixed. Also complete iftable.c kerneldoc to doxygen translation. This commit doesn't actually do anything with the new files.

---
Changes in v3:
- Move doxygen.cfg changes to here from patch 12/15 (otherwise if no more patches are applied then man pages don't build)

Changes in v2:
- This was originally patch 12 of 32
- Update commit message
- Don't copy src/rtnl.c since it's not kept
- Fix checkpatch errors on the fly.
- Finish kerneldoc xlation on the fly (was patch 16 of 32).

 doxygen/doxygen.cfg.in                  |  2 ++
 include/libnetfilter_queue/linux_list.h | 730 ++++++++++++++++++++++++
 src/iftable.c                           | 355 ++++++++++++
 3 files changed, 1087 insertions(+)
 create mode 100644 include/libnetfilter_queue/linux_list.h
 create mode 100644 src/iftable.c
doxygen/doxygen.cfg.in +2 -0
index fcfc045..bf6cba8 100644
@@ -16,6 +16,8 @@ EXCLUDE_SYMBOLS        = EXPORT_SYMBOL \
                          nfnl_handle \
                          nfnl_subsys_handle \
                          mnl_socket \
+                         ifindex_node \
+                         nlif_handle \
                          nfnl_callback2 \
                          tcp_flag_word
 EXAMPLE_PATTERNS       =
include/libnetfilter_queue/linux_list.h new file +730 -0

730 lines not on this page · raw message

src/iftable.c new file +355 -0

355 lines not on this page · raw message

Signature · 1 line
2.35.8
author
#12 lore raw

PATCH v3 12/15 doc: Add iftable.c to the doxygen system

In reply to Duncan Roe

iftable.c has a usage description (moved from libnetfilter_queue.c), but is not yet converted to use libmnl.

---
v3:
- rebased
- move doxygen.cfg patch from here to 11/15

v2: Created from patches 14/32 & 16/32

 doxygen/Makefile.am      |  1 +
 src/iftable.c            | 49 ++++++++++++++++++++++++++++++++++++++++
 src/libnetfilter_queue.c | 38 ++++---------------------------
 3 files changed, 54 insertions(+), 34 deletions(-)
doxygen/Makefile.am +1 -0
index 68be963..a6cd83a 100644
@@ -2,6 +2,7 @@ if HAVE_DOXYGEN
 
 doc_srcs = $(top_srcdir)/src/libnetfilter_queue.c\
            $(top_srcdir)/src/nlmsg.c\
+           $(top_srcdir)/src/iftable.c\
            $(top_srcdir)/src/extra/checksum.c\
            $(top_srcdir)/src/extra/ipv4.c\
            $(top_srcdir)/src/extra/pktbuff.c\
src/iftable.c +49 -0

55 lines not on this page · raw message

src/libnetfilter_queue.c +4 -34
index ecdd144..970aea2 100644
@@ -1324,34 +1324,7 @@ uint32_t nfq_get_physoutdev(struct nfq_data *nfad)
  * \param name pointer to the buffer to receive the interface name;
  *  not more than \c IFNAMSIZ bytes will be copied to it.
  * \return -1 in case of error, >0 if it succeed.
- *
- * To use a nlif_handle, You need first to call nlif_open() and to open
- * an handler. Don't forget to store the result as it will be used
- * during all your program life:
- * \verbatim
-	h = nlif_open();
-	if (h == NULL) {
-		perror("nlif_open");
-		exit(EXIT_FAILURE);
-	}
-\endverbatim
- * Once the handler is open, you need to fetch the interface table at a
- * whole via a call to nlif_query.
- * \verbatim
-	nlif_query(h);
-\endverbatim
- * libnfnetlink is able to update the interface mapping when a new interface
- * appears. To do so, you need to call nlif_catch() on the handler after each
- * interface related event. The simplest way to get and treat event is to run
- * a select() or poll() against the nlif file descriptor. To get this file
- * descriptor, you need to use nlif_fd:
- * \verbatim
-	if_fd = nlif_fd(h);
-\endverbatim
- * Don't forget to close the handler when you don't need the feature anymore:
- * \verbatim
-	nlif_close(h);
-\endverbatim
+ * \sa __nlif_open__(3)
  *
  */
 EXPORT_SYMBOL
@@ -1370,9 +1343,8 @@ int nfq_get_indev_name(struct nlif_handle *nlif_handle,
  * \param name pointer to the buffer to receive the interface name;
  *  not more than \c IFNAMSIZ bytes will be copied to it.
  *
- * See nfq_get_indev_name() documentation for nlif_handle usage.
- *
  * \return  -1 in case of error, > 0 if it succeed.
+ * \sa __nlif_open__(3)
  */
 EXPORT_SYMBOL
 int nfq_get_physindev_name(struct nlif_handle *nlif_handle,
@@ -1390,9 +1362,8 @@ int nfq_get_physindev_name(struct nlif_handle *nlif_handle,
  * \param name pointer to the buffer to receive the interface name;
  *  not more than \c IFNAMSIZ bytes will be copied to it.
  *
- * See nfq_get_indev_name() documentation for nlif_handle usage.
- *
  * \return  -1 in case of error, > 0 if it succeed.
+ * \sa __nlif_open__(3)
  */
 EXPORT_SYMBOL
 int nfq_get_outdev_name(struct nlif_handle *nlif_handle,
@@ -1410,9 +1381,8 @@ int nfq_get_outdev_name(struct nlif_handle *nlif_handle,
  * \param name pointer to the buffer to receive the interface name;
  *  not more than \c IFNAMSIZ bytes will be copied to it.
  *
- * See nfq_get_indev_name() documentation for nlif_handle usage.
- *
  * \return  -1 in case of error, > 0 if it succeed.
+ * \sa __nlif_open__(3)
  */
 
 EXPORT_SYMBOL
Signature · 1 line
2.35.8
author
#13 lore raw

PATCH v3 13/15 src: Convert all nlif_* functions to use libmnl

In reply to Duncan Roe

In iftable.c, replace calls to functions in rtnetlink.c with inline code (converted to use libmnl instead of libnfnetlink).
It is essential to offer *all* functions originally provided by libnfnetlink so that a built program will either take its nlif_*() functions from libnetfilter_queue or libnfnetlink (depending on the build-time order in LIBS).
While being about it, remove unnecessary libnfnetlink.h include and libnfnetlink dependency in libnetfilter_queue.c.

---
v3:
- remove libnfnetlink.h include from libnetfilter_queue.c (done here since this is the last src patch in the series)

v2: created from patches 19/32 & (some of) 32/32

 src/Makefile.am          |   1 +
 src/iftable.c            | 311 ++++++++++++++++++++++--------------------------
 src/libnetfilter_queue.c |   3 +--
 3 files changed, 142 insertions(+), 173 deletions(-)
src/Makefile.am +1 -0
index 079853e..a6813e8 100644
@@ -30,6 +30,7 @@ libnetfilter_queue_la_LDFLAGS = -Wc,-nostartfiles \
 				-version-info $(LIBVERSION)
 libnetfilter_queue_la_SOURCES = libnetfilter_queue.c	\
 				nlmsg.c			\
+				iftable.c		\
 				extra/checksum.c	\
 				extra/icmp.c		\
 				extra/ipv6.c		\
src/iftable.c +140 -171

428 lines not on this page · raw message

src/libnetfilter_queue.c +1 -2
index 334f898..dd9c9db 100644
@@ -32,7 +32,6 @@
 #include <linux/netfilter/nfnetlink_queue.h>
 
 #include <libmnl/libmnl.h>
-#include <libnfnetlink/libnfnetlink.h>
 #include <libnetfilter_queue/libnetfilter_queue.h>
 #include "internal.h"
 
@@ -47,7 +46,7 @@
  * 	https://netfilter.org/projects/libnetfilter_queue/
  *
  <h1>Dependencies</h1>
- * libnetfilter_queue requires libmnl, libnfnetlink and a kernel that includes
+ * libnetfilter_queue requires libmnl and a kernel that includes
  * the Netfilter NFQUEUE over NFNETLINK interface (i.e. 2.6.14 or later).
  *
  * <h1>Main Features</h1>
Signature · 1 line
2.35.8
author
#14 lore raw

PATCH v3 14/15 include: Use libmnl.h instead of libnfnetlink.h

In reply to Duncan Roe

Add nlif_* prototypes and 64-bit converters to libnetfilter_queue.h. Update (deprecated) include/libnetfilter_queue/linux_nfnetlink_queue.h to not include linux/nfnetlink.h (no replacement required)

---
Changes in v3:
- Remove include of linux/nfnetlink.h (not needed)
- Rebased

Changes in v2:
- This was patch 18 v1
- Update commit message:
- libnetfilter_queue.c has no libnfnetlink.h references (removed in patch 6 v2).
- Incorporate patch 22 v1

 .../libnetfilter_queue/libnetfilter_queue.h   | 36 ++++++++++++++++++-
 .../linux_nfnetlink_queue.h                   |  3 +-
 2 files changed, 37 insertions(+), 2 deletions(-)
include/libnetfilter_queue/libnetfilter_queue.h +35 -1
index 9327f8c..46289f2 100644
@@ -14,7 +14,7 @@
 #define __LIBCTNETLINK_H
 
 #include <sys/time.h>
-#include <libnfnetlink/libnfnetlink.h>
+#include <libmnl/libmnl.h>
 
 #include <libnetfilter_queue/linux_nfnetlink_queue.h>
 
@@ -25,6 +25,7 @@ extern "C" {
 struct nfq_handle;
 struct nfq_q_handle;
 struct nfq_data;
+struct nlif_handle;
 
 extern int nfq_errno;
 
@@ -155,8 +156,41 @@ int nfq_nlmsg_parse(const struct nlmsghdr *nlh, struct nlattr **attr);
 struct nlmsghdr *nfq_nlmsg_put(char *buf, int type, uint32_t queue_num);
 struct nlmsghdr *nfq_nlmsg_put2(char *buf, int type, uint32_t queue_num, uint16_t flags);
 
+/*
+ * Network Interface Table API
+ */
+
+#ifndef IFNAMSIZ
+#define IFNAMSIZ 16
+#endif
+
+struct nlif_handle *nlif_open(void);
+void nlif_close(struct nlif_handle *orig);
+int nlif_fd(struct nlif_handle *nlif_handle);
+int nlif_query(struct nlif_handle *nlif_handle);
+int nlif_catch(struct nlif_handle *nlif_handle);
+int nlif_index2name(struct nlif_handle *nlif_handle, unsigned int if_index, char *name);
+int nlif_get_ifflags(const struct nlif_handle *h, unsigned int index, unsigned int *flags);
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
 
+/*
+ * __be46 stuff - should be in libmnl.h maybe?
+ */
+
+#include <byteswap.h>
+#if __BYTE_ORDER == __BIG_ENDIAN
+#  ifndef __be64_to_cpu
+#  define __be64_to_cpu(x)     (x)
+#  endif
+# else
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+#  ifndef __be64_to_cpu
+#  define __be64_to_cpu(x)     __bswap_64(x)
+#  endif
+# endif
+#endif
+
 #endif	/* __LIBNFQNETLINK_H */
include/libnetfilter_queue/linux_nfnetlink_queue.h +0 -1
index 6844270..82d8ece 100644
@@ -8,7 +8,6 @@
 #endif
 
 #include <linux/types.h>
-#include <libnfnetlink/linux_nfnetlink.h>
 
 enum nfqnl_msg_types {
 	NFQNL_MSG_PACKET,		/* packet from kernel to userspace */
Signature · 1 line
2.35.8
author
#15 lore raw

PATCH v3 15/15 build: Remove libnfnetlink from the build

In reply to Duncan Roe

libnfnetlink was a "private library" - always loaded whether user apps used it or not. Remove it now it is no longer needed.

---
v3: no change

v2: This was patch 21/32. No changes.

 Make_global.am           | 2 +-
 configure.ac             | 1 -
 libnetfilter_queue.pc.in | 2 --
 src/Makefile.am          | 2 +-
 4 files changed, 2 insertions(+), 5 deletions(-)
Make_global.am +1 -1
index 91da5da..4d8a58e 100644
@@ -1,2 +1,2 @@
-AM_CPPFLAGS = -I${top_srcdir}/include ${LIBNFNETLINK_CFLAGS} ${LIBMNL_CFLAGS}
+AM_CPPFLAGS = -I${top_srcdir}/include ${LIBMNL_CFLAGS}
 AM_CFLAGS = -Wall ${GCC_FVISIBILITY_HIDDEN}
configure.ac +0 -1
index 7359fba..ba7b15f 100644
@@ -42,7 +42,6 @@ case "$host" in
 esac
 
 dnl Dependencies
-PKG_CHECK_MODULES([LIBNFNETLINK], [libnfnetlink >= 0.0.41])
 PKG_CHECK_MODULES([LIBMNL], [libmnl >= 1.0.3])
 
 AS_IF([test "$enable_man_pages" = no -a "$enable_html_doc" = no],
libnetfilter_queue.pc.in +0 -2
index 9c6c2c4..1927a8a 100644
@@ -9,8 +9,6 @@ Name: libnetfilter_queue
 Description: netfilter userspace packet queueing library
 URL: http://netfilter.org/projects/libnetfilter_queue/
 Version: @VERSION@
-Requires: libnfnetlink
 Conflicts:
 Libs: -L${libdir} -lnetfilter_queue
-Libs.private: @LIBNFNETLINK_LIBS@
 Cflags: -I${includedir}
src/Makefile.am +1 -1
index a6813e8..e5e1d66 100644
@@ -39,4 +39,4 @@ libnetfilter_queue_la_SOURCES = libnetfilter_queue.c	\
 				extra/pktbuff.c		\
 				extra/udp.c
 
-libnetfilter_queue_la_LIBADD  = ${LIBNFNETLINK_LIBS} ${LIBMNL_LIBS}
+libnetfilter_queue_la_LIBADD  = ${LIBMNL_LIBS}
Signature · 1 line
2.35.8