Skip to contentSkip to conversation

src: Stop users from accidentally using legacy linux_nfnetlink_queue.h

PATCH In review Duncan Roe 2 participants 3 messages Aug 6, 2021 – Aug 10, 2021 netfilter

lore
Share & tools
lore

Duncan Roe

author
#0 lore raw

PATCH v2 1/1 src: Stop users from accidentally using legacy linux_nfnetlink_queue.h

If a user coded
#include <libnetfilter_queue/libnetfilter_queue.h>
#include <linux/netfilter/nfnetlink_queue.h>
then instead of nfnetlink_queue.h they would get linux_nfnetlink_queue.h. In the library, this only affects libnetfilter_queue.c

---
 include/libnetfilter_queue/libnetfilter_queue.h | 2 --
 src/libnetfilter_queue.c                        | 1 +
 utils/nfqnl_test.c                              | 1 +
 3 files changed, 2 insertions(+), 2 deletions(-)
include/libnetfilter_queue/libnetfilter_queue.h +0 -2
index a19122f..42a3a45 100644
@@ -16,8 +16,6 @@
 #include <sys/time.h>
 #include <libnfnetlink/libnfnetlink.h>
 
-#include <libnetfilter_queue/linux_nfnetlink_queue.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
src/libnetfilter_queue.c +1 -0
index ef3b211..899c765 100644
@@ -32,6 +32,7 @@
 
 #include <libnfnetlink/libnfnetlink.h>
 #include <libnetfilter_queue/libnetfilter_queue.h>
+#include <libnetfilter_queue/linux_nfnetlink_queue.h>
 #include "internal.h"
 
 /**
utils/nfqnl_test.c +1 -0
index 5e76ffe..682f3d7 100644
@@ -5,6 +5,7 @@
 #include <netinet/in.h>
 #include <linux/types.h>
 #include <linux/netfilter.h>		/* for NF_ACCEPT */
+#include <linux/netfilter/nfnetlink_queue.h>
 #include <errno.h>
 
 #include <libnetfilter_queue/libnetfilter_queue.h>
Signature · 1 line
2.17.5
author
#1 lore raw
Quoted 8 lines · Duncan Roe

If a user coded
#include <libnetfilter_queue/libnetfilter_queue.h>
#include <linux/netfilter/nfnetlink_queue.h>
then instead of nfnetlink_queue.h they would get linux_nfnetlink_queue.h. In the library, this only affects libnetfilter_queue.c

---

[...]
Sorry, the v2 comment at this point should have been:

Quoted 1 line

v2: also update utils/nfqnl_test.c (required for good make distcheck)

Cheers ... Duncan.

#2 lore raw
In reply to Duncan Roe
Quoted 5 lines · Duncan Roe

If a user coded
#include <libnetfilter_queue/libnetfilter_queue.h>
#include <linux/netfilter/nfnetlink_queue.h>
then instead of nfnetlink_queue.h they would get linux_nfnetlink_queue.h. In the library, this only affects libnetfilter_queue.c

Emit a warning to deprecate linux_nfnetlink_queue.h (which is a copy of the original nfnetlink_queue.h), users instead should be using <linux/netfilter/nfnetlink_queue.h>.

To ensure that a project compiles standalone (without the need for the system kernel header files), you can cache a copy of the header in your software tree (we use this trick for a while in userspace netfilter software).

https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/