Skip to content

Commit fad80ab

Browse files
Vadim PodovinnikovFerruh Yigit
authored andcommitted
net/bonding: fix LACP system address check
In bond (LACP) we have several NICs (ports), when we have negotiation with peer about what port we prefer, we send information about what system we preferred in partner system name field. Peer also sends us what partner system name it prefer. When we receive a message from it we must compare its preferred system name with our system name, but not with our port mac address In my test I have several problems with that: 1. If master port (mac address same as system address) shuts down (I have two ports) I loose connection 2. If secondary port (mac address not same as system address) receives message before master port, my connection is not established. Fixes: 56cbc08 ("net/bonding: fix LACP negotiation") Cc: [email protected] Signed-off-by: Vadim Podovinnikov <[email protected]> Acked-by: Min Hu (Connor) <[email protected]>
1 parent 1e28e84 commit fad80ab

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

drivers/net/bonding/rte_eth_bond_8023ad.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,19 +804,34 @@ rx_machine_update(struct bond_dev_private *internals, uint16_t slave_id,
804804
struct rte_mbuf *lacp_pkt) {
805805
struct lacpdu_header *lacp;
806806
struct lacpdu_actor_partner_params *partner;
807+
struct port *port, *agg;
807808

808809
if (lacp_pkt != NULL) {
809810
lacp = rte_pktmbuf_mtod(lacp_pkt, struct lacpdu_header *);
810811
RTE_ASSERT(lacp->lacpdu.subtype == SLOW_SUBTYPE_LACP);
811812

812813
partner = &lacp->lacpdu.partner;
814+
port = &bond_mode_8023ad_ports[slave_id];
815+
agg = &bond_mode_8023ad_ports[port->aggregator_port_id];
816+
813817
if (rte_is_zero_ether_addr(&partner->port_params.system) ||
814818
rte_is_same_ether_addr(&partner->port_params.system,
815-
&internals->mode4.mac_addr)) {
819+
&agg->actor.system)) {
816820
/* This LACP frame is sending to the bonding port
817821
* so pass it to rx_machine.
818822
*/
819823
rx_machine(internals, slave_id, &lacp->lacpdu);
824+
} else {
825+
char preferred_system_name[RTE_ETHER_ADDR_FMT_SIZE];
826+
char self_system_name[RTE_ETHER_ADDR_FMT_SIZE];
827+
828+
rte_ether_format_addr(preferred_system_name,
829+
RTE_ETHER_ADDR_FMT_SIZE, &partner->port_params.system);
830+
rte_ether_format_addr(self_system_name,
831+
RTE_ETHER_ADDR_FMT_SIZE, &agg->actor.system);
832+
MODE4_DEBUG("preferred partner system %s "
833+
"is not equal with self system: %s\n",
834+
preferred_system_name, self_system_name);
820835
}
821836
rte_pktmbuf_free(lacp_pkt);
822837
} else

0 commit comments

Comments
 (0)