From: blambert Date: Wed, 13 Aug 2014 09:46:23 +0000 (+0000) Subject: Bring IPFIX sequence numbers in line with the RFC; original X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=990339f002bd4e968c94ea42437a233e22da2b60;p=openbsd Bring IPFIX sequence numbers in line with the RFC; original diff from benno@. ok benno@, florian@ --- 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 @@ -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 @@ -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;