From d9222c37dd652ea5e239d72584c44ada1550ba19 Mon Sep 17 00:00:00 2001 From: Deng Qingfang Date: Wed, 13 Feb 2019 15:07:57 +0800 Subject: [PATCH] xtables-addons: fix build on 4.19 for xt_DNETMAP and xt_pknock 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 --- ...=> 001-fix-kernel-version-detection.patch} | 0 .../002-build-support-for-Linux-4.15.patch | 50 +++++++++++++++++++ ...003-build-add-support-for-Linux-4.18.patch | 25 ++++++++++ 3 files changed, 75 insertions(+) rename net/xtables-addons/patches/{002-fix-kernel-version-detection.patch => 001-fix-kernel-version-detection.patch} (100%) create mode 100644 net/xtables-addons/patches/002-build-support-for-Linux-4.15.patch create mode 100644 net/xtables-addons/patches/003-build-add-support-for-Linux-4.18.patch diff --git a/net/xtables-addons/patches/002-fix-kernel-version-detection.patch b/net/xtables-addons/patches/001-fix-kernel-version-detection.patch similarity index 100% rename from net/xtables-addons/patches/002-fix-kernel-version-detection.patch rename to net/xtables-addons/patches/001-fix-kernel-version-detection.patch 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 index 0000000000..99b0cfe3b0 --- /dev/null +++ b/net/xtables-addons/patches/002-build-support-for-Linux-4.15.patch @@ -0,0 +1,50 @@ +From 2b76b68c65c97fc11409088c3c30993324df8500 Mon Sep 17 00:00:00 2001 +From: Marcelo Henrique Cerri +Date: Thu, 4 Jan 2018 18:50:50 +0100 +Subject: [PATCH] build: support for Linux 4.15 + +Signed-off-by: Marcelo Henrique Cerri +--- + 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 index 0000000000..a6f31cf00f --- /dev/null +++ b/net/xtables-addons/patches/003-build-add-support-for-Linux-4.18.patch @@ -0,0 +1,25 @@ +From 3ea761a1ed338241fbc79bef8e433307e108b6cd Mon Sep 17 00:00:00 2001 +From: Jan Engelhardt +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; -- 2.30.2