shrink ifconfig trunkport output a bit

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

shrink ifconfig trunkport output a bit

David Gwynne-5
this makes ifconfig output for a trunk/aggr look a bit smaller:

this is before the change:

aggr0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 9000
        lladdr bc:2c:55:9e:34:cb
        index 7 priority 0 llprio 7
        trunk: trunkproto lacp
        trunk id: [(8000,bc:2c:55:9e:34:cb,0007,0000,0000),
                 (8000,54:7f:ee:7b:a9:c1,0003,0000,0000)]
                trunkport ix0 lacp_state actor activity,aggregation,sync,collecting,distributing
                trunkport ix0 lacp_state actor system pri 0x8000 mac bc:2c:55:9e:34:cb, key 0x7, port pri 0x8000 number 0x1
                trunkport ix0 lacp_state partner activity,aggregation,sync,collecting,distributing
                trunkport ix0 lacp_state partner system pri 0x8000 mac 54:7f:ee:7b:a9:c1, key 0x3, port pri 0x8000 number 0x109
                trunkport ix0 active,collecting,distributing
                trunkport ix1 lacp_state actor activity,aggregation,sync,collecting,distributing
                trunkport ix1 lacp_state actor system pri 0x8000 mac bc:2c:55:9e:34:cb, key 0x7, port pri 0x8000 number 0x2
                trunkport ix1 lacp_state partner activity,aggregation,sync,collecting,distributing
                trunkport ix1 lacp_state partner system pri 0x8000 mac 54:7f:ee:7b:a9:c1, key 0x3, port pri 0x8000 number 0x10a
                trunkport ix1 active,collecting,distributing
        groups: aggr
        media: Ethernet autoselect
        status: active

this is after:

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)]
                ixl0 lacp actor system pri 0x8000 mac fe:e1:ba:d0:35:21, key 0xa, port pri 0x8000 number 0x4
                ixl0 lacp actor state aggregation,sync,collecting,distributing
                ixl0 lacp partner system pri 0x8000 mac 00:01:e8:d7:b0:34, key 0x34, port pri 0x8000 number 0xb6
                ixl0 lacp partner state activity,timeout,aggregation,sync,collecting,distributing
                ixl0 port active,collecting,distributing
                ixl1 lacp actor system pri 0x8000 mac fe:e1:ba:d0:35:21, key 0xa, port pri 0x8000 number 0x5
                ixl1 lacp actor state aggregation,sync,collecting,distributing
                ixl1 lacp partner system pri 0x8000 mac 00:01:e8:d7:b0:34, key 0x34, port pri 0x8000 number 0xb2
                ixl1 lacp partner state activity,timeout,aggregation,sync,collecting,distributing
                ixl1 port active,collecting,distributing
        groups: aggr
        media: Ethernet autoselect
        status: active

ok?

Index: ifconfig.c
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.405
diff -u -p -r1.405 ifconfig.c
--- ifconfig.c 24 Jul 2019 01:48:53 -0000 1.405
+++ ifconfig.c 24 Jul 2019 06:05:09 -0000
@@ -4509,12 +4509,7 @@ trunk_status(void)
  for (i = 0; i < ra.ra_ports; i++) {
  lp = (struct lacp_opreq *)&(rpbuf[i].rp_lacpreq);
  if (ra.ra_proto == TRUNK_PROTO_LACP) {
- printf("\t\ttrunkport %s lacp_state actor ",
-    rpbuf[i].rp_portname);
- printb_status(lp->actor_state,
-    LACP_STATE_BITS);
- putchar('\n');
- printf("\t\ttrunkport %s lacp_state actor "
+ printf("\t\t%s lacp actor "
     "system pri 0x%x mac %s, key 0x%x, "
     "port pri 0x%x number 0x%x\n",
     rpbuf[i].rp_portname,
@@ -4523,12 +4518,13 @@ trunk_status(void)
      lp->actor_mac),
     lp->actor_key,
     lp->actor_portprio, lp->actor_portno);
- printf("\t\ttrunkport %s lacp_state partner ",
+ printf("\t\t%s lacp actor state ",
     rpbuf[i].rp_portname);
- printb_status(lp->partner_state,
+ printb_status(lp->actor_state,
     LACP_STATE_BITS);
  putchar('\n');
- printf("\t\ttrunkport %s lacp_state partner "
+
+ printf("\t\t%s lacp partner "
     "system pri 0x%x mac %s, key 0x%x, "
     "port pri 0x%x number 0x%x\n",
     rpbuf[i].rp_portname,
@@ -4537,9 +4533,14 @@ trunk_status(void)
      lp->partner_mac),
     lp->partner_key,
     lp->partner_portprio, lp->partner_portno);
+ printf("\t\t%s lacp partner state ",
+    rpbuf[i].rp_portname);
+ printb_status(lp->partner_state,
+    LACP_STATE_BITS);
+ putchar('\n');
  }
 
- printf("\t\ttrunkport %s ", rpbuf[i].rp_portname);
+ printf("\t\t%s port ", rpbuf[i].rp_portname);
  printb_status(rpbuf[i].rp_flags, TRUNK_PORT_BITS);
  putchar('\n');
  }