X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=lib%2Fflow.c;h=e7ed2a97efe1b33e58d72765653289cea61573c6;hb=57b7c6a143a7b86f753ec1928aae3a74b95befd4;hp=26d03fd430146f02005ec991586533820192a4e2;hpb=66642cb40b12594c62f3d3037f1e4efa528416b7;p=openvswitch diff --git a/lib/flow.c b/lib/flow.c index 26d03fd4..e7ed2a97 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -34,6 +34,8 @@ VLOG_DEFINE_THIS_MODULE(flow); +COVERAGE_DEFINE(flow_extract); + static struct arp_eth_header * pull_arp(struct ofpbuf *packet) { @@ -136,7 +138,7 @@ parse_ethertype(struct ofpbuf *b) * present and has a correct length, and otherwise NULL. */ int -flow_extract(struct ofpbuf *packet, ovs_be32 tun_id, uint16_t in_port, +flow_extract(struct ofpbuf *packet, ovs_be64 tun_id, uint16_t in_port, struct flow *flow) { struct ofpbuf b = *packet; @@ -175,8 +177,8 @@ flow_extract(struct ofpbuf *packet, ovs_be32 tun_id, uint16_t in_port, if (flow->dl_type == htons(ETH_TYPE_IP)) { const struct ip_header *nh = pull_ip(&b); if (nh) { - flow->nw_src = get_unaligned_u32(&nh->ip_src); - flow->nw_dst = get_unaligned_u32(&nh->ip_dst); + flow->nw_src = get_unaligned_be32(&nh->ip_src); + flow->nw_dst = get_unaligned_be32(&nh->ip_dst); flow->nw_tos = nh->ip_tos & IP_DSCP_MASK; flow->nw_proto = nh->ip_proto; packet->l4 = b.data; @@ -259,8 +261,8 @@ flow_to_string(const struct flow *flow) void flow_format(struct ds *ds, const struct flow *flow) { - ds_put_format(ds, "tunnel%08"PRIx32":in_port%04"PRIx16":tci(", - ntohl(flow->tun_id), flow->in_port); + ds_put_format(ds, "tunnel%#"PRIx64":in_port%04"PRIx16":tci(", + flow->tun_id, flow->in_port); if (flow->vlan_tci) { ds_put_format(ds, "vlan%"PRIu16",pcp%d", vlan_tci_to_vid(flow->vlan_tci), @@ -304,6 +306,7 @@ flow_wildcards_init_catchall(struct flow_wildcards *wc) wc->nw_dst_mask = htonl(0); memset(wc->reg_masks, 0, sizeof wc->reg_masks); wc->vlan_tci_mask = htons(0); + wc->zero = 0; } /* Initializes 'wc' as an exact-match set of wildcards; that is, 'wc' does not @@ -316,6 +319,7 @@ flow_wildcards_init_exact(struct flow_wildcards *wc) wc->nw_dst_mask = htonl(UINT32_MAX); memset(wc->reg_masks, 0xff, sizeof wc->reg_masks); wc->vlan_tci_mask = htons(UINT16_MAX); + wc->zero = 0; } /* Returns true if 'wc' is exact-match, false if 'wc' wildcards any bits or