Merge branch 'master' into net-next

This commit is contained in:
Stephen Hemminger 2017-11-01 22:15:00 +01:00
commit 5ee63855dc
2 changed files with 15 additions and 12 deletions

View File

@ -705,7 +705,8 @@ static int netns_set(int argc, char **argv)
{
char netns_path[PATH_MAX];
const char *name;
int netns, nsid;
unsigned int nsid;
int netns;
if (argc < 1) {
fprintf(stderr, "No netns name specified\n");
@ -716,7 +717,8 @@ static int netns_set(int argc, char **argv)
return -1;
}
name = argv[0];
nsid = atoi(argv[1]);
if (get_unsigned(&nsid, argv[1], 0))
invarg("Invalid \"netnsid\" value\n", argv[1]);
snprintf(netns_path, sizeof(netns_path), "%s/%s", NETNS_RUN_DIR, name);
netns = open(netns_path, O_RDONLY | O_CLOEXEC);

View File

@ -108,6 +108,7 @@ int netid_width;
int state_width;
int addr_width;
int serv_width;
char *odd_width_pad = "";
static const char *TCP_PROTO = "tcp";
static const char *SCTP_PROTO = "sctp";
@ -873,7 +874,7 @@ static void sock_state_print(struct sockstat *s)
printf("%-*s ", state_width, sstate_name[s->state]);
}
printf("%-6d %-6d ", s->rq, s->wq);
printf("%-6d %-6d %s", s->rq, s->wq, odd_width_pad);
}
static void sock_details_print(struct sockstat *s)
@ -3670,12 +3671,8 @@ static int netlink_show_one(struct filter *f,
else if (pid > 0)
getpidcon(pid, &pid_context);
if (pid_context != NULL) {
printf("proc_ctx=%-*s ", serv_width, pid_context);
free(pid_context);
} else {
printf("proc_ctx=%-*s ", serv_width, "unavailable");
}
printf(" proc_ctx=%s", pid_context ? : "unavailable");
free(pid_context);
}
if (show_details) {
@ -4548,8 +4545,10 @@ int main(int argc, char *argv[])
}
addrp_width = screen_width;
addrp_width -= netid_width+1;
addrp_width -= state_width+1;
if (netid_width)
addrp_width -= netid_width + 1;
if (state_width)
addrp_width -= state_width + 1;
addrp_width -= 14;
if (addrp_width&1) {
@ -4557,6 +4556,8 @@ int main(int argc, char *argv[])
netid_width++;
else if (state_width)
state_width++;
else
odd_width_pad = " ";
}
addrp_width /= 2;
@ -4574,7 +4575,7 @@ int main(int argc, char *argv[])
printf("%-*s ", netid_width, "Netid");
if (state_width)
printf("%-*s ", state_width, "State");
printf("%-6s %-6s ", "Recv-Q", "Send-Q");
printf("%-6s %-6s %s", "Recv-Q", "Send-Q", odd_width_pad);
}
/* Make enough space for the local/remote port field */