/* Note: the AD_PORT_MATCHED "variable" is not specified by 802.3ad; it is used here to implement the language from 802.3ad 43.4.9 that requires recordPDU to "match" the LACPDU parameters to the stored values.  */
static void __choose_matched(struct lacpdu *lacpdu, struct port *port)
/* Note: the AD_PORT_MATCHED "variable" is not specified by 802.3ad; it is used here to implement the language from 802.3ad 43.4.9 that requires recordPDU to "match" the LACPDU parameters to the stored values.  */
static void __choose_matched(struct lacpdu *lacpdu, struct port *port)
{
	if (((ntohs(lacpdu->partner_port) == port->actor_port_number) &&
	     (ntohs(lacpdu->partner_port_priority) == port->actor_port_priority) &&
	     !MAC_ADDRESS_COMPARE(&(lacpdu->partner_system), &(port->actor_system)) &&
	     (ntohs(lacpdu->partner_system_priority) == port->actor_system_priority) &&
	     (ntohs(lacpdu->partner_key) == port->actor_oper_port_key) &&
	     ((lacpdu->partner_state & AD_STATE_AGGREGATION) == (port->actor_oper_port_state & AD_STATE_AGGREGATION))) ||
	    ((lacpdu->actor_state & AD_STATE_AGGREGATION) == 0)
		) {
		port->sm_vars |= AD_PORT_MATCHED;
	} else {
		port->sm_vars &= ~AD_PORT_MATCHED;
	}
}