diff options
author | Ilya Maximets <i.maximets@ovn.org> | 2021-12-17 01:05:57 +0100 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2021-12-17 21:31:55 +0100 |
commit | 11441385c2f788320799ba29b344098b917d8827 (patch) | |
tree | b7b66d27e07555ee99a04496c5063cc39a59c598 /vswitchd | |
parent | ec2aa2ab4689d156a5397e3379b8c9f7521473d4 (diff) | |
download | openvswitch-11441385c2f788320799ba29b344098b917d8827.tar.gz |
bridge: Fix incorrect configuration of netdev's dpif type.
netdev_set_dpif_type() can only be used with a normalized dpif type
as an argument, which is a constant static string derived from a type
of a dpif_class or a constant string "system". Usage of a same
constant string allows netdev-offload module to compare types by
simply comparing pointers.
OTOH, 'br->ofproto->type' is a dynamic string that:
a. Can be NULL.
b. Even if not NULL and equal, can be a different dynamically
allocated string.
Both these qualities breaks assumptions made by all other modules
related to HW offload, breaking the functionality.
Fix that by moving netdev_set_dpif_type() to dpif.c and calling with
a correct constant string as an argument.
The call moved from bridge.c to dpif.c, because we need to have access
to the dpif class, but bridge.c should not.
Not trying to set the dpif_type inside the netdev_ports_insert(),
because it's used now outside the offloading context. So, it's
cleaner to move the netdev_set_dpif_type() call outside of the
netdev-offload module.
Additionally removed the redundant call from the netdev_ports_insert()
and refactored the function, since it doesn't need an extra argument
anymore.
Fixes: 4f19a78a61c5 ("netdev-vport: Fix userspace tunnel ioctl(SIOCGIFINDEX) info logs.")
Reported-by: Roi Dayan <roid@nvidia.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2021-December/390117.html
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Reviewed-by: Lin Huang <linhuang@ruijie.com.cn>
Acked-by: Roi Dayan <roid@nvidia.com>
Diffstat (limited to 'vswitchd')
-rw-r--r-- | vswitchd/bridge.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 513ef7ea9..5223aa897 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -2052,8 +2052,6 @@ iface_do_create(const struct bridge *br, goto error; } - netdev_set_dpif_type(netdev, br->ofproto->type); - error = iface_set_netdev_config(iface_cfg, netdev, errp); if (error) { goto error; |