X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fpcap-file.c;h=191e690e637815801269054bc286e9580a5cbbab;hb=HEAD;hp=2d3f9fec222266789583de514eb776e75cf70c9d;hpb=db19b72b9f6d0d40b743214241d9666116e3b448;p=sliver-openvswitch.git diff --git a/lib/pcap-file.c b/lib/pcap-file.c index 2d3f9fec2..191e690e6 100644 --- a/lib/pcap-file.c +++ b/lib/pcap-file.c @@ -198,10 +198,10 @@ ovs_pcap_write(FILE *file, struct ofpbuf *buf) xgettimeofday(&tv); prh.ts_sec = tv.tv_sec; prh.ts_usec = tv.tv_usec; - prh.incl_len = buf->size; - prh.orig_len = buf->size; + prh.incl_len = ofpbuf_size(buf); + prh.orig_len = ofpbuf_size(buf); ignore(fwrite(&prh, sizeof prh, 1, file)); - ignore(fwrite(buf->data, buf->size, 1, file)); + ignore(fwrite(ofpbuf_data(buf), ofpbuf_size(buf), 1, file)); } struct tcp_key { @@ -303,15 +303,16 @@ tcp_reader_run(struct tcp_reader *r, const struct flow *flow, uint32_t hash; uint32_t seq; uint8_t flags; + const char *l7 = ofpbuf_get_tcp_payload(packet); if (flow->dl_type != htons(ETH_TYPE_IP) || flow->nw_proto != IPPROTO_TCP - || !packet->l7) { + || !l7) { return NULL; } - tcp = packet->l4; + tcp = ofpbuf_l4(packet); flags = TCP_FLAGS(tcp->tcp_ctl); - l7_length = (char *) ofpbuf_end(packet) - (char *) packet->l7; + l7_length = (char *) ofpbuf_tail(packet) - l7; seq = ntohl(get_16aligned_be32(&tcp->tcp_seq)); /* Construct key. */ @@ -345,9 +346,9 @@ tcp_reader_run(struct tcp_reader *r, const struct flow *flow, /* Shift all of the existing payload to the very beginning of the * allocated space, so that we reuse allocated space instead of * continually expanding it. */ - ofpbuf_shift(payload, (char *) payload->base - (char *) payload->data); + ofpbuf_shift(payload, (char *) ofpbuf_base(payload) - (char *) ofpbuf_data(payload)); - ofpbuf_put(payload, packet->l7, l7_length); + ofpbuf_put(payload, l7, l7_length); stream->seq_no += l7_length; return payload; } else {