diff mbox series

[LEDE-DEV,RFC,18/26] xtables-addons: fix compile with kernel 4.14

Message ID 20171126114524.20819-19-hauke@hauke-m.de
State Superseded
Delegated to: Hauke Mehrtens
Headers show
Series Add support for kernel 4.14 | expand

Commit Message

Hauke Mehrtens Nov. 26, 2017, 11:45 a.m. UTC
This fixes multiple compile problems seen with kernel 4.14.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 .../utils/xtables-addons/patches/001-fix-compile.patch        | 11 +++++++++++
 .../xtables-addons/patches/201-fix-lua-packetscript.patch     |  9 +++++++++
 2 files changed, 20 insertions(+)
 create mode 100644 package/network/utils/xtables-addons/patches/001-fix-compile.patch

Comments

Arjen de Korte Nov. 26, 2017, 5:36 p.m. UTC | #1
Citeren Hauke Mehrtens <hauke@hauke-m.de>:

> This fixes multiple compile problems seen with kernel 4.14.

Comments inline.

> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  .../utils/xtables-addons/patches/001-fix-compile.patch        | 11  
> +++++++++++
>  .../xtables-addons/patches/201-fix-lua-packetscript.patch     |  9 +++++++++
>  2 files changed, 20 insertions(+)
>  create mode 100644  
> package/network/utils/xtables-addons/patches/001-fix-compile.patch
>
> diff --git  
> a/package/network/utils/xtables-addons/patches/001-fix-compile.patch  
> b/package/network/utils/xtables-addons/patches/001-fix-compile.patch
> new file mode 100644
> index 0000000000..e428a75cb1
> --- /dev/null
> +++ b/package/network/utils/xtables-addons/patches/001-fix-compile.patch
> @@ -0,0 +1,11 @@
> +--- a/extensions/xt_DNETMAP.c
> ++++ b/extensions/xt_DNETMAP.c
> +@@ -377,7 +377,7 @@ dnetmap_tg(struct sk_buff *skb, const st
> + 	unsigned int hooknum = par->hooknum;
> + #endif
> +
> +-	NF_CT_ASSERT(hooknum == NF_INET_POST_ROUTING ||
> ++	WARN_ON(hooknum == NF_INET_POST_ROUTING ||
> + 		     hooknum == NF_INET_LOCAL_OUT ||
> + 		     hooknum == NF_INET_PRE_ROUTING);

You reversed the logic here. NF_CT_ASSERT(x) is equivalent to  
WARN_ON(!(x)). See the commit log message that removed this macro from  
the kernel:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/net/netfilter/nf_conntrack.h?id=9efdb14f76f4d7591cd4d7a436ebd716b19703b6

> + 	ct = nf_ct_get(skb, &ctinfo);
> diff --git  
> a/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch  
> b/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch
> index 7599684bdb..a9fb796d09 100644
> ---  
> a/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch
> +++  
> b/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch
> @@ -1,5 +1,14 @@
>  --- a/extensions/LUA/xt_LUA_target.c
>  +++ b/extensions/LUA/xt_LUA_target.c
> +@@ -19,7 +19,7 @@
> + #include <linux/kernel.h>
> + #include <linux/slab.h>
> + #include <linux/module.h>
> +-#include <asm/uaccess.h>
> ++#include <linux/uaccess.h>
> + #include <net/ip.h>
> + #include <linux/netfilter/x_tables.h>
> + #include "xt_LUA.h"
>  @@ -64,10 +64,10 @@ uint32_t  lua_state_refs[LUA_STATE_ARRAY
>    * XT_CONTINUE inside the *register_lua_packet_lib* function.
>    */
Hauke Mehrtens Nov. 26, 2017, 10:44 p.m. UTC | #2
On 11/26/2017 06:36 PM, Arjen de Korte wrote:
> Citeren Hauke Mehrtens <hauke@hauke-m.de>:
> 
>> This fixes multiple compile problems seen with kernel 4.14.
> 
> Comments inline.
> 
>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>>  .../utils/xtables-addons/patches/001-fix-compile.patch        | 11
>> +++++++++++
>>  .../xtables-addons/patches/201-fix-lua-packetscript.patch     |  9
>> +++++++++
>>  2 files changed, 20 insertions(+)
>>  create mode 100644
>> package/network/utils/xtables-addons/patches/001-fix-compile.patch
>>
>> diff --git
>> a/package/network/utils/xtables-addons/patches/001-fix-compile.patch
>> b/package/network/utils/xtables-addons/patches/001-fix-compile.patch
>> new file mode 100644
>> index 0000000000..e428a75cb1
>> --- /dev/null
>> +++ b/package/network/utils/xtables-addons/patches/001-fix-compile.patch
>> @@ -0,0 +1,11 @@
>> +--- a/extensions/xt_DNETMAP.c
>> ++++ b/extensions/xt_DNETMAP.c
>> +@@ -377,7 +377,7 @@ dnetmap_tg(struct sk_buff *skb, const st
>> +     unsigned int hooknum = par->hooknum;
>> + #endif
>> +
>> +-    NF_CT_ASSERT(hooknum == NF_INET_POST_ROUTING ||
>> ++    WARN_ON(hooknum == NF_INET_POST_ROUTING ||
>> +              hooknum == NF_INET_LOCAL_OUT ||
>> +              hooknum == NF_INET_PRE_ROUTING);
> 
> You reversed the logic here. NF_CT_ASSERT(x) is equivalent to
> WARN_ON(!(x)). See the commit log message that removed this macro from
> the kernel:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/net/netfilter/nf_conntrack.h?id=9efdb14f76f4d7591cd4d7a436ebd716b19703b6

You are right, I will fix this.
I just saw that in the upstream version this was just removed:
https://sourceforge.net/p/xtables-addons/xtables-addons/ci/0a6091b64afc3d67c8a9194b8f6230122384f6d9/

I will probably just update to xtables-addons 2.14 and remove this part.

Hauke
diff mbox series

Patch

diff --git a/package/network/utils/xtables-addons/patches/001-fix-compile.patch b/package/network/utils/xtables-addons/patches/001-fix-compile.patch
new file mode 100644
index 0000000000..e428a75cb1
--- /dev/null
+++ b/package/network/utils/xtables-addons/patches/001-fix-compile.patch
@@ -0,0 +1,11 @@ 
+--- a/extensions/xt_DNETMAP.c
++++ b/extensions/xt_DNETMAP.c
+@@ -377,7 +377,7 @@ dnetmap_tg(struct sk_buff *skb, const st
+ 	unsigned int hooknum = par->hooknum;
+ #endif
+ 
+-	NF_CT_ASSERT(hooknum == NF_INET_POST_ROUTING ||
++	WARN_ON(hooknum == NF_INET_POST_ROUTING ||
+ 		     hooknum == NF_INET_LOCAL_OUT ||
+ 		     hooknum == NF_INET_PRE_ROUTING);
+ 	ct = nf_ct_get(skb, &ctinfo);
diff --git a/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch b/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch
index 7599684bdb..a9fb796d09 100644
--- a/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch
+++ b/package/network/utils/xtables-addons/patches/201-fix-lua-packetscript.patch
@@ -1,5 +1,14 @@ 
 --- a/extensions/LUA/xt_LUA_target.c
 +++ b/extensions/LUA/xt_LUA_target.c
+@@ -19,7 +19,7 @@
+ #include <linux/kernel.h>
+ #include <linux/slab.h>
+ #include <linux/module.h>
+-#include <asm/uaccess.h>
++#include <linux/uaccess.h>
+ #include <net/ip.h>
+ #include <linux/netfilter/x_tables.h>
+ #include "xt_LUA.h"
 @@ -64,10 +64,10 @@ uint32_t  lua_state_refs[LUA_STATE_ARRAY
   * XT_CONTINUE inside the *register_lua_packet_lib* function.
   */