teamd: fix possible race in master ifname callback

In teamd the messages from kernel are processed in order:

However, kernel sends the messages in a different order. See:
team_upper_dev_link() which generates ifinfo notification
__team_port_change_port_added() which generates ports notification
__team_options_change_check() which generates options notification

So there is a chance that the teamd processed only the port without
options and right after that it processes ifinfo.

Fix this by introducing teamd_port_enabled_check() which does not log
error and ignore the port in case this call fails. This is safe
as this is going to be handled by future
link_watch_enabled_option_changed() call.

Signed-off-by: Jiri Pirko <>
Fixes: 5f351666409f ("teamd: add port_master_ifindex_changed for link_watch_port_watch_ops")
Tested-by: Stepan Blyshchak <>
Reviewed-by: Xin Long <>
3 files changed