diff mbox series

[PATCHv2] teamd: return 0 if tdport doesn't exist in teamd_config_port_set

Message ID 0e1d909ddd8362c37a2ccd604793b95c763a18ca.1562067043.git.lucien.xin@gmail.com (mailing list archive)
State New
Headers show
Series [PATCHv2] teamd: return 0 if tdport doesn't exist in teamd_config_port_set | expand

Commit Message

Xin Long July 2, 2019, 11:30 a.m. UTC
This issue can be reproduced by doing:

  # ip link add dummy1 type dummy
  # teamd -t team0 -c '{"runner": {"name": "activebackup"}}' -d
  # teamdctl team0 port config update dummy1 '{"prio": -10}'
  # ip link set dummy0 master team0

and the error shows:

  libteamdctl: usock: Error message received: "ConfigUpdateFail"
  libteamdctl: usock: Error message content: "Failed to update config."
  command call failed (Invalid argument)

It's a regression caused by Commit c8b356a3cd36 ("teamd: config: update
local prio to kernel") where it requires the tdport has to exist when
a tdport config is being updated. However teamd supports for the port
config going first before the port being enslaved.

This issue breaks how NM-team starts a team device. Here to fix it by
returning 0 even if the tdport doesn't exist in teamd_config_port_set.

Reported-by: Radek Vykydal <rvykydal@redhat.com>
Fixes: c8b356a3cd36 ("teamd: config: update local prio to kernel")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 teamd/teamd_config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jiri Pirko July 2, 2019, 1:15 p.m. UTC | #1
Tue, Jul 02, 2019 at 01:30:43PM CEST, lucien.xin@gmail.com wrote:
>This issue can be reproduced by doing:
>
>  # ip link add dummy1 type dummy
>  # teamd -t team0 -c '{"runner": {"name": "activebackup"}}' -d
>  # teamdctl team0 port config update dummy1 '{"prio": -10}'
>  # ip link set dummy0 master team0
>
>and the error shows:
>
>  libteamdctl: usock: Error message received: "ConfigUpdateFail"
>  libteamdctl: usock: Error message content: "Failed to update config."
>  command call failed (Invalid argument)
>
>It's a regression caused by Commit c8b356a3cd36 ("teamd: config: update
>local prio to kernel") where it requires the tdport has to exist when
>a tdport config is being updated. However teamd supports for the port
>config going first before the port being enslaved.
>
>This issue breaks how NM-team starts a team device. Here to fix it by
>returning 0 even if the tdport doesn't exist in teamd_config_port_set.
>
>Reported-by: Radek Vykydal <rvykydal@redhat.com>
>Fixes: c8b356a3cd36 ("teamd: config: update local prio to kernel")
>Signed-off-by: Xin Long <lucien.xin@gmail.com>

applied, thanks!
diff mbox series

Patch

diff --git a/teamd/teamd_config.c b/teamd/teamd_config.c
index 34fef1f..1bf85ac 100644
--- a/teamd/teamd_config.c
+++ b/teamd/teamd_config.c
@@ -164,7 +164,7 @@  static int teamd_config_port_set(struct teamd_context *ctx, const char *port_nam
 
 	tdport = teamd_get_port_by_ifname(ctx, port_name);
 	if (!tdport)
-		return -ENODEV;
+		return 0;
 
 	config = json_object_get(port_obj, "prio");
 	if (json_is_integer(config)) {