mirror of
https://github.com/openvswitch/ovs
synced 2025-10-11 13:57:52 +00:00
dpif-netdev: Make "packet-out" with in_port=OFPP_CONTROLLER work again.
Commit 4e022ec09e
(Create specific types for ofp and odp port) broke
OpenFlow OFPP_PACKET_OUT requests that use in_port=OFPP_CONTROLLER. This
commit fixes the problem and adds a regression test.
CC: Alex Wang <alexw@nicira.com>
Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -694,6 +694,8 @@ static int
|
||||
dpif_netdev_flow_from_nlattrs(const struct nlattr *key, uint32_t key_len,
|
||||
struct flow *flow)
|
||||
{
|
||||
odp_port_t in_port;
|
||||
|
||||
if (odp_flow_key_to_flow(key, key_len, flow) != ODP_FIT_PERFECT) {
|
||||
/* This should not happen: it indicates that odp_flow_key_from_flow()
|
||||
* and odp_flow_key_to_flow() disagree on the acceptable form of a
|
||||
@@ -713,7 +715,8 @@ dpif_netdev_flow_from_nlattrs(const struct nlattr *key, uint32_t key_len,
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (!is_valid_port_number(flow->in_port.odp_port)) {
|
||||
in_port = flow->in_port.odp_port;
|
||||
if (!is_valid_port_number(in_port) && in_port != ODPP_NONE) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
|
@@ -1487,6 +1487,7 @@ dnl controllers despite the spec) as meaning a packet that was generated
|
||||
dnl by the controller.
|
||||
AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)])
|
||||
OVS_VSWITCHD_START
|
||||
ADD_OF_PORTS([br0], [1])
|
||||
|
||||
# Start a monitor listening for packet-ins.
|
||||
AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile])
|
||||
@@ -1496,13 +1497,15 @@ ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
|
||||
AT_CAPTURE_FILE([monitor.log])
|
||||
|
||||
# Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port.
|
||||
AT_CHECK([ovs-ofctl packet-out br0 none controller '0001020304050010203040501234'])
|
||||
AT_CHECK([ovs-ofctl packet-out br0 controller controller '0001020304050010203040505678'])
|
||||
AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234'])
|
||||
AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678'])
|
||||
|
||||
# Stop the monitor and check its output.
|
||||
ovs-appctl -t ovs-ofctl ofctl/barrier
|
||||
ovs-appctl -t ovs-ofctl exit
|
||||
|
||||
ovs-ofctl dump-ports br0
|
||||
|
||||
AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl
|
||||
OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered)
|
||||
metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234
|
||||
|
Reference in New Issue
Block a user