make ifconfig print lacp actor and partner info

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

make ifconfig print lacp actor and partner info

David Gwynne-5
this adds a couple of lines to the lacp output so you can see what
params are used on the wire. this can help if you've put switchports in
different port-channels or such. an example of that is:

aggr0: flags=8847<UP,BROADCAST,DEBUG,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        lladdr fe:e1:ba:d0:35:21
        index 10 priority 0 llprio 7
        trunk: trunkproto lacp
        trunk id: [(8000,fe:e1:ba:d0:35:21,000A,0000,0000),
                 (8000,00:01:e8:d7:b0:34,0034,0000,0000)]
                trunkport ixl0 lacp_state actor aggregation,sync,collecting,distributing
                trunkport ixl0 lacp_state actor system pri 0x8000 mac fe:e1:ba:d0:35:21, key 0xa, port pri 0x8000 number 0x4
                trunkport ixl0 lacp_state partner activity,timeout,aggregation,sync,collecting,distributing
                trunkport ixl0 lacp_state partner system pri 0x8000 mac 00:01:e8:d7:b0:34, key 0x34, port pri 0x8000 number 0xb6
                trunkport ixl0 active,collecting,distributing
                trunkport ixl1 lacp_state actor aggregation
                trunkport ixl1 lacp_state actor system pri 0x8000 mac fe:e1:ba:d0:35:21, key 0xa, port pri 0x8000 number 0x5
                trunkport ixl1 lacp_state partner activity,timeout,aggregation,sync
                trunkport ixl1 lacp_state partner system pri 0x8000 mac 00:01:e8:d7:b0:34, key 0x30, port pri 0x8000 number 0xb2
                trunkport ixl1
        groups: aggr
        media: Ethernet autoselect
        status: active

the keys (and system mac) must match before ports will be considered
part of the same aggregation. after fixing one of the switch ports:

aggr0: flags=8847<UP,BROADCAST,DEBUG,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        lladdr fe:e1:ba:d0:35:21
        index 10 priority 0 llprio 7
        trunk: trunkproto lacp
        trunk id: [(8000,fe:e1:ba:d0:35:21,000A,0000,0000),
                 (8000,00:01:e8:d7:b0:34,0034,0000,0000)]
                trunkport ixl0 lacp_state actor aggregation,sync,collecting,distributing
                trunkport ixl0 lacp_state actor system pri 0x8000 mac fe:e1:ba:d0:35:21, key 0xa, port pri 0x8000 number 0x4
                trunkport ixl0 lacp_state partner activity,timeout,aggregation,sync,collecting,distributing
                trunkport ixl0 lacp_state partner system pri 0x8000 mac 00:01:e8:d7:b0:34, key 0x34, port pri 0x8000 number 0xb6
                trunkport ixl0 active,collecting,distributing
                trunkport ixl1 lacp_state actor aggregation,sync,collecting,distributing
                trunkport ixl1 lacp_state actor system pri 0x8000 mac fe:e1:ba:d0:35:21, key 0xa, port pri 0x8000 number 0x5
                trunkport ixl1 lacp_state partner activity,timeout,aggregation,sync,collecting,distributing
                trunkport ixl1 lacp_state partner system pri 0x8000 mac 00:01:e8:d7:b0:34, key 0x34, port pri 0x8000 number 0xb2
                trunkport ixl1 active,collecting,distributing
        groups: aggr
        media: Ethernet autoselect
        status: active

i do think this output could be trimmed (a lot), but that's mostly about
the flags and should be done in the future.

ok?

Index: ifconfig.c
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.401
diff -u -p -r1.401 ifconfig.c
--- ifconfig.c 19 Apr 2019 04:24:25 -0000 1.401
+++ ifconfig.c 20 Jul 2019 04:54:59 -0000
@@ -4515,11 +4515,29 @@ trunk_status(void)
  printb_status(lp->actor_state,
     LACP_STATE_BITS);
  putchar('\n');
+ printf("\t\ttrunkport %s lacp_state actor "
+    "system pri 0x%x mac %s, key 0x%x, "
+    "port pri 0x%x number 0x%x\n",
+    rpbuf[i].rp_portname,
+    lp->actor_prio,
+    ether_ntoa((struct ether_addr*)
+     lp->actor_mac),
+    lp->actor_key,
+    lp->actor_portprio, lp->actor_portno);
  printf("\t\ttrunkport %s lacp_state partner ",
     rpbuf[i].rp_portname);
  printb_status(lp->partner_state,
     LACP_STATE_BITS);
  putchar('\n');
+ printf("\t\ttrunkport %s lacp_state partner "
+    "system pri 0x%x mac %s, key 0x%x, "
+    "port pri 0x%x number 0x%x\n",
+    rpbuf[i].rp_portname,
+    lp->partner_prio,
+    ether_ntoa((struct ether_addr*)
+     lp->partner_mac),
+    lp->partner_key,
+    lp->partner_portprio, lp->partner_portno);
  }
 
  printf("\t\ttrunkport %s ", rpbuf[i].rp_portname);