Browse Source

xtables-addons: fix build on 4.19 for xt_DNETMAP and xt_pknock

Backport 2 commits to fix build on 4.19:
3ea761a1ed
2b76b68c65

Signed-off-by: Deng Qingfang <dengqf6@mail2.sysu.edu.cn>
lilik-openwrt-22.03
Deng Qingfang 5 years ago
parent
commit
d9222c37dd
3 changed files with 75 additions and 0 deletions
  1. +0
    -0
      net/xtables-addons/patches/001-fix-kernel-version-detection.patch
  2. +50
    -0
      net/xtables-addons/patches/002-build-support-for-Linux-4.15.patch
  3. +25
    -0
      net/xtables-addons/patches/003-build-add-support-for-Linux-4.18.patch

net/xtables-addons/patches/002-fix-kernel-version-detection.patch → net/xtables-addons/patches/001-fix-kernel-version-detection.patch View File


+ 50
- 0
net/xtables-addons/patches/002-build-support-for-Linux-4.15.patch View File

@ -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);

+ 25
- 0
net/xtables-addons/patches/003-build-add-support-for-Linux-4.18.patch View File

@ -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;

Loading…
Cancel
Save