From 44cb163fa64e1ae22522f16fe1011bbe8b6e9ea9 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Wed, 13 Apr 2011 15:44:37 -0700 Subject: [PATCH] lacp: New function lacp_slave_is_current(). Used in future patches. --- lib/lacp.c | 9 +++++++++ lib/lacp.h | 1 + 2 files changed, 10 insertions(+) diff --git a/lib/lacp.c b/lib/lacp.c index ee7967724..9b3b14b5c 100644 --- a/lib/lacp.c +++ b/lib/lacp.c @@ -269,6 +269,15 @@ lacp_slave_get_port_id(const struct lacp *lacp, const void *slave_) return slave->port_id; } +/* Returns true if partner information on 'slave_' is up to date. 'slave_' + * not being current, generally indicates a connectivity problem, or a + * misconfigured (or broken) partner. */ +bool +lacp_slave_is_current(const struct lacp *lacp, const void *slave_) +{ + return slave_lookup(lacp, slave_)->status == LACP_CURRENT; +} + /* This function should be called periodically to update 'lacp'. */ void lacp_run(struct lacp *lacp, lacp_send_pdu *send_pdu) diff --git a/lib/lacp.h b/lib/lacp.h index 38c8f6eb4..2992bcfd7 100644 --- a/lib/lacp.h +++ b/lib/lacp.h @@ -52,6 +52,7 @@ void lacp_slave_unregister(struct lacp *, const void *slave); void lacp_slave_carrier_changed(const struct lacp *, const void *slave); bool lacp_slave_may_enable(const struct lacp *, const void *slave); uint16_t lacp_slave_get_port_id(const struct lacp *, const void *slave); +bool lacp_slave_is_current(const struct lacp *, const void *slave_); /* Callback function for lacp_run() for sending a LACP PDU. */ typedef void lacp_send_pdu(void *slave, const struct lacp_pdu *); -- 2.43.0