Skip to content

Commit

Permalink
netfilter: WARN about wrong usage of sequence number adjustments
Browse files Browse the repository at this point in the history
Since commit 41d73ec (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: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
  • Loading branch information
Jesper Dangaard Brouer authored and Simon Horman committed Dec 27, 2013
1 parent 443d20f commit db12cf2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/netfilter/nf_conntrack_seqadj.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
if (off == 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);

spin_lock_bh(&ct->lock);
Expand Down

0 comments on commit db12cf2

Please sign in to comment.