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

Collapse All | Expand All

(-)sbin/pfctl/pf_print_state.c (-15 / +15 lines)
Lines 208-214 void Link Here
208
print_state(struct pfsync_state *s, int opts)
208
print_state(struct pfsync_state *s, int opts)
209
{
209
{
210
	struct pfsync_state_peer *src, *dst;
210
	struct pfsync_state_peer *src, *dst;
211
	struct pfsync_state_key *sk, *nk;
211
	struct pfsync_state_key sk, nk;
212
	struct protoent *p;
212
	struct protoent *p;
213
	int min, sec;
213
	int min, sec;
214
214
Lines 215-231 print_state(struct pfsync_state *s, int opts) Link Here
215
	if (s->direction == PF_OUT) {
215
	if (s->direction == PF_OUT) {
216
		src = &s->src;
216
		src = &s->src;
217
		dst = &s->dst;
217
		dst = &s->dst;
218
		sk = &s->key[PF_SK_STACK];
218
		bcopy(&s->key[PF_SK_STACK], &sk, sizeof(sk));
219
		nk = &s->key[PF_SK_WIRE];
219
		bcopy(&s->key[PF_SK_WIRE], &nk, sizeof(nk));
220
		if (s->proto == IPPROTO_ICMP || s->proto == IPPROTO_ICMPV6) 
220
		if (s->proto == IPPROTO_ICMP || s->proto == IPPROTO_ICMPV6) 
221
			sk->port[0] = nk->port[0];
221
			sk.port[0] = nk.port[0];
222
	} else {
222
	} else {
223
		src = &s->dst;
223
		src = &s->dst;
224
		dst = &s->src;
224
		dst = &s->src;
225
		sk = &s->key[PF_SK_WIRE];
225
		bcopy(&s->key[PF_SK_WIRE], &sk, sizeof(sk));
226
		nk = &s->key[PF_SK_STACK];
226
		bcopy(&s->key[PF_SK_STACK], &nk, sizeof(nk));
227
		if (s->proto == IPPROTO_ICMP || s->proto == IPPROTO_ICMPV6) 
227
		if (s->proto == IPPROTO_ICMP || s->proto == IPPROTO_ICMPV6) 
228
			sk->port[1] = nk->port[1];
228
			sk.port[1] = nk.port[1];
229
	}
229
	}
230
	printf("%s ", s->ifname);
230
	printf("%s ", s->ifname);
231
	if ((p = getprotobynumber(s->proto)) != NULL)
231
	if ((p = getprotobynumber(s->proto)) != NULL)
Lines 233-243 print_state(struct pfsync_state *s, int opts) Link Here
233
	else
233
	else
234
		printf("%u ", s->proto);
234
		printf("%u ", s->proto);
235
235
236
	print_host(&nk->addr[1], nk->port[1], s->af, opts);
236
	print_host(&nk.addr[1], nk.port[1], s->af, opts);
237
	if (PF_ANEQ(&nk->addr[1], &sk->addr[1], s->af) ||
237
	if (PF_ANEQ(&nk.addr[1], &sk.addr[1], s->af) ||
238
	    nk->port[1] != sk->port[1]) {
238
	    nk.port[1] != sk.port[1]) {
239
		printf(" (");
239
		printf(" (");
240
		print_host(&sk->addr[1], sk->port[1], s->af, opts);
240
		print_host(&sk.addr[1], sk.port[1], s->af, opts);
241
		printf(")");
241
		printf(")");
242
	}
242
	}
243
	if (s->direction == PF_OUT)
243
	if (s->direction == PF_OUT)
Lines 244-254 print_state(struct pfsync_state *s, int opts) Link Here
244
		printf(" -> ");
244
		printf(" -> ");
245
	else
245
	else
246
		printf(" <- ");
246
		printf(" <- ");
247
	print_host(&nk->addr[0], nk->port[0], s->af, opts);
247
	print_host(&nk.addr[0], nk.port[0], s->af, opts);
248
	if (PF_ANEQ(&nk->addr[0], &sk->addr[0], s->af) ||
248
	if (PF_ANEQ(&nk.addr[0], &sk.addr[0], s->af) ||
249
	    nk->port[0] != sk->port[0]) {
249
	    nk.port[0] != sk.port[0]) {
250
		printf(" (");
250
		printf(" (");
251
		print_host(&sk->addr[0], sk->port[0], s->af, opts);
251
		print_host(&sk.addr[0], sk.port[0], s->af, opts);
252
		printf(")");
252
		printf(")");
253
	}
253
	}
254
254

Return to bug 206658