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(+)
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;
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!
libteam@lists.fedorahosted.org