X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fdpif-netdev.c;h=926464e266ff202f6f6c740b2c381b0631cc0633;hb=6ff686f2bc2afcfb0a9ad9793d834979dc9870d6;hp=d0a50f32e04fe8d57c812047833cb7062cff349c;hpb=df2c07f4338faac04f4969f243fe4e8083b309ac;p=sliver-openvswitch.git diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index d0a50f32e..926464e26 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -336,7 +336,7 @@ do_add_port(struct dp_netdev *dp, const char *devname, const char *type, int error; /* XXX reject devices already in some dp_netdev. */ - if (type[0] == '\0' || !strcmp(type, "system")) { + if (type[0] == '\0' || !strcmp(type, "system") || !strcmp(type, "dummy")) { internal = false; } else if (!strcmp(type, "internal")) { internal = true; @@ -378,8 +378,8 @@ do_add_port(struct dp_netdev *dp, const char *devname, const char *type, port->netdev = netdev; port->internal = internal; - netdev_get_mtu(netdev, &mtu); - if (mtu != INT_MAX && mtu > max_mtu) { + error = netdev_get_mtu(netdev, &mtu); + if (!error) { max_mtu = mtu; } @@ -654,6 +654,12 @@ dpif_netdev_flow_from_nlattrs(const struct nlattr *key, uint32_t key_len, return EINVAL; } + if (flow->in_port < OFPP_MAX + ? flow->in_port >= MAX_PORTS + : flow->in_port != OFPP_LOCAL && flow->in_port != OFPP_NONE) { + return EINVAL; + } + return 0; } @@ -712,7 +718,7 @@ dpif_netdev_validate_actions(const struct nlattr *actions, case OVS_ACTION_ATTR_USERSPACE: break; - case OVS_ACTION_ATTR_SET_DL_TCI: + case OVS_ACTION_ATTR_PUSH_VLAN: *mutates = true; if (nl_attr_get_be16(a) & htons(VLAN_CFI)) { return EINVAL; @@ -726,7 +732,7 @@ dpif_netdev_validate_actions(const struct nlattr *actions, } break; - case OVS_ACTION_ATTR_STRIP_VLAN: + case OVS_ACTION_ATTR_POP_VLAN: case OVS_ACTION_ATTR_SET_DL_SRC: case OVS_ACTION_ATTR_SET_DL_DST: case OVS_ACTION_ATTR_SET_NW_SRC: @@ -979,9 +985,11 @@ dpif_netdev_execute(struct dpif *dpif, } flow_extract(©, 0, -1, &key); - dpif_netdev_flow_from_nlattrs(key_attrs, key_len, &key); - - error = dp_netdev_execute_actions(dp, ©, &key, actions, actions_len); + error = dpif_netdev_flow_from_nlattrs(key_attrs, key_len, &key); + if (!error) { + error = dp_netdev_execute_actions(dp, ©, &key, + actions, actions_len); + } if (mutates) { ofpbuf_uninit(©); } @@ -1134,7 +1142,7 @@ dpif_netdev_wait(struct dpif *dpif) } static void -dp_netdev_strip_vlan(struct ofpbuf *packet) +dp_netdev_pop_vlan(struct ofpbuf *packet) { struct vlan_eth_header *veh = packet->l2; if (packet->size >= sizeof *veh @@ -1306,12 +1314,12 @@ dp_netdev_execute_actions(struct dp_netdev *dp, key, nl_attr_get_u64(a)); break; - case OVS_ACTION_ATTR_SET_DL_TCI: - eth_set_vlan_tci(packet, nl_attr_get_be16(a)); + case OVS_ACTION_ATTR_PUSH_VLAN: + eth_push_vlan(packet, nl_attr_get_be16(a)); break; - case OVS_ACTION_ATTR_STRIP_VLAN: - dp_netdev_strip_vlan(packet); + case OVS_ACTION_ATTR_POP_VLAN: + dp_netdev_pop_vlan(packet); break; case OVS_ACTION_ATTR_SET_DL_SRC: @@ -1371,8 +1379,6 @@ const struct dpif_class dpif_netdev_class = { dpif_netdev_execute, dpif_netdev_recv_get_mask, dpif_netdev_recv_set_mask, - NULL, /* get_sflow_probability */ - NULL, /* set_sflow_probability */ NULL, /* queue_to_priority */ dpif_netdev_recv, dpif_netdev_recv_wait,