From: Jarno Rajahalme <jrajahalme@nicira.com>
Date: Tue, 25 Mar 2014 22:26:23 +0000 (-0700)
Subject: lib/pcap: Use ofpbuf_tail() instead of ofpbuf_end().
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=ba3f2aedba884a7d1ce74da5e0fe1691ff0c2539;p=sliver-openvswitch.git

lib/pcap: Use ofpbuf_tail() instead of ofpbuf_end().

Using ofpbuf_end() to compute payload length would fail if the ofpbuf
had any tailroom.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
---

diff --git a/lib/pcap-file.c b/lib/pcap-file.c
index 2d3f9fec2..e2fd20397 100644
--- a/lib/pcap-file.c
+++ b/lib/pcap-file.c
@@ -311,7 +311,7 @@ tcp_reader_run(struct tcp_reader *r, const struct flow *flow,
     }
     tcp = packet->l4;
     flags = TCP_FLAGS(tcp->tcp_ctl);
-    l7_length = (char *) ofpbuf_end(packet) - (char *) packet->l7;
+    l7_length = (char *) ofpbuf_tail(packet) - (char *) packet->l7;
     seq = ntohl(get_16aligned_be32(&tcp->tcp_seq));
 
     /* Construct key. */