View | Details | Raw Unified | Return to bug 221201
Collapse All | Expand All

(-)b/sys/netpfil/pf/pf_lb.c (-4 / +5 lines)
Lines 259-265 pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_rule *r, Link Here
259
				return (0);
259
				return (0);
260
			}
260
			}
261
		} else {
261
		} else {
262
			uint16_t tmp, cut;
262
			uint32_t tmp;
263
			uint16_t cut;
263
264
264
			if (low > high) {
265
			if (low > high) {
265
				tmp = low;
266
				tmp = low;
Lines 269-275 pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_rule *r, Link Here
269
			/* low < high */
270
			/* low < high */
270
			cut = arc4random() % (1 + high - low) + low;
271
			cut = arc4random() % (1 + high - low) + low;
271
			/* low <= cut <= high */
272
			/* low <= cut <= high */
272
			for (tmp = cut; tmp <= high; ++(tmp)) {
273
			for (tmp = cut; tmp <= high && tmp <= 0xffff; ++tmp) {
273
				key.port[1] = htons(tmp);
274
				key.port[1] = htons(tmp);
274
				if (pf_find_state_all(&key, PF_IN, NULL) ==
275
				if (pf_find_state_all(&key, PF_IN, NULL) ==
275
				    NULL) {
276
				    NULL) {
Lines 277-283 pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_rule *r, Link Here
277
					return (0);
278
					return (0);
278
				}
279
				}
279
			}
280
			}
280
			for (tmp = cut - 1; tmp >= low; --(tmp)) {
281
			tmp = cut;
282
			for (tmp -= 1; tmp >= low && tmp <= 0xffff; --tmp) {
281
				key.port[1] = htons(tmp);
283
				key.port[1] = htons(tmp);
282
				if (pf_find_state_all(&key, PF_IN, NULL) ==
284
				if (pf_find_state_all(&key, PF_IN, NULL) ==
283
				    NULL) {
285
				    NULL) {
284
- 

Return to bug 221201