Skip to contentSkip to conversation

linux-next: manual merge of the net-next tree with the net tree

PATCH Superseded Stephen Rothwell 4 participants 12 messages Mar 23, 2015 – Mar 25, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hi all,

Today's linux-next merge of the net-next tree got a conflict in net/netfilter/nf_tables_core.c between commit 4017a7ee693d ("netfilter:
restore rule tracing via nfnetlink_log") from the net tree and commit 01ef16c2dd2e ("netfilter: nf_tables: minor tracing cleanups") from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary (no action is required).

Signature · 60 lines
Cheers,
Stephen Rothwell                    [email protected]

diff --cc net/netfilter/nf_tables_core.c
index 2d298dccb6dd,77165bf023f3..000000000000
--- a/net/netfilter/nf_tables_core.c
+++ b/net/netfilter/nf_tables_core.c
@@@ -21,6 -21,48 +21,48 @@@
  #include <net/netfilter/nf_tables.h>
  #include <net/netfilter/nf_log.h>
  
+ enum nft_trace {
+ 	NFT_TRACE_RULE,
+ 	NFT_TRACE_RETURN,
+ 	NFT_TRACE_POLICY,
+ };
+ 
+ static const char *const comments[] = {
+ 	[NFT_TRACE_RULE]	= "rule",
+ 	[NFT_TRACE_RETURN]	= "return",
+ 	[NFT_TRACE_POLICY]	= "policy",
+ };
+ 
+ static struct nf_loginfo trace_loginfo = {
+ 	.type = NF_LOG_TYPE_LOG,
+ 	.u = {
+ 		.log = {
+ 			.level = 4,
+ 			.logflags = NF_LOG_MASK,
+ 	        },
+ 	},
+ };
+ 
+ static void __nft_trace_packet(const struct nft_pktinfo *pkt,
+ 			       const struct nft_chain *chain,
+ 			       int rulenum, enum nft_trace type)
+ {
+ 	struct net *net = dev_net(pkt->in ? pkt->in : pkt->out);
+ 
 -	nf_log_packet(net, pkt->xt.family, pkt->ops->hooknum, pkt->skb, pkt->in,
 -		      pkt->out, &trace_loginfo, "TRACE: %s:%s:%s:%u ",
 -		      chain->table->name, chain->name, comments[type],
 -		      rulenum);
++	nf_log_trace(net, pkt->xt.family, pkt->ops->hooknum, pkt->skb, pkt->in,
++		     pkt->out, &trace_loginfo, "TRACE: %s:%s:%s:%u ",
++		     chain->table->name, chain->name, comments[type],
++		     rulenum);
+ }
+ 
+ static inline void nft_trace_packet(const struct nft_pktinfo *pkt,
+ 				    const struct nft_chain *chain,
+ 				    int rulenum, enum nft_trace type)
+ {
+ 	if (unlikely(pkt->skb->nf_trace))
+ 		__nft_trace_packet(pkt, chain, rulenum, type);
+ }
+ 
  static void nft_cmp_fast_eval(const struct nft_expr *expr,
  			      struct nft_data data[NFT_REG_MAX + 1])
  {
#1 lore raw
Quoted 10 lines · Stephen Rothwell

Hi all,

Today's linux-next merge of the net-next tree got a conflict in net/netfilter/nf_tables_core.c between commit 4017a7ee693d ("netfilter:
restore rule tracing via nfnetlink_log") from the net tree and commit 01ef16c2dd2e ("netfilter: nf_tables: minor tracing cleanups") from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary (no action is required).

This looks good, thanks for adressing this conflict Stephen.

Quoted 61 lines
Signature · 2 lines
Cheers,
Stephen Rothwell                    [email protected]
net/netfilter/nf_tables_core.c +42 -0
diff --cc net/netfilter/nf_tables_core.c
index 2d298dccb6dd,77165bf023f3..000000000000
@@@ -21,6 -21,48 +21,48 @@@
  #include <net/netfilter/nf_tables.h>
  #include <net/netfilter/nf_log.h>
 
+ enum nft_trace {
+ 	NFT_TRACE_RULE,
+ 	NFT_TRACE_RETURN,
+ 	NFT_TRACE_POLICY,
+ };
+ 
+ static const char *const comments[] = {
+ 	[NFT_TRACE_RULE]	= "rule",
+ 	[NFT_TRACE_RETURN]	= "return",
+ 	[NFT_TRACE_POLICY]	= "policy",
+ };
+ 
+ static struct nf_loginfo trace_loginfo = {
+ 	.type = NF_LOG_TYPE_LOG,
+ 	.u = {
+ 		.log = {
+ 			.level = 4,
+ 			.logflags = NF_LOG_MASK,
+ 	        },
+ 	},
+ };
+ 
+ static void __nft_trace_packet(const struct nft_pktinfo *pkt,
+ 			       const struct nft_chain *chain,
+ 			       int rulenum, enum nft_trace type)
+ {
+ 	struct net *net = dev_net(pkt->in ? pkt->in : pkt->out);
+ 
 -	nf_log_packet(net, pkt->xt.family, pkt->ops->hooknum, pkt->skb, pkt->in,
 -		      pkt->out, &trace_loginfo, "TRACE: %s:%s:%s:%u ",
 -		      chain->table->name, chain->name, comments[type],
 -		      rulenum);
++	nf_log_trace(net, pkt->xt.family, pkt->ops->hooknum, pkt->skb, pkt->in,
++		     pkt->out, &trace_loginfo, "TRACE: %s:%s:%s:%u ",
++		     chain->table->name, chain->name, comments[type],
++		     rulenum);
+ }
+ 
+ static inline void nft_trace_packet(const struct nft_pktinfo *pkt,
+ 				    const struct nft_chain *chain,
+ 				    int rulenum, enum nft_trace type)
+ {
+ 	if (unlikely(pkt->skb->nf_trace))
+ 		__nft_trace_packet(pkt, chain, rulenum, type);
+ }
+ 
  static void nft_cmp_fast_eval(const struct nft_expr *expr,
  			      struct nft_data data[NFT_REG_MAX + 1])
  {
#2 lore raw
Quoted 11 lines · Pablo Neira Ayuso
Quoted 8 lines · Stephen Rothwell

Today's linux-next merge of the net-next tree got a conflict in net/netfilter/nf_tables_core.c between commit 4017a7ee693d ("netfilter:
restore rule tracing via nfnetlink_log") from the net tree and commit 01ef16c2dd2e ("netfilter: nf_tables: minor tracing cleanups") from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary (no action is required).

"
This looks good, thanks for adressing this conflict Stephen.

trivia:

Quoted 1 line

net/netfilter/nf_tables_core.c

Quoted 1 line
net/netfilter/nf_tables_core.c +0 -0
diff --cc net/netfilter/nf_tables_core.c

[]

Quoted 5 lines

net/netfilter/nf_tables_core.c

Quoted 5 lines

+ static struct nf_loginfo trace_loginfo = {

net/netfilter/nf_tables_core.c +4 -0
+ 	.type = NF_LOG_TYPE_LOG,
+ 	.u = {
+ 		.log = {
+ 			.level = 4,

Perhaps all the .level = 4 uses should be LOGLEVEL_WARNING and .level = 5 should be LOGLEVEL_NOTICE

#3 lore raw
Quoted 17 lines · Joe Perches
Quoted 11 lines · Pablo Neira Ayuso
Quoted 8 lines · Stephen Rothwell

Today's linux-next merge of the net-next tree got a conflict in net/netfilter/nf_tables_core.c between commit 4017a7ee693d ("netfilter:
restore rule tracing via nfnetlink_log") from the net tree and commit 01ef16c2dd2e ("netfilter: nf_tables: minor tracing cleanups") from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary (no action is required).

"
This looks good, thanks for adressing this conflict Stephen.

trivia:

Quoted 1 line

net/netfilter/nf_tables_core.c

Quoted 1 line
net/netfilter/nf_tables_core.c +0 -0
diff --cc net/netfilter/nf_tables_core.c

[]

Quoted 8 lines
Quoted 5 lines

net/netfilter/nf_tables_core.c

Quoted 5 lines

+ static struct nf_loginfo trace_loginfo = {

net/netfilter/nf_tables_core.c +4 -0
+ 	.type = NF_LOG_TYPE_LOG,
+ 	.u = {
+ 		.log = {
+ 			.level = 4,

Perhaps all the .level = 4 uses should be LOGLEVEL_WARNING and .level = 5 should be LOGLEVEL_NOTICE

Yes, we can push a follow up patch to net-next changing all these spots in the netfilter tree. Would you send a patch for this?

Thanks.

#4 lore raw

PATCH 1/1 netfilter: Use LOGLEVEL_<FOO> defines

Use the #defines where appropriate.

---

Quoted 5 lines
Quoted 2 lines

Perhaps all the .level = 4 uses should be LOGLEVEL_WARNING and .level = 5 should be LOGLEVEL_NOTICE

Yes, we can push a follow up patch to net-next changing all these spots in the netfilter tree. Would you send a patch for this?

There are indirect includes of kern_levels.h but there are a lot of indirect includes of kernel.h in netfilter

 net/ipv4/netfilter/nf_log_arp.c  | 2 +-
 net/ipv4/netfilter/nf_log_ipv4.c | 2 +-
 net/ipv6/netfilter/ip6_tables.c  | 2 +-
 net/ipv6/netfilter/nf_log_ipv6.c | 2 +-
 net/netfilter/nf_tables_core.c   | 2 +-
 net/netfilter/nft_log.c          | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
net/ipv4/netfilter/nf_log_arp.c +1 -1
index d059182..1fe8d62 100644
@@ -27,7 +27,7 @@ static struct nf_loginfo default_loginfo = {
 	.type	= NF_LOG_TYPE_LOG,
 	.u = {
 		.log = {
-			.level	  = 5,
+			.level	  = LOGLEVEL_NOTICE,
 			.logflags = NF_LOG_MASK,
 		},
 	},
net/ipv4/netfilter/nf_log_ipv4.c +1 -1
index 7510198..1e0ad92 100644
@@ -26,7 +26,7 @@ static struct nf_loginfo default_loginfo = {
 	.type	= NF_LOG_TYPE_LOG,
 	.u = {
 		.log = {
-			.level	  = 5,
+			.level	  = LOGLEVEL_NOTICE,
 			.logflags = NF_LOG_MASK,
 		},
 	},
net/ipv6/netfilter/ip6_tables.c +1 -1
index bb00c6f..0784cec 100644
@@ -234,7 +234,7 @@ static struct nf_loginfo trace_loginfo = {
 	.type = NF_LOG_TYPE_LOG,
 	.u = {
 		.log = {
-			.level = 4,
+			.level = LOGLEVEL_WARNING,
 			.logflags = NF_LOG_MASK,
 		},
 	},
net/ipv6/netfilter/nf_log_ipv6.c +1 -1
index ddf07e6..b57a784 100644
@@ -27,7 +27,7 @@ static struct nf_loginfo default_loginfo = {
 	.type	= NF_LOG_TYPE_LOG,
 	.u = {
 		.log = {
-			.level	  = 5,
+			.level	  = LOGLEVEL_NOTICE,
 			.logflags = NF_LOG_MASK,
 		},
 	},
net/netfilter/nf_tables_core.c +1 -1
index 9a9e874..0a45e6b 100644
@@ -37,7 +37,7 @@ static struct nf_loginfo trace_loginfo = {
 	.type = NF_LOG_TYPE_LOG,
 	.u = {
 		.log = {
-			.level = 4,
+			.level = LOGLEVEL_WARNING,
 			.logflags = NF_LOG_MASK,
 	        },
 	},
net/netfilter/nft_log.c +1 -1
index bde05f28..e18af9db 100644
@@ -78,7 +78,7 @@ static int nft_log_init(const struct nft_ctx *ctx,
 			li->u.log.level =
 				ntohl(nla_get_be32(tb[NFTA_LOG_LEVEL]));
 		} else {
-			li->u.log.level = 4;
+			li->u.log.level = LOGLEVEL_WARNING;
 		}
 		if (tb[NFTA_LOG_FLAGS] != NULL) {
 			li->u.log.logflags =
#5 lore raw

Re: [PATCH -next] netfilter: Use LOGLEVEL_<FOO> defines

Hi Joe,

Quoted 5 lines · On Mon, 23 Mar 2015 06:23:51 -0700 Joe Perches <[email protected]> wrote:

Use the #defines where appropriate.

---

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Perhaps all the .level = 4 uses should be LOGLEVEL_WARNING and .level = 5 should be LOGLEVEL_NOTICE

Yes, we can push a follow up patch to net-next changing all these spots in the netfilter tree. Would you send a patch for this?

There are indirect includes of kern_levels.h but there are a lot of indirect includes of kernel.h in netfilter

I am not sure what you are getting at here. kernel.h does not include kern_levels.h (but printk.h does). I, for one, am always happier when necessary include files are explicitly included.

Signature · 2 lines
Cheers,
Stephen Rothwell                    [email protected]
#6 lore raw

Re: [PATCH -next] netfilter: Use LOGLEVEL_<FOO> defines

Quoted 14 lines · Stephen Rothwell

Hi Joe,

Quoted 11 lines · On Mon, 23 Mar 2015 06:23:51 -0700 Joe Perches <[email protected]> wrote:

Use the #defines where appropriate.

---

Quoted 5 lines
Quoted 2 lines

Perhaps all the .level = 4 uses should be LOGLEVEL_WARNING and .level = 5 should be LOGLEVEL_NOTICE

Yes, we can push a follow up patch to net-next changing all these spots in the netfilter tree. Would you send a patch for this?

Quoted 6 lines
Quoted 2 lines

There are indirect includes of kern_levels.h but there are a lot of indirect includes of kernel.h in netfilter

I am not sure what you are getting at here. kernel.h does not include kern_levels.h (but printk.h does). I, for one, am always happier when necessary include files are explicitly included.

I would also prefer if you include the explicit header files in that patch too. Could you send us a v2? Please, Cc:
[email protected]

Thanks.

#7 lore raw

Re: [PATCH -next] netfilter: Use LOGLEVEL_<FOO> defines

Quoted 3 lines · Pablo Neira Ayuso

I would also prefer if you include the explicit header files in that patch too. Could you send us a v2? Please, Cc:
[email protected]

As I wrote to Stephen, I'd prefer to #include
kernel.h where it's not already specified.

net/netfilter/nft_log.c does, every other
modified file doesn't.

Is that OK with you?

#8 lore raw

PATCH v2 1/1 netfilter: Use LOGLEVEL_<FOO> defines

In reply to Pablo Neira Ayuso

Use the #defines where appropriate.

Miscellanea:

Add explicit #include <linux/kernel.h> where it was not previously used so that these #defines are a bit more explicitly defined instead of indirectly included via:

	module.h->moduleparam.h->kernel.h

---

I really don't want to get into unwinding all the various #include dependencies. kernel.h is pretty generic and effectively used throughout the tree to centralize various #includes.

 net/ipv4/netfilter/nf_log_arp.c  | 4 +++-
 net/ipv4/netfilter/nf_log_ipv4.c | 4 +++-
 net/ipv6/netfilter/ip6_tables.c  | 5 ++++-
 net/ipv6/netfilter/nf_log_ipv6.c | 4 +++-
 net/netfilter/nf_tables_core.c   | 3 ++-
 net/netfilter/nft_log.c          | 2 +-
 6 files changed, 16 insertions(+), 6 deletions(-)
net/ipv4/netfilter/nf_log_arp.c +3 -1
index d059182..e7ad950 100644
@@ -10,8 +10,10 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <linux/skbuff.h>
@@ -27,7 +29,7 @@ static struct nf_loginfo default_loginfo = {
 	.type	= NF_LOG_TYPE_LOG,
 	.u = {
 		.log = {
-			.level	  = 5,
+			.level	  = LOGLEVEL_NOTICE,
 			.logflags = NF_LOG_MASK,
 		},
 	},
net/ipv4/netfilter/nf_log_ipv4.c +3 -1
index 7510198..076aadd 100644
@@ -5,8 +5,10 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <linux/skbuff.h>
@@ -26,7 +28,7 @@ static struct nf_loginfo default_loginfo = {
 	.type	= NF_LOG_TYPE_LOG,
 	.u = {
 		.log = {
-			.level	  = 5,
+			.level	  = LOGLEVEL_NOTICE,
 			.logflags = NF_LOG_MASK,
 		},
 	},
net/ipv6/netfilter/ip6_tables.c +4 -1
index bb00c6f..83f59dc 100644
@@ -9,7 +9,10 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/kernel.h>
 #include <linux/capability.h>
 #include <linux/in.h>
 #include <linux/skbuff.h>
@@ -234,7 +237,7 @@ static struct nf_loginfo trace_loginfo = {
 	.type = NF_LOG_TYPE_LOG,
 	.u = {
 		.log = {
-			.level = 4,
+			.level = LOGLEVEL_WARNING,
 			.logflags = NF_LOG_MASK,
 		},
 	},
net/ipv6/netfilter/nf_log_ipv6.c +3 -1
index ddf07e6..8dd8696 100644
@@ -5,8 +5,10 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <linux/skbuff.h>
@@ -27,7 +29,7 @@ static struct nf_loginfo default_loginfo = {
 	.type	= NF_LOG_TYPE_LOG,
 	.u = {
 		.log = {
-			.level	  = 5,
+			.level	  = LOGLEVEL_NOTICE,
 			.logflags = NF_LOG_MASK,
 		},
 	},
net/netfilter/nf_tables_core.c +2 -1
index 9a9e874..174e1f5 100644
@@ -8,6 +8,7 @@
  * Development of this code funded by Astaro AG (http://www.astaro.com/)
  */
 
+#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/list.h>
@@ -37,7 +38,7 @@ static struct nf_loginfo trace_loginfo = {
 	.type = NF_LOG_TYPE_LOG,
 	.u = {
 		.log = {
-			.level = 4,
+			.level = LOGLEVEL_WARNING,
 			.logflags = NF_LOG_MASK,
 	        },
 	},
net/netfilter/nft_log.c +1 -1
index bde05f28..e18af9db 100644
@@ -78,7 +78,7 @@ static int nft_log_init(const struct nft_ctx *ctx,
 			li->u.log.level =
 				ntohl(nla_get_be32(tb[NFTA_LOG_LEVEL]));
 		} else {
-			li->u.log.level = 4;
+			li->u.log.level = LOGLEVEL_WARNING;
 		}
 		if (tb[NFTA_LOG_FLAGS] != NULL) {
 			li->u.log.logflags =
maintainer Applied
#9 lore raw

Re: [PATCH V2 -next] netfilter: Use LOGLEVEL_<FOO> defines

Quoted 8 lines · Joe Perches

Use the #defines where appropriate.

Miscellanea:

Add explicit #include <linux/kernel.h> where it was not previously used so that these #defines are a bit more explicitly defined instead of indirectly included via:

	module.h->moduleparam.h->kernel.h

Applied, thanks.

#10 lore raw

Re: [PATCH -next] netfilter: Use LOGLEVEL_<FOO> defines

In reply to Stephen Rothwell
Quoted 1 line · Stephen Rothwell

Hi Joe,

Hi Stephen.

Quoted 3 lines

I am not sure what you are getting at here. kernel.h does not include kern_levels.h (but printk.h does). I, for one, am always happier when necessary include files are explicitly included.

kernel.h -> printk.h -> kern_levels.h

No .c file in the tree does a specific #include
of kern_levels.h, only a couple of .S files.

Adding printk.h might be useful, but I think
that kernel.h is probably better.

maintainer
#11 lore raw
In reply to Pablo Neira Ayuso

From: Pablo Neira Ayuso <[email protected]>
Date: Mon, 23 Mar 2015 13:47:23 +0100

Quoted 9 lines · Stephen Rothwell
Quoted 8 lines

Hi all,

Today's linux-next merge of the net-next tree got a conflict in net/netfilter/nf_tables_core.c between commit 4017a7ee693d ("netfilter:
restore rule tracing via nfnetlink_log") from the net tree and commit 01ef16c2dd2e ("netfilter: nf_tables: minor tracing cleanups") from the net-next tree.

Quoted 4 lines
Quoted 2 lines

I fixed it up (see below) and can carry the fix as necessary (no action is required).

This looks good, thanks for adressing this conflict Stephen.

Pablo, I just pushed out a merge of net into net-next, please double check that I handled this conflict correctly.

Thanks!