summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hartmeier <dhartmei@cvs.openbsd.org>2003-11-08 19:51:39 +0000
committerDaniel Hartmeier <dhartmei@cvs.openbsd.org>2003-11-08 19:51:39 +0000
commit9e066c5b3955e2d814380ac9b73a757f5aebe879 (patch)
tree4e08a4d1f8d5d0d77b07456cf7b6b244fd9f0ad7
parentf9f14a9c601ce315abc03482cec3a455d84485be (diff)
Return proper anchor rule number in correct byte order.
From Pyun YongHyeon. ok henning@, canacar@
-rw-r--r--sys/net/if_pfsync.c10
-rw-r--r--usr.sbin/tcpdump/print-pfsync.c5
2 files changed, 10 insertions, 5 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index e29a06ec861..fa0962fe279 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.6 2003/06/21 09:07:01 djm Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.7 2003/11/08 19:51:38 dhartmei Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -238,7 +238,7 @@ pfsync_pack_state(action, st)
struct pfsync_softc *sc = ifp->if_softc;
struct pfsync_header *h;
struct pf_state *sp;
- struct pf_rule *r = st->rule.ptr;
+ struct pf_rule *r;
struct mbuf *m;
u_long secs;
int s, ret;
@@ -288,10 +288,14 @@ pfsync_pack_state(action, st)
sp->packets[1] = htonl(st->packets[1]);
sp->bytes[0] = htonl(st->bytes[0]);
sp->bytes[1] = htonl(st->bytes[1]);
- if (r == NULL)
+ if ((r = st->rule.ptr) == NULL)
sp->rule.nr = htonl(-1);
else
sp->rule.nr = htonl(r->nr);
+ if ((r = st->anchor.ptr) == NULL)
+ sp->anchor.nr = htonl(-1);
+ else
+ sp->anchor.nr = htonl(r->nr);
sp->af = st->af;
sp->proto = st->proto;
sp->direction = st->direction;
diff --git a/usr.sbin/tcpdump/print-pfsync.c b/usr.sbin/tcpdump/print-pfsync.c
index f51f825fa4e..4c09468942e 100644
--- a/usr.sbin/tcpdump/print-pfsync.c
+++ b/usr.sbin/tcpdump/print-pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-pfsync.c,v 1.11 2003/11/08 06:46:44 mcbride Exp $ */
+/* $OpenBSD: print-pfsync.c,v 1.12 2003/11/08 19:51:38 dhartmei Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -28,7 +28,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-pfsync.c,v 1.11 2003/11/08 06:46:44 mcbride Exp $";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-pfsync.c,v 1.12 2003/11/08 19:51:38 dhartmei Exp $";
#endif
#include <sys/param.h>
@@ -111,6 +111,7 @@ pfsync_if_print(u_char *user, const struct pcap_pkthdr *h,
pf_state_peer_ntoh(&s->src, &st.src);
pf_state_peer_ntoh(&s->dst, &st.dst);
st.rule.nr = ntohl(s->rule.nr);
+ st.anchor.nr = ntohl(s->anchor.nr);
bcopy(&s->rt_addr, &st.rt_addr, sizeof(st.rt_addr));
st.creation = ntohl(s->creation);
st.expire = ntohl(s->expire);