* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE.
*
- * The SFLOW protocol as per http://www.sflow.org/developers/specifications.php
- *
*
*/
+/* \summary: sFlow protocol printer */
+
+/* specification: http://www.sflow.org/developers/specifications.php */
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
#include "netdissect.h"
#include "extract.h"
tptr = pptr;
tlen = len;
sflow_datagram = (const struct sflow_datagram_t *)pptr;
+ if (len < sizeof(struct sflow_datagram_t)) {
+ ND_TCHECK(sflow_datagram->version);
+ ND_PRINT((ndo, "sFlowv%u", EXTRACT_32BITS(sflow_datagram->version)));
+ ND_PRINT((ndo, " [length %u < %zu]",
+ len, sizeof(struct sflow_datagram_t)));
+ ND_PRINT((ndo, " (invalid)"));
+ return;
+ }
ND_TCHECK(*sflow_datagram);
/*
/* skip Common header */
tptr += sizeof(const struct sflow_datagram_t);
+
+ if(tlen <= sizeof(const struct sflow_datagram_t)) goto trunc;
tlen -= sizeof(const struct sflow_datagram_t);
while (nsamples > 0 && tlen > 0) {