[PATCH] [iptables] extensions: libxt_LOG.c: fix linux/netfilter/xt_LOG.h include on Linux < 3.4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



libxt_LOG.c:6:10: fatal error: linux/netfilter/xt_LOG.h: No such file or directory
. #include <linux/netfilter/xt_LOG.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~

Linux < 3.4 defines are in include/linux/netfilter_ipv{4,6}/ipt_LOG.h,
but the naming is slightly different, so just define it here as the values are the same.

https://github.com/torvalds/linux/commit/6939c33a757bd006c5e0b8b5fd429fc587a4d0f4

Signed-off-by: Thomas Devoogdt <thomas.devoogdt@xxxxxxxxx>
---
 extensions/libxt_LOG.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/extensions/libxt_LOG.c b/extensions/libxt_LOG.c
index b6fe0b2e..beb1d40a 100644
--- a/extensions/libxt_LOG.c
+++ b/extensions/libxt_LOG.c
@@ -3,7 +3,27 @@
 #define SYSLOG_NAMES
 #include <syslog.h>
 #include <xtables.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
 #include <linux/netfilter/xt_LOG.h>
+#else
+/* Linux < 3.4 defines are in include/linux/netfilter_ipv{4,6}/ipt_LOG.h,
+   but the naming is slightly different, so just define it here as the values are the same. */
+#define XT_LOG_TCPSEQ           0x01    /* Log TCP sequence numbers */
+#define XT_LOG_TCPOPT           0x02    /* Log TCP options */
+#define XT_LOG_IPOPT            0x04    /* Log IP options */
+#define XT_LOG_UID              0x08    /* Log UID owning local socket */
+#define XT_LOG_NFLOG            0x10    /* Unsupported, don't reuse */
+#define XT_LOG_MACDECODE        0x20    /* Decode MAC header */
+#define XT_LOG_MASK             0x2f
+
+struct xt_log_info {
+        unsigned char level;
+        unsigned char logflags;
+        char prefix[30];
+};
+#endif
 
 #define LOG_DEFAULT_LEVEL LOG_WARNING
 
-- 
2.39.2




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux