Skip to contentSkip to conversation

netfilter: only warn once on wrong seqadj usage

PATCH Applied Jesper Dangaard Brouer 3 participants 4 messages Jan 4, 2014 – Jan 6, 2014

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

PATCH 1/1 netfilter: only warn once on wrong seqadj usage

Avoid potentially spamming the kernel log with WARN splash messages when catching wrong usage of seqadj, by simply using WARN_ONCE.

This is a followup to commit db12cf274353 (netfilter: WARN about wrong usage of sequence number adjustments)

---
Nitpick found by internal RedHat review process ;-)

 net/netfilter/nf_conntrack_seqadj.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/netfilter/nf_conntrack_seqadj.c +1 -1
index b2d38da..f6e2ae9 100644
@@ -37,7 +37,7 @@ int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
 		return 0;
 
 	if (unlikely(!seqadj)) {
-		WARN(1, "Wrong seqadj usage, missing nfct_seqadj_ext_add()\n");
+		WARN_ONCE(1, "Missing nfct_seqadj_ext_add() setup call\n");
 		return 0;
 	}
 
#1 lore raw
Quoted 21 lines · Jesper Dangaard Brouer

Avoid potentially spamming the kernel log with WARN splash messages when catching wrong usage of seqadj, by simply using WARN_ONCE.

This is a followup to commit db12cf274353 (netfilter: WARN about wrong usage of sequence number adjustments)

---
Nitpick found by internal RedHat review process ;-)

 net/netfilter/nf_conntrack_seqadj.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/netfilter/nf_conntrack_seqadj.c +0 -0
index b2d38da..f6e2ae9 100644

net/netfilter/nf_conntrack_seqadj.c int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo, · line 41

Quoted 6 lines
net/netfilter/nf_conntrack_seqadj.c +1 -1
@@ -37,7 +37,7 @@ int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
 		return 0;
 
 	if (unlikely(!seqadj)) {
-		WARN(1, "Wrong seqadj usage, missing nfct_seqadj_ext_add()\n");
+		WARN_ONCE(1, "Missing nfct_seqadj_ext_add() setup call\n");
 		return 0;

I missed the patch that added the WARN. Since when do we add runtime checks for API misuse instead of simply letting it crash?

#2 lore raw
Quoted 24 lines · On Sat, 4 Jan 2014 13:16:48 +0000 Patrick McHardy <[email protected]> wrote:
Quoted 23 lines · Jesper Dangaard Brouer

Avoid potentially spamming the kernel log with WARN splash messages when catching wrong usage of seqadj, by simply using WARN_ONCE.

This is a followup to commit db12cf274353 (netfilter: WARN about wrong usage of sequence number adjustments)

---
Nitpick found by internal RedHat review process ;-)

 net/netfilter/nf_conntrack_seqadj.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/netfilter/nf_conntrack_seqadj.c +0 -0
index b2d38da..f6e2ae9 100644
@@ -37,7 +37,7 @@ int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
 		return 0;
 
Quoted 7 lines

net/netfilter/nf_conntrack_seqadj.c int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo, · line 41

Quoted 4 lines
net/netfilter/nf_conntrack_seqadj.c +1 -1
 	if (unlikely(!seqadj)) {
-		WARN(1, "Wrong seqadj usage, missing nfct_seqadj_ext_add()\n");
+		WARN_ONCE(1, "Missing nfct_seqadj_ext_add() setup call\n");
 		return 0;

I missed the patch that added the WARN. Since when do we add runtime checks for API misuse instead of simply letting it crash?

We changed an existing API which broke IPVS. And I think we still have a use-case in IPVS, which can hit this case/bug, thus I added a stack dump warning (instead of crashing), so I can catch this use-case and fix it later.

Signature · 5 lines
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Sr. Network Kernel Developer at Red Hat
  Author of http://www.iptv-analyzer.org
  LinkedIn: http://www.linkedin.com/in/brouer
maintainer Applied
#3 lore raw
In reply to Jesper Dangaard Brouer
Quoted 10 lines · Jesper Dangaard Brouer

Avoid potentially spamming the kernel log with WARN splash messages when catching wrong usage of seqadj, by simply using WARN_ONCE.

This is a followup to commit db12cf274353 (netfilter: WARN about wrong usage of sequence number adjustments)

Applied, thanks Jesper.