Commit b635cbf6 authored by Xiaozhou Liu's avatar Xiaozhou Liu Committed by Pablo Neira Ayuso

netfilter: nat: remove unnecessary 'else if' branch

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: default avatarXiaozhou Liu <liuxiaozhou@bytedance.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 00ec3ab0
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment