2020447 IPFilter's NAT can undo name server random port selection

(fix output port range, was a random number in [0,max-min]
	 (byteswapped on litle endian), instead of [min,max])

Submitted by:	darrenr
This commit is contained in:
Darren Reed 2008-07-26 19:46:00 +00:00
parent f1345f5393
commit 14fbef0c79

View File

@ -2033,11 +2033,13 @@ natinfo_t *ni;
* Standard port translation. Select next port.
*/
if (np->in_flags & IPN_SEQUENTIAL) {
port = htons(np->in_pnext);
port = np->in_pnext;
} else {
port = ipf_random() % (ntohs(np->in_pmax) -
ntohs(np->in_pmin));
port += ntohs(np->in_pmin);
}
port = htons(port);
np->in_pnext++;
if (np->in_pnext > ntohs(np->in_pmax)) {