bridge_status() and switch_status() do the regular sanity check with SIOCGIFFLAGS, but both functions also call is_switch(), bridge_status() also calls is_bridge().
Those is_*() helpers do the same SIOCGIFFLAGS sanity check, making those in *_status() entirely redundant, so I'd like to remove them. I'm here since the tpmr(4) ioctl interface transition from trunk to bridge semantics is now complete, so ifconfig(8) now requires tpmr bits to show its members in bridge fashion. One way would be duplicate code into is_tpmr() and tpmr_status() which I've already done, but another approach is to unify all bridge like interfaces under bridge_status(). Either ways, diff below cleans up and makes for simpler code. Feedback? OK? Index: brconfig.c =================================================================== RCS file: /cvs/src/sbin/ifconfig/brconfig.c,v retrieving revision 1.25 diff -u -p -r1.25 brconfig.c --- brconfig.c 22 Jan 2020 06:24:07 -0000 1.25 +++ brconfig.c 28 Jul 2020 17:02:05 -0000 @@ -783,16 +783,11 @@ is_bridge() void bridge_status(void) { - struct ifreq ifr; struct ifbrparam bp1, bp2; if (!is_bridge() || is_switch()) return; - strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); - if (ioctl(sock, SIOCGIFFLAGS, (caddr_t)&ifr) == -1) - return; - bridge_cfg("\t"); bridge_list("\t"); @@ -1184,13 +1179,7 @@ switch_cfg(char *delim) void switch_status(void) { - struct ifreq ifr; - if (!is_switch()) - return; - - strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); - if (ioctl(sock, SIOCGIFFLAGS, (caddr_t)&ifr) == -1) return; switch_cfg("\t");