printf(" round-robin"); break; } printf(" ");
printf("round-robin "); break; }
print_rule(struct pf_rule *r){	int i, opts;	printf("@%d ", r->nr);	if (r->action == PF_PASS)		printf("pass ");	else if (r->action == PF_DROP) {		printf("block ");		if (r->rule_flag & PFRULE_RETURN)			printf("return ");		else if (r->rule_flag & PFRULE_RETURNRST) {			if (!r->return_ttl)				printf("return-rst ");			else				printf("return-rst(ttl %d) ", r->return_ttl);		} else if (r->rule_flag & PFRULE_RETURNICMP) {			const struct icmpcodeent *ic, *ic6;			ic = geticmpcodebynumber(r->return_icmp >> 8,			    r->return_icmp & 255, AF_INET);			ic6 = geticmpcodebynumber(r->return_icmp6 >> 8,			    r->return_icmp6 & 255, AF_INET6);			switch(r->af) {			case AF_INET:				printf("return-icmp");				if (ic == NULL)					printf("(%u) ", r->return_icmp & 255);				else					printf("(%s) ", ic->name);				break;			case AF_INET6:				printf("return-icmp6");				if (ic6 == NULL)					printf("(%u) ", r->return_icmp6 & 255);				else					printf("(%s) ", ic6->name);				break;			default:				printf("return-icmp");				if (ic == NULL)					printf("(%u, ", r->return_icmp & 255);				else					printf("(%s, ", ic->name);				if (ic6 == NULL)					printf("%u) ", r->return_icmp6 & 255);				else					printf("%s) ", ic6->name);				break;			}		}	} else {		printf("scrub ");	}	if (r->direction == 0)		printf("in ");	else		printf("out ");	if (r->log == 1)		printf("log ");	else if (r->log == 2)		printf("log-all ");	if (r->quick)		printf("quick ");	if (r->ifname[0]) {		if (r->ifnot)			printf("on ! %s ", r->ifname);		else			printf("on %s ", r->ifname);	}	if (r->rt) {		if (r->rt == PF_ROUTETO)			printf("route-to ");		else if (r->rt == PF_REPLYTO)			printf("reply-to ");		else if (r->rt == PF_DUPTO)			printf("dup-to ");		else if (r->rt == PF_FASTROUTE)			printf("fastroute");			print_pool(&r->rt_pool, r->af, PF_POOL_RULE_RT);		switch (r->rt_pool.opts & 0x0f) {		case PF_POOL_NONE:			break;		case PF_POOL_BITMASK:			printf(" bitmask");			break;		case PF_POOL_RANDOM:			printf(" random");			break;		case PF_POOL_SRCHASH:			printf(" source-hash");			break;		case PF_POOL_SRCKEYHASH:			printf(" source-hash key");			break;		case PF_POOL_ROUNDROBIN:			printf(" round-robin");			break;		}		printf(" ");	}	if (r->af) {		if (r->af == AF_INET)			printf("inet ");		else			printf("inet6 ");	}	if (r->proto) {		struct protoent *p = getprotobynumber(r->proto);		if (p != NULL)			printf("proto %s ", p->p_name);		else			printf("proto %u ", r->proto);	}	print_fromto(&r->src, &r->dst, r->af, r->proto);	if (r->uid.op)		print_uid(r->uid.op, r->uid.uid[0], r->uid.uid[1], "user");	if (r->gid.op)		print_gid(r->gid.op, r->gid.gid[0], r->gid.gid[1], "group");	if (r->flags || r->flagset) {		printf("flags ");		print_flags(r->flags);		printf("/");		print_flags(r->flagset);		printf(" ");	}	if (r->type) {		const struct icmptypeent *p;		p = geticmptypebynumber(r->type-1, r->af);		if (r->af != AF_INET6)			printf("icmp-type");		else			printf("ipv6-icmp-type");		if (p != NULL)			printf(" %s ", p->name);		else			printf(" %u ", r->type-1);		if (r->code) {			const struct icmpcodeent *p;			p = geticmpcodebynumber(r->type-1, r->code-1, r->af);			if (p != NULL)				printf("code %s ", p->name);			else				printf("code %u ", r->code-1);		}	}	if (r->tos)		printf("tos 0x%2.2x ", r->tos);	if (r->keep_state == PF_STATE_NORMAL)		printf("keep state ");	else if (r->keep_state == PF_STATE_MODULATE)		printf("modulate state ");	opts = 0;	if (r->max_states)		opts = 1;	for (i = 0; !opts && i < PFTM_MAX; ++i)		if (r->timeout[i])			opts = 1;	if (opts) {		printf("(");		if (r->max_states) {			printf("max %u", r->max_states);			opts = 0;		}		for (i = 0; i < PFTM_MAX; ++i)			if (r->timeout[i]) {				if (!opts)					printf(", ");				opts = 0;				printf("%s %u", pf_timeouts[i].name,				    r->timeout[i]);			}		printf(") ");	}	if (r->rule_flag & PFRULE_FRAGMENT)		printf("fragment ");	if (r->rule_flag & PFRULE_NODF)		printf("no-df ");	if (r->min_ttl)		printf("min-ttl %d ", r->min_ttl);	if (r->max_mss)		printf("max-mss %d ", r->max_mss);	if (r->allow_opts)		printf("allow-opts ");	if (r->action == PF_SCRUB) {		if (r->rule_flag & PFRULE_FRAGDROP)			printf("fragment drop-ovl ");		else if (r->rule_flag & PFRULE_FRAGCROP)			printf("fragment crop ");		else			printf("fragment reassemble ");	}	if (r->label[0])		printf("label %s ", r->label);	if (r->qname[0])		printf("queue %s", r->qname);	printf("\n");}