diff mbox

teamd: do not process lacpdu before the port ifinfo is set

Message ID 03dad1d0e40ad18d2965fdc924506d701bf38f82.1507702658.git.lucien.xin@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Xin Long Oct. 11, 2017, 6:17 a.m. UTC
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 <ptalbert@redhat.com>
Tested-by: Patrick Talbert <ptalbert@redhat.com>

Signed-off-by: Xin Long <lucien.xin@gmail.com>

---
 teamd/teamd_runner_lacp.c | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.1.0

Comments

Jiri Pirko Oct. 19, 2017, 3:19 p.m. UTC | #1
Wed, Oct 11, 2017 at 08:17:38AM CEST, lucien.xin@gmail.com wrote:
>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 <ptalbert@redhat.com>

>Tested-by: Patrick Talbert <ptalbert@redhat.com>

>Signed-off-by: Xin Long <lucien.xin@gmail.com>


applied, thanks!
diff mbox

Patch

diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index 5601278..1310f67 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;