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
This commit is contained in:
parent
0694506637
commit
a33a86ea1f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=151040
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user