Message ID | 20240214233818.7946-3-pablo@netfilter.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 0f1ae2821fa4b13ab0f5ad7ff89fa57efcb04fe0 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net,1/3] netfilter: nft_set_pipapo: fix missing : in kdoc | expand |
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c index c3d7ecbc777c..016c816d91cb 100644 --- a/net/netfilter/nf_nat_core.c +++ b/net/netfilter/nf_nat_core.c @@ -551,8 +551,11 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple, find_free_id: if (range->flags & NF_NAT_RANGE_PROTO_OFFSET) off = (ntohs(*keyptr) - ntohs(range->base_proto.all)); - else + else if ((range->flags & NF_NAT_RANGE_PROTO_RANDOM_ALL) || + maniptype != NF_NAT_MANIP_DST) off = get_random_u16(); + else + off = 0; attempts = range_size; if (attempts > NF_NAT_MAX_ATTEMPTS)