dpif-linux: Fix a bug.
authorAlex Wang <alexw@nicira.com>
Tue, 17 Dec 2013 16:16:24 +0000 (16:16 +0000)
committerJarno Rajahalme <jrajahalme@nicira.com>
Tue, 17 Dec 2013 17:05:09 +0000 (09:05 -0800)
Commit da546e0 (dpif: Allow execute to modify the packet.) introduced
a bug by subtracting the zero-value ofpbuf size by "sizeof(struct
nlattr)" and assigning the result back to the ofpbuf size.  This bug
causes the ovs-assert failure in facet_push_stats().

This commit fixes the bug by assigning the right value to the ofpbuf
size.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
lib/dpif-linux.c

index 54d7f2a..8fa42a9 100644 (file)
@@ -1473,7 +1473,7 @@ parse_odp_packet(struct ofpbuf *buf, struct dpif_upcall *upcall,
                     nl_attr_get_size(a[OVS_PACKET_ATTR_PACKET]) +
                     sizeof(struct nlattr));
     upcall->packet.data = (char *)upcall->packet.data + sizeof(struct nlattr);
-    upcall->packet.size -= sizeof(struct nlattr);
+    upcall->packet.size = nl_attr_get_size(a[OVS_PACKET_ATTR_PACKET]);
 
     *dp_ifindex = ovs_header->dp_ifindex;