netfilter: only warn once on wrong seqadj usage
Subsystems (4)
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
@@ -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 ; }
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)Suggested-by Flavio Leitner <[email protected]>Suggested-by Daniel Borkmann <[email protected]>Suggested-by Florian Westphal <[email protected]>Signed-off-by Jesper Dangaard Brouer <[email protected]>---
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
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?
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)Suggested-by Flavio Leitner <[email protected]>Suggested-by Daniel Borkmann <[email protected]>Suggested-by Florian Westphal <[email protected]>Signed-off-by Jesper Dangaard Brouer <[email protected]>---
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@@ -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
-1if (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
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)Suggested-by Flavio Leitner <[email protected]>Suggested-by Daniel Borkmann <[email protected]>Suggested-by Florian Westphal <[email protected]>Signed-off-by Jesper Dangaard Brouer <[email protected]>
Applied, thanks Jesper.