diff options
author | Mao YingMing <maoyingming@baidu.com> | 2021-02-26 17:48:59 +0800 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2021-03-01 22:20:52 +0100 |
commit | cdaa7e0fd60d94f95925f1a498f61698675deacc (patch) | |
tree | 5fee5c14e64297e84ab4b6364b1dff03e245c6a5 /tests/dpif-netdev.at | |
parent | 2ad201659cedbb1134a9d27af132e491173c7e40 (diff) | |
download | openvswitch-cdaa7e0fd60d94f95925f1a498f61698675deacc.tar.gz |
dpif-netdev: Fix crash when add dp flow without in_port field.
Userspace datapath relies on fact that every datapath flow has exact
match on the in_port, but flows without in_port match could be
added directly via dpctl commands. Even though dpctl is a debug
interface, datapath should just reject such flows instead of
crashing on assertion.
Fix the following crash and add a unit test for this issue
to tests/dpif-netdev.at:
$ ovs-appctl dpctl/add-flow "eth(),eth_type(0x0800),ipv4()" "3"
unixctl|WARN|error communicating with unix:ovs-vswitchd.ctl: End of file
ovs-appctl: ovs-vswitchd: transaction error (End of file)
ovs-vswitchd.log record:
util(ovs-vswitchd)|EMER|lib/dpif-netdev.c:3638:
assertion match->wc.masks.in_port.odp_port == ODPP_NONE failed
in dp_netdev_flow_add()
daemon_unix(monitor)|ERR|2 crashes: pid 1995 died, killed (Aborted),
core dumped, restarting
Fix result:
$ ovs-appctl dpctl/add-flow "eth(),eth_type(0x0800),ipv4()" "3"
ovs-vswitchd: updating flow table (Invalid argument)
ovs-appctl: ovs-vswitchd: server returned an error
ovs-vswitchd.log record:
dpif_netdev|ERR|failed to put[create] flow: in_port is not an exact match
dpif|WARN|netdev@ovs-netdev: failed to put[create] (Invalid argument)
ufid:7e...d1 eth(src=00..00,dst=00..00),eth_type(0x0800),
ipv4(src=0.0.0.0/0.0.0.0,dst=0.0.0.0/0.0.0.0,proto=0/0,tos=0/0,ttl=0/0), actions:3
Signed-off-by: Mao YingMing <maoyingming@baidu.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'tests/dpif-netdev.at')
-rw-r--r-- | tests/dpif-netdev.at | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/dpif-netdev.at b/tests/dpif-netdev.at index 2862a3c9b..3e6222557 100644 --- a/tests/dpif-netdev.at +++ b/tests/dpif-netdev.at @@ -589,3 +589,20 @@ arp,in_port=ANY,dl_vlan=11,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09: DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS_VID_ARP([dummy]) DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS_VID_ARP([dummy-pmd]) + +AT_SETUP([dpif-netdev - check dpctl/add-flow in_port exact match]) +OVS_VSWITCHD_START( + [add-port br0 p1 \ + -- set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p0.sock \ + -- set bridge br0 datapath-type=dummy \ + other-config:datapath-id=1234 fail-mode=secure]) + +AT_CHECK([ovs-appctl dpctl/add-flow "eth(),eth_type(0x0800),ipv4()" "3"], [2], +[], [dnl +ovs-vswitchd: updating flow table (Invalid argument) +ovs-appctl: ovs-vswitchd: server returned an error +]) +OVS_WAIT_UNTIL([grep "flow: in_port is not an exact match" ovs-vswitchd.log]) +OVS_VSWITCHD_STOP(["/flow: in_port is not an exact match/d +/failed to put/d"]) +AT_CLEANUP |