提交 db12cf27 编写于 作者: J Jesper Dangaard Brouer 提交者: Simon Horman

netfilter: WARN about wrong usage of sequence number adjustments

Since commit 41d73ec0 (netfilter: nf_conntrack: make sequence
number adjustments usuable without NAT), the sequence number extension
is dynamically allocated.

Instead of dying, give a WARN splash, in case of wrong usage of the
seqadj code, e.g. when forgetting to allocate via nfct_seqadj_ext_add().

Wrong usage have been seen in the IPVS code path.
Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
Acked-by: NJulian Anastasov <ja@ssi.bg>
Signed-off-by: NSimon Horman <horms@verge.net.au>
上级 443d20fd
...@@ -36,6 +36,11 @@ int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo, ...@@ -36,6 +36,11 @@ int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
if (off == 0) if (off == 0)
return 0; return 0;
if (unlikely(!seqadj)) {
WARN(1, "Wrong seqadj usage, missing nfct_seqadj_ext_add()\n");
return 0;
}
set_bit(IPS_SEQ_ADJUST_BIT, &ct->status); set_bit(IPS_SEQ_ADJUST_BIT, &ct->status);
spin_lock_bh(&ct->lock); spin_lock_bh(&ct->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册