[ovs-git] [openvswitch/ovs] 3982ae: dpif-netdev: Fix crash when add dp flow without in...

Ilya Maximets noreply at github.com
Tue Mar 2 09:49:06 UTC 2021


  Branch: refs/heads/branch-2.15
  Home:   https://github.com/openvswitch/ovs
  Commit: 3982aee455b86e7e2bf2603ac1e903708856a000
      https://github.com/openvswitch/ovs/commit/3982aee455b86e7e2bf2603ac1e903708856a000
  Author: Mao YingMing <maoyingming at baidu.com>
  Date:   2021-03-01 (Mon, 01 Mar 2021)

  Changed paths:
    M lib/dpif-netdev.c
    M tests/dpif-netdev.at

  Log Message:
  -----------
  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 at 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 at baidu.com>
Signed-off-by: Ilya Maximets <i.maximets at ovn.org>




More information about the git mailing list