diff mbox series

[nf-next] netfilter: nat: remove unnecessary 'else if' branch

Message ID 20181205155015.91964-1-liuxiaozhou@bytedance.com
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nf-next] netfilter: nat: remove unnecessary 'else if' branch | expand

Commit Message

Xiaozhou Liu Dec. 5, 2018, 3:50 p.m. UTC
Since a pseudo-random starting point is used in finding a port in
the default case, that 'else if' branch above is no longer a necessity.
So remove it to simplify code.

Signed-off-by: Xiaozhou Liu <liuxiaozhou@bytedance.com>
---
 net/netfilter/nf_nat_proto_common.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Pablo Neira Ayuso Dec. 17, 2018, 10:40 p.m. UTC | #1
On Wed, Dec 05, 2018 at 11:50:15PM +0800, Xiaozhou Liu wrote:
> Since a pseudo-random starting point is used in finding a port in
> the default case, that 'else if' branch above is no longer a necessity.
> So remove it to simplify code.

Applied, thanks.
diff mbox series

Patch

diff --git a/net/netfilter/nf_nat_proto_common.c b/net/netfilter/nf_nat_proto_common.c
index a7de939fa5a9..136ab65c4082 100644
--- a/net/netfilter/nf_nat_proto_common.c
+++ b/net/netfilter/nf_nat_proto_common.c
@@ -80,8 +80,6 @@  void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto,
 		off = l3proto->secure_port(tuple, maniptype == NF_NAT_MANIP_SRC
 						  ? tuple->dst.u.all
 						  : tuple->src.u.all);
-	} else if (range->flags & NF_NAT_RANGE_PROTO_RANDOM_FULLY) {
-		off = prandom_u32();
 	} else if (range->flags & NF_NAT_RANGE_PROTO_OFFSET) {
 		off = (ntohs(*portptr) - ntohs(range->base_proto.all));
 	} else {