From 45912ded9cb5166d8286a6a4fb53bfe9fffcd8a9 Mon Sep 17 00:00:00 2001 Message-Id: <45912ded9cb5166d8286a6a4fb53bfe9fffcd8a9.1518009078.git.mleitner@redhat.com> From: Xin Long Date: Wed, 11 Oct 2017 14:17:38 +0800 Subject: [PATCH] teamd: do not process lacpdu before the port ifinfo is set Now the port ifinfo will be set in obj_input_newlink when a RTM_NEWLINK event is received. But when a port is being added, if a lacpdu gets received on this port before the RTM_NEWLINK event, lacpdu_recv will process the packet with incorrect port ifinfo. In Patrick's case, as ifinfo->master_ifindex was 0, it would skip this port in teamd_for_each_tdport, which caused lacp_port->agg_lead not to be updated in lacp_switch_agg_lead. Later the lacp_port actor would go to a unexpected state. This patch is to avoid it by checking teamd_port_present in lacpdu_recv so that it would not process lacpdu before the port ifinfo is set. Reported-by: Patrick Talbert Tested-by: Patrick Talbert Signed-off-by: Xin Long Reviewed-by: Marcelo Ricardo Leitner Signed-off-by: Jiri Pirko Signed-off-by: Marcelo Ricardo Leitner --- teamd/teamd_runner_lacp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c index 5601278696a9f263f6bfe71642b2db971c9314b9..1310f6737f6cf37b7d6fef0befb8c803178212bd 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c @@ -1075,6 +1075,9 @@ static int lacpdu_recv(struct lacp_port *lacp_port) if (err <= 0) return err; + if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) + return 0; + if (!lacpdu_check(&lacpdu)) { teamd_log_warn("malformed LACP PDU came."); return 0; -- 2.14.3