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

(-)b/sys/netpfil/pf/pf.c (-2 lines)
Lines 3521-3528 pf_create_state(struct pf_rule *r, struct pf_rule *nr, struct pf_rule *a, Link Here
3521
	}
3521
	}
3522
3522
3523
	if (r->rt && r->rt != PF_FASTROUTE) {
3523
	if (r->rt && r->rt != PF_FASTROUTE) {
3524
		struct pf_src_node *sn = NULL;
3525
3526
		if (pf_map_addr(pd->af, r, pd->src, &s->rt_addr, NULL, &sn)) {
3524
		if (pf_map_addr(pd->af, r, pd->src, &s->rt_addr, NULL, &sn)) {
3527
			REASON_SET(&reason, PFRES_MAPFAILED);
3525
			REASON_SET(&reason, PFRES_MAPFAILED);
3528
			pf_src_tree_remove_state(s);
3526
			pf_src_tree_remove_state(s);
(-)b/sys/netpfil/pf/pf_lb.c (-10 / +19 lines)
Lines 307-328 pf_map_addr(sa_family_t af, struct pf_rule *r, struct pf_addr *saddr, Link Here
307
	struct pf_pool		*rpool = &r->rpool;
307
	struct pf_pool		*rpool = &r->rpool;
308
	struct pf_addr		*raddr = NULL, *rmask = NULL;
308
	struct pf_addr		*raddr = NULL, *rmask = NULL;
309
309
310
	/* Try to find a src_node if none was given and this
311
	   is a sticky-address rule. */
310
	if (*sn == NULL && r->rpool.opts & PF_POOL_STICKYADDR &&
312
	if (*sn == NULL && r->rpool.opts & PF_POOL_STICKYADDR &&
311
	    (r->rpool.opts & PF_POOL_TYPEMASK) != PF_POOL_NONE) {
313
	    (r->rpool.opts & PF_POOL_TYPEMASK) != PF_POOL_NONE) {
312
		*sn = pf_find_src_node(saddr, r, af, 0);
314
		*sn = pf_find_src_node(saddr, r, af, 0);
313
		if (*sn != NULL && !PF_AZERO(&(*sn)->raddr, af)) {
315
	}
314
			PF_ACPY(naddr, &(*sn)->raddr, af);
316
315
			if (V_pf_status.debug >= PF_DEBUG_MISC) {
317
	/* If a src_node was found or explicitly given and it has a non-zero
316
				printf("pf_map_addr: src tracking maps ");
318
	   route address, use this address. A zeroed address is found if the
317
				pf_print_host(saddr, 0, af);
319
	   src node was created just a moment ago in pf_create_state and it
318
				printf(" to ");
320
	   needs to be filled in with routing decission calculated here. */
319
				pf_print_host(naddr, 0, af);
321
	if (*sn != NULL && !PF_AZERO(&(*sn)->raddr, af)) {
320
				printf("\n");
322
		PF_ACPY(naddr, &(*sn)->raddr, af);
321
			}
323
		if (V_pf_status.debug >= PF_DEBUG_MISC) {
322
			return (0);
324
			printf("pf_map_addr: src tracking maps ");
325
			pf_print_host(saddr, 0, af);
326
			printf(" to ");
327
			pf_print_host(naddr, 0, af);
328
			printf("\n");
323
		}
329
		}
330
		return (0);
324
	}
331
	}
325
332
333
	/* Find the route using chosen algorithm. Store the found route
334
	   in src_node if it was given or found. */
326
	if (rpool->cur->addr.type == PF_ADDR_NOROUTE)
335
	if (rpool->cur->addr.type == PF_ADDR_NOROUTE)
327
		return (1);
336
		return (1);
328
	if (rpool->cur->addr.type == PF_ADDR_DYNIFTL) {
337
	if (rpool->cur->addr.type == PF_ADDR_DYNIFTL) {

Return to bug 184003