X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=lib%2Fdpif-netdev.c;h=486ba4865e9b56afeb39351ad25f685173352a49;hb=6d6ab93e9dcd91119ea9a1a843c1bb35e6754706;hp=417ed6e677c71509b233a7aa66e50e21a39fe324;hpb=7aec165dbc4690c8c2c703d142e2f017bb851d31;p=openvswitch diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 417ed6e6..486ba486 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -375,7 +375,7 @@ do_add_port(struct dp_netdev *dp, const char *devname, const char *type, port->internal = internal; netdev_get_mtu(netdev, &mtu); - if (mtu > max_mtu) { + if (mtu != INT_MAX && mtu > max_mtu) { max_mtu = mtu; } @@ -872,7 +872,7 @@ struct dp_netdev_flow_state { uint32_t bucket; uint32_t offset; struct nlattr *actions; - uint32_t keybuf[ODPUTIL_FLOW_KEY_U32S]; + struct odputil_keybuf keybuf; struct dpif_flow_stats stats; }; @@ -909,9 +909,8 @@ dpif_netdev_flow_dump_next(const struct dpif *dpif, void *state_, if (key) { struct ofpbuf buf; - ofpbuf_use_stack(&buf, state->keybuf, sizeof state->keybuf); + ofpbuf_use_stack(&buf, &state->keybuf, sizeof state->keybuf); odp_flow_key_from_flow(&buf, &flow->key); - assert(buf.base == state->keybuf); *key = buf.data; *key_len = buf.size; @@ -1216,10 +1215,10 @@ dp_netdev_set_nw_addr(struct ofpbuf *packet, const struct flow *key, uint32_t *field; field = type == ODP_ACTION_ATTR_SET_NW_SRC ? &nh->ip_src : &nh->ip_dst; - if (key->nw_proto == IP_TYPE_TCP && packet->l7) { + if (key->nw_proto == IPPROTO_TCP && packet->l7) { struct tcp_header *th = packet->l4; th->tcp_csum = recalc_csum32(th->tcp_csum, *field, ip); - } else if (key->nw_proto == IP_TYPE_UDP && packet->l7) { + } else if (key->nw_proto == IPPROTO_UDP && packet->l7) { struct udp_header *uh = packet->l4; if (uh->udp_csum) { uh->udp_csum = recalc_csum32(uh->udp_csum, *field, ip); @@ -1315,7 +1314,7 @@ dp_netdev_output_control(struct dp_netdev *dp, const struct ofpbuf *packet, upcall->key_len = key_len; upcall->userdata = arg; - q->upcalls[++q->head & QUEUE_MASK] = upcall; + q->upcalls[q->head++ & QUEUE_MASK] = upcall; return 0; }