summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBret Lambert <blambert@cvs.openbsd.org>2014-08-13 09:46:24 +0000
committerBret Lambert <blambert@cvs.openbsd.org>2014-08-13 09:46:24 +0000
commitba98576cb672f09fa301dcb104a0b646b4439865 (patch)
tree19a3f3c3f4db3f7b70ff5ea9916d00bf7d2abe0d
parent797a326e0f2b14ba2a6108f33b6da1f927fc128f (diff)
Bring IPFIX sequence numbers in line with the RFC; original
diff from benno@. ok benno@, florian@
-rw-r--r--sys/net/if_pflow.c10
-rw-r--r--sys/net/if_pflow.h3
2 files changed, 9 insertions, 4 deletions
diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c
index df62535eaa3..953bdb2b85a 100644
--- a/sys/net/if_pflow.c
+++ b/sys/net/if_pflow.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflow.c,v 1.45 2014/07/22 11:06:09 mpi Exp $ */
+/* $OpenBSD: if_pflow.c,v 1.46 2014/08/13 09:46:23 blambert Exp $ */
/*
* Copyright (c) 2011 Florian Obser <florian@narrans.de>
@@ -987,6 +987,7 @@ pflow_sendout_ipfix(struct pflow_softc *sc, sa_family_t af)
struct pflow_v10_header *h10;
struct pflow_set_header *set_hdr;
struct ifnet *ifp = &sc->sc_if;
+ u_int32_t count;
int set_length;
switch (af) {
@@ -996,6 +997,7 @@ pflow_sendout_ipfix(struct pflow_softc *sc, sa_family_t af)
if (m == NULL)
return (0);
sc->sc_mbuf = NULL;
+ count = sc->sc_count4;
set_length = sizeof(struct pflow_set_header)
+ sc->sc_count4 * sizeof(struct pflow_ipfix_flow4);
break;
@@ -1005,6 +1007,7 @@ pflow_sendout_ipfix(struct pflow_softc *sc, sa_family_t af)
if (m == NULL)
return (0);
sc->sc_mbuf6 = NULL;
+ count = sc->sc_count6;
set_length = sizeof(struct pflow_set_header)
+ sc->sc_count6 * sizeof(struct pflow_ipfix_flow6);
break;
@@ -1031,7 +1034,8 @@ pflow_sendout_ipfix(struct pflow_softc *sc, sa_family_t af)
h10->version = htons(PFLOW_PROTO_10);
h10->length = htons(PFLOW_IPFIX_HDRLEN + set_length);
h10->time_sec = htonl(time_second); /* XXX 2038 */
- h10->flow_sequence = htonl(sc->sc_gcounter);
+ h10->flow_sequence = htonl(sc->sc_sequence);
+ sc->sc_sequence += count;
h10->observation_dom = htonl(PFLOW_ENGINE_TYPE);
return (pflow_sendout_mbuf(sc, m));
}
@@ -1070,7 +1074,7 @@ pflow_sendout_ipfix_tmpl(struct pflow_softc *sc)
h10->length = htons(PFLOW_IPFIX_HDRLEN + sizeof(struct
pflow_ipfix_tmpl));
h10->time_sec = htonl(time_second); /* XXX 2038 */
- h10->flow_sequence = htonl(sc->sc_gcounter);
+ h10->flow_sequence = htonl(sc->sc_sequence);
h10->observation_dom = htonl(PFLOW_ENGINE_TYPE);
timeout_add_sec(&sc->sc_tmo_tmpl, PFLOW_TMPL_TIMEOUT);
diff --git a/sys/net/if_pflow.h b/sys/net/if_pflow.h
index d5d06cd919d..7e35dddffcb 100644
--- a/sys/net/if_pflow.h
+++ b/sys/net/if_pflow.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflow.h,v 1.11 2014/03/29 11:26:03 florian Exp $ */
+/* $OpenBSD: if_pflow.h,v 1.12 2014/08/13 09:46:23 blambert Exp $ */
/*
* Copyright (c) 2008 Henning Brauer <henning@openbsd.org>
@@ -180,6 +180,7 @@ struct pflow_softc {
unsigned int sc_maxcount4;
unsigned int sc_maxcount6;
u_int64_t sc_gcounter;
+ u_int32_t sc_sequence;
struct ip_moptions sc_imo;
struct timeout sc_tmo;
struct timeout sc_tmo6;