aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorAndrew Thompson <thompsa@FreeBSD.org>2005-10-07 00:32:16 +0000
committerAndrew Thompson <thompsa@FreeBSD.org>2005-10-07 00:32:16 +0000
commita33a86ea1fe77c131c825f5cabbf55b52d8880fe (patch)
tree428ce521c8f7323ab35a5b18c7097914d129328c /sbin
parent0694506637996133bf6d7573f341cde54159ba8b (diff)
downloadsrc-a33a86ea1fe77c131c825f5cabbf55b52d8880fe.tar.gz
src-a33a86ea1fe77c131c825f5cabbf55b52d8880fe.zip
Display the status of the spanning tree for each port.
member: xl0 flags=7<LEARNING,DISCOVER,STP> member: gem0 flags=7<LEARNING,DISCOVER,STP> to: member: xl0 flags=7<LEARNING,DISCOVER,STP> port 3 priority 128 path cost 55 forwarding member: gem0 flags=7<LEARNING,DISCOVER,STP> port 1 priority 128 path cost 55 learning
Notes
Notes: svn path=/head/; revision=151040
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ifconfig/ifbridge.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c
index bf41ea8af8b8..36e308bb7655 100644
--- a/sbin/ifconfig/ifbridge.c
+++ b/sbin/ifconfig/ifbridge.c
@@ -111,7 +111,7 @@ do_bridgeflag(int sock, const char *ifs, int flag, int set)
}
static void
-bridge_interfaces(int s, const char *prefix, int flags)
+bridge_interfaces(int s, const char *prefix)
{
static const char *stpstates[] = {
"disabled",
@@ -123,8 +123,18 @@ bridge_interfaces(int s, const char *prefix, int flags)
struct ifbifconf bifc;
struct ifbreq *req;
char *inbuf = NULL, *ninbuf;
+ char *p, *pad;
int i, len = 8192;
+ pad = strdup(prefix);
+ if (pad == NULL)
+ err(1, "strdup");
+ /* replace the prefix with whitespace */
+ for (p = pad; *p != '\0'; p++) {
+ if(isprint(*p))
+ *p = ' ';
+ }
+
for (;;) {
ninbuf = realloc(inbuf, len);
if (ninbuf == NULL)
@@ -144,12 +154,10 @@ bridge_interfaces(int s, const char *prefix, int flags)
printb("flags", req->ifbr_ifsflags, IFBIFBITS);
printf("\n");
- if (!flags) continue;
-
- printf("%s\t", prefix);
- printf("port %u priority %u",
- req->ifbr_portno, req->ifbr_priority);
if (req->ifbr_ifsflags & IFBIF_STP) {
+ printf("%s", pad);
+ printf("port %u priority %u",
+ req->ifbr_portno, req->ifbr_priority);
printf(" path cost %u", req->ifbr_path_cost);
if (req->ifbr_state <
sizeof(stpstates) / sizeof(stpstates[0]))
@@ -157,8 +165,8 @@ bridge_interfaces(int s, const char *prefix, int flags)
else
printf(" <unknown state %d>",
req->ifbr_state);
+ printf("\n");
}
- printf("\n");
}
free(inbuf);
@@ -225,7 +233,7 @@ bridge_status(int s)
printf("\tpriority %u hellotime %u fwddelay %u maxage %u\n",
pri, ht, fd, ma);
- bridge_interfaces(s, "\tmember: ", 0);
+ bridge_interfaces(s, "\tmember: ");
return;