View | Details | Raw Unified | Return to bug 229092 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/netpfil/pf/if_pfsync.c (-1 / +13 lines)
Lines 504-537 pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) Link Here
504
		uint32_t timeout;
504
		uint32_t timeout;
505
505
506
		timeout = r->timeout[sp->timeout];
506
		timeout = r->timeout[sp->timeout];
507
		if (!timeout)
507
		if (!timeout)
508
			timeout = V_pf_default_rule.timeout[sp->timeout];
508
			timeout = V_pf_default_rule.timeout[sp->timeout];
509
509
510
		/* sp->expire may have been adaptively scaled by export. */
510
		/* sp->expire may have been adaptively scaled by export. */
511
		st->expire -= timeout - ntohl(sp->expire);
511
		st->expire -= timeout - ntohl(sp->expire);
512
	}
512
	}
513
513
514
	/* reconstruct rt_kif from rule for round-robin redirection */
515
	st->rt_kif = NULL;
516
	if (r != &V_pf_default_rule &&
517
	    (r->rpool.opts & PF_POOL_TYPEMASK ) == PF_POOL_ROUNDROBIN) {
518
		struct pf_pooladdr *acur;
519
		TAILQ_FOREACH(acur, &(r->rpool.list), entries) {
520
			if (acur->addr.type == PF_ADDR_TABLE &&
521
			    pfr_match_addr(acur->addr.p.tbl, &st->rt_addr,
522
			    skw->af))
523
				st->rt_kif = acur->kif;
524
		};
525
	};
526
514
	st->direction = sp->direction;
527
	st->direction = sp->direction;
515
	st->log = sp->log;
528
	st->log = sp->log;
516
	st->timeout = sp->timeout;
529
	st->timeout = sp->timeout;
517
	st->state_flags = sp->state_flags;
530
	st->state_flags = sp->state_flags;
518
531
519
	st->id = sp->id;
532
	st->id = sp->id;
520
	st->creatorid = sp->creatorid;
533
	st->creatorid = sp->creatorid;
521
	pf_state_peer_ntoh(&sp->src, &st->src);
534
	pf_state_peer_ntoh(&sp->src, &st->src);
522
	pf_state_peer_ntoh(&sp->dst, &st->dst);
535
	pf_state_peer_ntoh(&sp->dst, &st->dst);
523
536
524
	st->rule.ptr = r;
537
	st->rule.ptr = r;
525
	st->nat_rule.ptr = NULL;
538
	st->nat_rule.ptr = NULL;
526
	st->anchor.ptr = NULL;
539
	st->anchor.ptr = NULL;
527
	st->rt_kif = NULL;
528
540
529
	st->pfsync_time = time_uptime;
541
	st->pfsync_time = time_uptime;
530
	st->sync_state = PFSYNC_S_NONE;
542
	st->sync_state = PFSYNC_S_NONE;
531
543
532
	if (!(flags & PFSYNC_SI_IOCTL))
544
	if (!(flags & PFSYNC_SI_IOCTL))
533
		st->state_flags |= PFSTATE_NOSYNC;
545
		st->state_flags |= PFSTATE_NOSYNC;
534
546
535
	if ((error = pf_state_insert(kif, skw, sks, st)) != 0)
547
	if ((error = pf_state_insert(kif, skw, sks, st)) != 0)
536
		goto cleanup_state;
548
		goto cleanup_state;
537
549

Return to bug 229092