Print the status on the first line of a socket description, not at
the last one. This doesn't matter for TCP, but it does for the upcoming SCTP support. PR: 201585 MFC after: 3 weeks
This commit is contained in:
parent
612c465eed
commit
4e13a5b043
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=287178
@ -911,7 +911,7 @@ static void
|
|||||||
displaysock(struct sock *s, int pos)
|
displaysock(struct sock *s, int pos)
|
||||||
{
|
{
|
||||||
void *p;
|
void *p;
|
||||||
int hash;
|
int hash, first;
|
||||||
struct addr *laddr, *faddr;
|
struct addr *laddr, *faddr;
|
||||||
struct sock *s_tmp;
|
struct sock *s_tmp;
|
||||||
|
|
||||||
@ -924,6 +924,7 @@ displaysock(struct sock *s, int pos)
|
|||||||
pos += xprintf("6 ");
|
pos += xprintf("6 ");
|
||||||
laddr = s->laddr;
|
laddr = s->laddr;
|
||||||
faddr = s->faddr;
|
faddr = s->faddr;
|
||||||
|
first = 1;
|
||||||
while (laddr != NULL || faddr != NULL) {
|
while (laddr != NULL || faddr != NULL) {
|
||||||
while (pos < 36)
|
while (pos < 36)
|
||||||
pos += xprintf(" ");
|
pos += xprintf(" ");
|
||||||
@ -975,6 +976,14 @@ displaysock(struct sock *s, int pos)
|
|||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
if (first && opt_s && s->proto == IPPROTO_TCP) {
|
||||||
|
while (pos < 80)
|
||||||
|
pos += xprintf(" ");
|
||||||
|
if (s->state >= 0 && s->state < TCP_NSTATES)
|
||||||
|
pos += xprintf("%s", tcpstates[s->state]);
|
||||||
|
else
|
||||||
|
pos += xprintf("?");
|
||||||
|
}
|
||||||
if (laddr != NULL)
|
if (laddr != NULL)
|
||||||
laddr = laddr->next;
|
laddr = laddr->next;
|
||||||
if (faddr != NULL)
|
if (faddr != NULL)
|
||||||
@ -983,15 +992,9 @@ displaysock(struct sock *s, int pos)
|
|||||||
xprintf("\n");
|
xprintf("\n");
|
||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
|
first = 0;
|
||||||
}
|
}
|
||||||
if (opt_s && s->proto == IPPROTO_TCP) {
|
xprintf("\n");
|
||||||
while (pos < 80)
|
|
||||||
pos += xprintf(" ");
|
|
||||||
if (s->state >= 0 && s->state < TCP_NSTATES)
|
|
||||||
pos += xprintf("%s", tcpstates[s->state]);
|
|
||||||
else
|
|
||||||
pos += xprintf("?");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1036,7 +1039,6 @@ display(void)
|
|||||||
pos += xprintf(" ");
|
pos += xprintf(" ");
|
||||||
pos += xprintf("%d ", xf->xf_fd);
|
pos += xprintf("%d ", xf->xf_fd);
|
||||||
displaysock(s, pos);
|
displaysock(s, pos);
|
||||||
xprintf("\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opt_j >= 0)
|
if (opt_j >= 0)
|
||||||
@ -1051,7 +1053,6 @@ display(void)
|
|||||||
pos += xprintf("%-8s %-10s %-5s %-2s ",
|
pos += xprintf("%-8s %-10s %-5s %-2s ",
|
||||||
"?", "?", "?", "?");
|
"?", "?", "?", "?");
|
||||||
displaysock(s, pos);
|
displaysock(s, pos);
|
||||||
xprintf("\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user