summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJoerg Goltermann <gollo@cvs.openbsd.org>2009-01-03 21:47:33 +0000
committerJoerg Goltermann <gollo@cvs.openbsd.org>2009-01-03 21:47:33 +0000
commit99afc494521d14340f4c89b68314b6784a258f9b (patch)
tree1ec14da4d8e967048a7e9e25b5cf405735d658b8 /sys
parentbbee3550e6b8d8b45d90685051c97f8a3f96213a (diff)
sync flow sequence ids on all used pflow interfaces.
OK henning@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_pflow.c18
-rw-r--r--sys/net/if_pflow.h4
2 files changed, 13 insertions, 9 deletions
diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c
index fb04229b7f5..15c84a899b5 100644
--- a/sys/net/if_pflow.c
+++ b/sys/net/if_pflow.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflow.c,v 1.8 2008/11/26 18:01:43 dlg Exp $ */
+/* $OpenBSD: if_pflow.c,v 1.9 2009/01/03 21:47:32 gollo Exp $ */
/*
* Copyright (c) 2008 Henning Brauer <henning@openbsd.org>
@@ -212,9 +212,10 @@ pflowioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCSIFFLAGS:
if ((ifp->if_flags & IFF_UP) &&
sc->sc_receiver_ip.s_addr != 0 &&
- sc->sc_receiver_port != 0)
+ sc->sc_receiver_port != 0) {
ifp->if_flags |= IFF_RUNNING;
- else
+ sc->sc_gcounter=pflowstats.pflow_flows;
+ } else
ifp->if_flags &= ~IFF_RUNNING;
break;
case SIOCSIFMTU:
@@ -261,9 +262,10 @@ pflowioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if ((ifp->if_flags & IFF_UP) &&
sc->sc_receiver_ip.s_addr != 0 &&
- sc->sc_receiver_port != 0)
+ sc->sc_receiver_port != 0) {
ifp->if_flags |= IFF_RUNNING;
- else
+ sc->sc_gcounter=pflowstats.pflow_flows;
+ } else
ifp->if_flags &= ~IFF_RUNNING;
break;
@@ -467,7 +469,8 @@ pflow_pack_flow(struct pf_state *st, struct pflow_softc *sc)
}
}
- pflowstats.pflow_flows++;
+ if (pflowstats.pflow_flows == sc->sc_gcounter)
+ pflowstats.pflow_flows++;
sc->sc_gcounter++;
sc->sc_count++;
@@ -496,7 +499,8 @@ pflow_pack_flow(struct pf_state *st, struct pflow_softc *sc)
}
}
- pflowstats.pflow_flows++;
+ if (pflowstats.pflow_flows == sc->sc_gcounter)
+ pflowstats.pflow_flows++;
sc->sc_gcounter++;
sc->sc_count++;
diff --git a/sys/net/if_pflow.h b/sys/net/if_pflow.h
index e51da7f83e5..cceaf096b1a 100644
--- a/sys/net/if_pflow.h
+++ b/sys/net/if_pflow.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflow.h,v 1.3 2008/10/28 15:51:27 gollo Exp $ */
+/* $OpenBSD: if_pflow.h,v 1.4 2009/01/03 21:47:32 gollo Exp $ */
/*
* Copyright (c) 2008 Henning Brauer <henning@openbsd.org>
@@ -66,7 +66,7 @@ struct pflow_softc {
unsigned int sc_count;
unsigned int sc_maxcount;
- u_int32_t sc_gcounter;
+ u_int64_t sc_gcounter;
struct ip_moptions sc_imo;
struct timeout sc_tmo;
struct in_addr sc_sender_ip;