From 7eb756fab1a9abde6b55d7f83d525b5b5593077a Mon Sep 17 00:00:00 2001 From: Hiroki Sato Date: Sun, 5 Oct 2014 02:37:01 +0000 Subject: [PATCH] Use printb() for boolean flags in ro_opts and actor_state for LACP. --- sbin/ifconfig/iflagg.c | 17 +++++------------ sys/net/ieee8023ad_lacp.h | 2 ++ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/sbin/ifconfig/iflagg.c b/sbin/ifconfig/iflagg.c index 9c478b3dfc5f..51a6faa61963 100644 --- a/sbin/ifconfig/iflagg.c +++ b/sbin/ifconfig/iflagg.c @@ -17,6 +17,7 @@ static const char rcsid[] = #include #include #include +#include #include #include @@ -246,18 +247,9 @@ lagg_status(int s) putchar('\n'); if (verbose) { printf("\tlagg options:\n"); - printf("\t\tuse_flowid: %d\n", - (ro.ro_opts & LAGG_OPT_USE_FLOWID) ? 1 : 0); + printb("\t\tflags", ro.ro_opts, LAGG_OPT_BITS); + putchar('\n'); printf("\t\tflowid_shift: %d\n", ro.ro_flowid_shift); - switch (ra.ra_proto) { - case LAGG_PROTO_LACP: - printf("\t\tlacp_strict: %d\n", - (ro.ro_opts & LAGG_OPT_LACP_STRICT) ? 1 : 0); - printf("\t\tlacp_rxtest: %d\n", - (ro.ro_opts & LAGG_OPT_LACP_RXTEST) ? 1 : 0); - printf("\t\tlacp_txtest: %d\n", - (ro.ro_opts & LAGG_OPT_LACP_TXTEST) ? 1 : 0); - } printf("\tlagg statistics:\n"); printf("\t\tactive ports: %d\n", ro.ro_active); printf("\t\tflapping: %u\n", ro.ro_flapping); @@ -272,7 +264,8 @@ lagg_status(int s) printf("\tlaggport: %s ", rpbuf[i].rp_portname); printb("flags", rpbuf[i].rp_flags, LAGG_PORT_BITS); if (verbose && ra.ra_proto == LAGG_PROTO_LACP) - printf(" state=%X", lp->actor_state); + printb(" state", lp->actor_state, + LACP_STATE_BITS); putchar('\n'); if (verbose && ra.ra_proto == LAGG_PROTO_LACP) printf("\t\t%s\n", diff --git a/sys/net/ieee8023ad_lacp.h b/sys/net/ieee8023ad_lacp.h index 535cf1fd1dfa..e814f8321f81 100644 --- a/sys/net/ieee8023ad_lacp.h +++ b/sys/net/ieee8023ad_lacp.h @@ -75,6 +75,7 @@ "\007DEFAULTED" \ "\010EXPIRED" +#ifdef _KERNEL /* * IEEE802.3 slow protocols * @@ -336,3 +337,4 @@ lacp_isdistributing(struct lagg_port *lgp) #define LACP_LAGIDSTR_MAX \ (1 + LACP_PARTNERSTR_MAX + 1 + LACP_PARTNERSTR_MAX + 1) #define LACP_STATESTR_MAX (255) /* XXX */ +#endif /* _KERNEL */