xtables-addons: fix build on 4.19 for xt_DNETMAP and xt_pknock
authorDeng Qingfang <redacted>
Wed, 13 Feb 2019 07:07:57 +0000 (15:07 +0800)
committerDeng Qingfang <redacted>
Tue, 19 Feb 2019 11:52:30 +0000 (19:52 +0800)
Backport 2 commits to fix build on 4.19:
https://github.com/nawawi/xtables-addons/commit/3ea761a1ed338241fbc79bef8e433307e108b6cd
https://github.com/nawawi/xtables-addons/commit/2b76b68c65c97fc11409088c3c30993324df8500

Signed-off-by: Deng Qingfang <redacted>
net/xtables-addons/patches/001-fix-kernel-version-detection.patch [moved from net/xtables-addons/patches/002-fix-kernel-version-detection.patch with 100% similarity]
net/xtables-addons/patches/002-build-support-for-Linux-4.15.patch [new file with mode: 0644]
net/xtables-addons/patches/003-build-add-support-for-Linux-4.18.patch [new file with mode: 0644]

diff --git a/net/xtables-addons/patches/002-build-support-for-Linux-4.15.patch b/net/xtables-addons/patches/002-build-support-for-Linux-4.15.patch
new file mode 100644 (file)
index 0000000..99b0cfe
--- /dev/null
@@ -0,0 +1,50 @@
+From 2b76b68c65c97fc11409088c3c30993324df8500 Mon Sep 17 00:00:00 2001
+From: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
+Date: Thu, 4 Jan 2018 18:50:50 +0100
+Subject: [PATCH] build: support for Linux 4.15
+
+Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
+---
+ extensions/pknock/xt_pknock.c | 16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/extensions/pknock/xt_pknock.c b/extensions/pknock/xt_pknock.c
+index 6fbdea4..31d4bc8 100644
+--- a/extensions/pknock/xt_pknock.c
++++ b/extensions/pknock/xt_pknock.c
+@@ -358,10 +358,20 @@ has_logged_during_this_minute(const struct peer *peer)
+  * @r: rule
+  */
+ static void
+-peer_gc(unsigned long r)
++peer_gc(
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
++      struct timer_list *tl
++#else
++      unsigned long r
++#endif
++)
+ {
+       unsigned int i;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
++      struct xt_pknock_rule *rule = from_timer(rule, tl, timer);
++#else
+       struct xt_pknock_rule *rule = (struct xt_pknock_rule *)r;
++#endif
+       struct peer *peer;
+       struct list_head *pos, *n;
+@@ -469,9 +479,13 @@ add_rule(struct xt_pknock_mtinfo *info)
+       if (rule->peer_head == NULL)
+               goto out;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
++      timer_setup(&rule->timer, peer_gc, 0);
++#else
+       init_timer(&rule->timer);
+       rule->timer.function    = peer_gc;
+       rule->timer.data        = (unsigned long)rule;
++#endif
+       rule->status_proc = proc_create_data(info->rule_name, 0, pde,
+                           &pknock_proc_ops, rule);
diff --git a/net/xtables-addons/patches/003-build-add-support-for-Linux-4.18.patch b/net/xtables-addons/patches/003-build-add-support-for-Linux-4.18.patch
new file mode 100644 (file)
index 0000000..a6f31cf
--- /dev/null
@@ -0,0 +1,25 @@
+From 3ea761a1ed338241fbc79bef8e433307e108b6cd Mon Sep 17 00:00:00 2001
+From: Jan Engelhardt <jengelh@inai.de>
+Date: Tue, 14 Aug 2018 14:29:30 +0200
+Subject: [PATCH] build: add support for Linux 4.18
+
+---
+ extensions/xt_DNETMAP.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/extensions/xt_DNETMAP.c b/extensions/xt_DNETMAP.c
+index 1b415c3..de7d4ec 100644
+--- a/extensions/xt_DNETMAP.c
++++ b/extensions/xt_DNETMAP.c
+@@ -367,7 +367,11 @@ dnetmap_tg(struct sk_buff *skb, const struct xt_action_param *par)
+       __be32 prenat_ip, postnat_ip, prenat_ip_prev;
+       const struct xt_DNETMAP_tginfo *tginfo = par->targinfo;
+       const struct nf_nat_range *mr = &tginfo->prefix;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
++      struct nf_nat_range2 newrange;
++#else
+       struct nf_nat_range newrange;
++#endif
+       struct dnetmap_entry *e;
+       struct dnetmap_prefix *p;
+       __s32 jttl;
git clone https://git.99rst.org/PROJECT