This makes flow_extract() happier with TCP packets that this function
produces.
Signed-off-by: Ben Pfaff <blp@nicira.com>
b->l4 = tcp = ofpbuf_put_zeros(b, sizeof *tcp);
tcp->tcp_src = flow->tp_src;
tcp->tcp_dst = flow->tp_dst;
+ tcp->tcp_ctl = TCP_CTL(0, 5);
} else if (flow->nw_proto == IPPROTO_UDP) {
struct udp_header *udp;
icmp->icmp_code = ntohs(flow->tp_dst);
}
}
+
+ ip->ip_tot_len = htons((uint8_t *) b->data + b->size
+ - (uint8_t *) b->l3);
} else if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
/* XXX */
} else if (flow->dl_type == htons(ETH_TYPE_ARP)) {
#define TCP_ACK 0x10
#define TCP_URG 0x20
+#define TCP_CTL(flags, offset) (htons((flags) | ((offset) << 12)))
#define TCP_FLAGS(tcp_ctl) (ntohs(tcp_ctl) & 0x003f)
#define TCP_OFFSET(tcp_ctl) (ntohs(tcp_ctl) >> 12)