Xiaozhou Liu <lxz1983@xxxxxxxxx> wrote: > > + for (i = 0; i < attempts; ++off) { > > *portptr = htons(min + off % range_size); > > - if (++i != range_size && nf_nat_used_tuple(tuple, ct)) > > + if (nf_nat_used_tuple(tuple, ct)) > > continue; > > if (!(range->flags & (NF_NAT_RANGE_PROTO_RANDOM_ALL| > > NF_NAT_RANGE_PROTO_OFFSET))) > > *rover = off; > > return; > > } > > i never gets increased here so will it loop forever in the worst? good catch, i should be incremented in the loop. I will send a v2.