]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nat: remove l4 protocol port rovers
authorFlorian Westphal <fw@strlen.de>
Thu, 15 Nov 2018 09:22:59 +0000 (10:22 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 1 Dec 2018 11:38:42 +0000 (12:38 +0100)
commitb2a5e0d2cb419cdd460d96bef600b927f42f6446
treead0b549420d6aeb8380dcc7ac6d1bbc7015b39f6
parent4c2d00c89f113f21e9055506fdb9965a0e55c7e4
netfilter: nat: remove l4 protocol port rovers

This is a leftover from days where single-cpu systems were common:
Store last port used to resolve a clash to use it as a starting point when
the next conflict needs to be resolved.

When we have parallel attempt to connect to same address:port pair,
its likely that both cores end up computing the same "available" port,
as both use same starting port, and newly used ports won't become
visible to other cores until the conntrack gets confirmed later.

One of the cores then has to drop the packet at insertion time because
the chosen new tuple turns out to be in use after all.

Lets simplify this: remove port rover and use a pseudo-random starting
point.

Note that this doesn't make netfilter default to 'fully random' mode;
the 'rover' was only used if NAT could not reuse source port as-is.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_nat_l4proto.h
net/netfilter/nf_nat_proto_common.c
net/netfilter/nf_nat_proto_dccp.c
net/netfilter/nf_nat_proto_sctp.c
net/netfilter/nf_nat_proto_tcp.c
net/netfilter/nf_nat_proto_udp.c