2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

datapath: Allow a packet with no input port to omit OVS_KEY_ATTR_IN_PORT.

When ovs-vswitchd executes actions on a synthesized packet, that is, on a
packet that is not being forwarded from any particular port but is being
generated by ovs-vswitchd itself or by an OpenFlow controller (using a
OFPT_PACKET_OUT message with an in_port of OFPP_NONE), there is no good
choice for the in_port to pass to the kernel in the flow in the
OVS_PACKET_CMD_EXECUTE message.  This commit allows ovs-vswitchd to omit
the in_port entirely in this case.

This fixes a bug in OFPT_PACKET_OUT: using an in_port of OFPP_NONE would
cause the packet to be dropped by the kernel, since that's an invalid
input port.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Reported-by: Aaron Rosen <arosen@clemson.edu>
This commit is contained in:
Ben Pfaff
2011-09-08 16:30:20 -07:00
parent 0fe255dfbf
commit 18886b60bc
4 changed files with 27 additions and 14 deletions

View File

@@ -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;
}
@@ -979,9 +985,11 @@ dpif_netdev_execute(struct dpif *dpif,
}
flow_extract(&copy, 0, -1, &key);
dpif_netdev_flow_from_nlattrs(key_attrs, key_len, &key);
error = dp_netdev_execute_actions(dp, &copy, &key, actions, actions_len);
error = dpif_netdev_flow_from_nlattrs(key_attrs, key_len, &key);
if (!error) {
error = dp_netdev_execute_actions(dp, &copy, &key,
actions, actions_len);
}
if (mutates) {
ofpbuf_uninit(&copy);
}