[PATCH 2/2 nf-next] netfilter: seqadj: print the warning log when fail to add seqadj extension

Subsystems: netfilter, networking [general], the rest

STALE3697d

2 messages, 2 authors, 2016-09-02 · open the first message on its own page

[PATCH 2/2 nf-next] netfilter: seqadj: print the warning log when fail to add seqadj extension

From: <hidden>
Date: 2016-09-02 01:50:36

From: Gao Feng <redacted>

Print the warning log when fail to add seqadj extension like
nf_ct_acct_ext_add does. It could be helpful to find the problem.

Signed-off-by: Gao Feng <redacted>
---
 include/net/netfilter/nf_conntrack_seqadj.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/net/netfilter/nf_conntrack_seqadj.h b/include/net/netfilter/nf_conntrack_seqadj.h
index 4b33629..d548b9c 100644
--- a/include/net/netfilter/nf_conntrack_seqadj.h
+++ b/include/net/netfilter/nf_conntrack_seqadj.h
@@ -27,7 +27,13 @@ static inline struct nf_conn_seqadj *nfct_seqadj(const struct nf_conn *ct)
 
 static inline struct nf_conn_seqadj *nfct_seqadj_ext_add(struct nf_conn *ct)
 {
-	return nf_ct_ext_add(ct, NF_CT_EXT_SEQADJ, GFP_ATOMIC);
+	struct nf_conn_seqadj *seqadj = nf_ct_ext_add(ct, NF_CT_EXT_SEQADJ,
+						      GFP_ATOMIC);
+
+	if (!seqadj)
+		pr_warn("failed to add seqadj extension area");
+
+	return seqadj;
 }
 
 int nf_ct_seqadj_init(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
-- 
1.9.1

Re: [PATCH 2/2 nf-next] netfilter: seqadj: print the warning log when fail to add seqadj extension

From: Florian Westphal <fw@strlen.de>
Date: 2016-09-02 06:54:45

fgao@ikuai8.com [off-list ref] wrote:
From: Gao Feng <redacted>

Print the warning log when fail to add seqadj extension like
nf_ct_acct_ext_add does. It could be helpful to find the problem.
Failure to add ext area means that we're pretty much completely out
of memory.  There is nothing the user could do, so pr_warn (or any other
log level ...) is not really helpful.

Besides, memory subsystem will already print diagnostic information in
that case.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help