sflow: Include Ethernet FCS in frame_length to comply with sFlow spec.
authorNeil McKee <neil.mckee@inmon.com>
Wed, 5 May 2010 20:24:03 +0000 (13:24 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 5 May 2010 20:27:01 +0000 (13:27 -0700)
ofproto/ofproto-sflow.c

index 85f9f9ff47b6d936c4e1b930896e90f890d5a675..5488724e0c7c56adca5a846be35fdd72d85ec883 100644 (file)
@@ -519,8 +519,11 @@ ofproto_sflow_received(struct ofproto_sflow *os, struct odp_msg *msg)
     hdrElem.tag = SFLFLOW_HEADER;
     header = &hdrElem.flowType.header;
     header->header_protocol = SFLHEADER_ETHERNET_ISO8023;
-    header->frame_length = payload.size;
-    header->stripped = 4; /* Ethernet FCS stripped off. */
+    /* The frame_length should include the Ethernet FCS (4 bytes),
+       but it has already been stripped,  so we need to add 4 here. */
+    header->frame_length = payload.size + 4;
+    /* Ethernet FCS stripped off. */
+    header->stripped = 4;
     header->header_length = MIN(payload.size,
                                 sampler->sFlowFsMaximumHeaderSize);
     header->header_bytes = payload.data;