mbox series

[iproute2-next,v3,0/2] pretty-print LACP slave state

Message ID 1577794502-8063-1-git-send-email-aroulin@cumulusnetworks.com
Headers show
Series pretty-print LACP slave state | expand

Message

Andy Roulin Dec. 31, 2019, 12:15 p.m. UTC
Print the bond slave 802.3ad/LACP state in a human-readable way.
The LACP bond slave actor/partner state definitions are exported
to userspace in the kernel include/uapi.

rtnetlink sends the bond slave state to userspace, see
 - IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE; and
 - IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE

and these are only printed as numbers, e.g.,

ad_actor_oper_port_state 15

Add an additional output in ip link show that prints a string describing
the individual 3ad bit meanings.

ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync>

JSON output is also supported, the field becomes a json array:

"ad_actor_oper_port_state_str":
	["active","short_timeout","aggregating","in_sync"]

These changes are dependent on a kernel change to uapi/ in net-next;
the following patches are the changes and are already in net-next:
[PATCH net-next v2] bonding: move 802.3ad port state flags to uapi
[PATCH net-next v2] bonding: rename AD_STATE_* to LACP_STATE_*

v2:
 - address patch format and comments

v3:
 - prefix state defines with LACP_*

Andy Roulin (2):
  include/uapi: update bonding kernel header
  iplink: bond: print 3ad actor/partner oper states as strings

 include/uapi/linux/if_bonding.h | 16 +++++++--------
 ip/iplink_bond_slave.c          | 36 +++++++++++++++++++++++++++++----
 2 files changed, 40 insertions(+), 12 deletions(-)