netfilter: nat: remove unnecessary 'else if' branch
authorXiaozhou Liu <liuxiaozhou@bytedance.com>
Wed, 5 Dec 2018 15:50:15 +0000 (23:50 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 17 Dec 2018 22:31:03 +0000 (23:31 +0100)
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>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_nat_proto_common.c

index a7de939fa5a940c93b66bbc036324fd943b9743b..136ab65c40824138e163aef6bf26baa6473371c7 100644 (file)
@@ -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 {