This diff is to be applied on top of my other diff on tech@ with subject
"ifconfig: merge switch_status() into bridge_status()".
It hooks completes the output of tpmr intefaces in what I think is the
simplest and least intrusive way.
tpmr is a trivial bridge and has no specific ioctls, so to distinguish
it from the rest we must rely on the interface name; assuming that it
is tpmr because neither is_bridge() nor is_switch() return success is
not possible due to the way ifconfig is designed: it runs all *_status()
commands for all interface types.
An alternative approach would be to make ifconfig try all the various
bridge related ioctls on all bridge-like interfaces and quiet down all
failures such output stays clean, but I dislike this shotgun approach
and prefer testing for different drivers where possible.
With this last piece in, I could finally document tpmr under ifconfig(8)
(and move on the next drivers in need of love).
Feedback? OK?
--- brconfig.c.orig Fri Jul 31 08:58:03 2020
+++ brconfig.c Fri Jul 31 09:16:59 2020
@@ -775,15 +775,28 @@
return (1);
}
+/* no tpmr(4) specific ioctls, name is enough if ifconfig.c:printif() passed */
+int
+is_tpmr(void)
+{
+ return (strncmp(ifname, "tpmr", sizeof("tpmr") - 1) == 0);
+}
+
void
bridge_status(void)
{
struct ifbrparam bp1, bp2;
- int isswitch = is_switch();
+ int isswitch;
+ if (is_tpmr()) {
+ bridge_list("\t");
+ return;
+ }
+
if (!is_bridge())
return;
+ isswitch = is_switch();
if (isswitch)
switch_cfg("\t");
else