diff options
author | Eelco Chaudron <echaudro@redhat.com> | 2022-02-22 16:23:06 +0100 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2022-03-21 00:31:24 +0100 |
commit | db40eb79ec1a72ad1b658d53af56f6d39f95a24b (patch) | |
tree | 8b84b8cc7f261b68ff20e3a21896ed1aace3ad40 /lib/netdev-offload-tc.c | |
parent | b4868ee1637a17d59f9bc3d308e93d7e555f609b (diff) | |
download | openvswitch-db40eb79ec1a72ad1b658d53af56f6d39f95a24b.tar.gz |
netdev-offload-tc: Check for valid netdev ifindex in flow_put.
Verify that the returned ifindex by netdev_get_ifindex() is valid.
This might not be the case in the ERSPAN port scenario, which can
not be offloaded.
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'lib/netdev-offload-tc.c')
-rw-r--r-- | lib/netdev-offload-tc.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c index 93e89e88c..12d0a9af3 100644 --- a/lib/netdev-offload-tc.c +++ b/lib/netdev-offload-tc.c @@ -1837,7 +1837,25 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, VLOG_DBG_RL(&rl, "Can't find netdev for output port %d", port); return ENODEV; } + + if (!netdev_flow_api_equals(netdev, outdev)) { + VLOG_DBG_RL(&rl, + "Flow API provider mismatch between ingress (%s) " + "and egress (%s) ports", + netdev_get_name(netdev), netdev_get_name(outdev)); + netdev_close(outdev); + return EOPNOTSUPP; + } + action->out.ifindex_out = netdev_get_ifindex(outdev); + if (action->out.ifindex_out < 0) { + VLOG_DBG_RL(&rl, + "Can't find ifindex for output port %s, error %d", + netdev_get_name(outdev), action->out.ifindex_out); + netdev_close(outdev); + return -action->out.ifindex_out; + } + action->out.ingress = is_internal_port(netdev_get_type(outdev)); action->type = TC_ACT_OUTPUT; flower.action_count++; |