From: jasper Date: Mon, 16 Jul 2018 16:54:30 +0000 (+0000) Subject: use 'switch' rathan than an if-else construct to match on the netflow version to... X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=10989718af69eb27dc1d52e5bce716e520b12b30;p=openbsd use 'switch' rathan than an if-else construct to match on the netflow version to in pflow_get_mbuf(), to match the rest of the file ok benno@ florian@ --- diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c index 14756d6548b..b8ac35c1b6e 100644 --- a/sys/net/if_pflow.c +++ b/sys/net/if_pflow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pflow.c,v 1.88 2018/06/06 06:55:22 mpi Exp $ */ +/* $OpenBSD: if_pflow.c,v 1.89 2018/07/16 16:54:30 jasper Exp $ */ /* * Copyright (c) 2011 Florian Obser @@ -644,7 +644,8 @@ pflow_get_mbuf(struct pflow_softc *sc, u_int16_t set_id) if (sc == NULL) /* get only a new empty mbuf */ return (m); - if (sc->sc_version == PFLOW_PROTO_5) { + switch (sc->sc_version) { + case PFLOW_PROTO_5: /* populate pflow_header */ h.reserved1 = 0; h.reserved2 = 0; @@ -657,11 +658,15 @@ pflow_get_mbuf(struct pflow_softc *sc, u_int16_t set_id) sc->sc_count = 0; timeout_add_sec(&sc->sc_tmo, PFLOW_TIMEOUT); - } else { + break; + case PFLOW_PROTO_10: /* populate pflow_set_header */ set_hdr.set_length = 0; set_hdr.set_id = htons(set_id); m_copyback(m, 0, PFLOW_SET_HDRLEN, &set_hdr, M_NOWAIT); + break; + default: /* NOTREACHED */ + break; } return (m);