Commit 93d41b1a authored by Pavel Emelyanov's avatar Pavel Emelyanov

inet: Disable dumping of shutdown sockets

This requires more work than for unix sockets. For now
report that we cannot do it.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 48042e65
...@@ -109,9 +109,10 @@ enum { ...@@ -109,9 +109,10 @@ enum {
INET_DIAG_TOS, INET_DIAG_TOS,
INET_DIAG_TCLASS, INET_DIAG_TCLASS,
INET_DIAG_SKMEMINFO, INET_DIAG_SKMEMINFO,
INET_DIAG_SHUTDOWN,
}; };
#define INET_DIAG_MAX INET_DIAG_SKMEMINFO #define INET_DIAG_MAX INET_DIAG_SHUTDOWN
/* INET_DIAG_MEM */ /* INET_DIAG_MEM */
......
...@@ -28,6 +28,7 @@ struct inet_sk_desc { ...@@ -28,6 +28,7 @@ struct inet_sk_desc {
unsigned int wqlen; unsigned int wqlen;
unsigned int src_addr[4]; unsigned int src_addr[4];
unsigned int dst_addr[4]; unsigned int dst_addr[4];
unsigned short shutdown;
int rfd; int rfd;
struct list_head rlist; struct list_head rlist;
......
...@@ -95,6 +95,11 @@ static int can_dump_inet_sk(const struct inet_sk_desc *sk) ...@@ -95,6 +95,11 @@ static int can_dump_inet_sk(const struct inet_sk_desc *sk)
return 0; return 0;
} }
if (sk->shutdown) {
pr_err("Can't dump shutdown inet socket\n");
return 0;
}
if (sk->type == SOCK_DGRAM) if (sk->type == SOCK_DGRAM)
return 1; return 1;
...@@ -323,6 +328,11 @@ int inet_collect_one(struct nlmsghdr *h, int family, int type, int proto) ...@@ -323,6 +328,11 @@ int inet_collect_one(struct nlmsghdr *h, int family, int type, int proto)
parse_rtattr(tb, INET_DIAG_MAX, (struct rtattr *)(m + 1), parse_rtattr(tb, INET_DIAG_MAX, (struct rtattr *)(m + 1),
h->nlmsg_len - NLMSG_LENGTH(sizeof(*m))); h->nlmsg_len - NLMSG_LENGTH(sizeof(*m)));
if (!tb[INET_DIAG_SHUTDOWN]) {
pr_err("Can't check shutdown state of inet socket\n");
return -1;
}
d = xzalloc(sizeof(*d)); d = xzalloc(sizeof(*d));
if (!d) if (!d)
return -1; return -1;
...@@ -336,6 +346,7 @@ int inet_collect_one(struct nlmsghdr *h, int family, int type, int proto) ...@@ -336,6 +346,7 @@ int inet_collect_one(struct nlmsghdr *h, int family, int type, int proto)
d->wqlen = m->idiag_wqueue; d->wqlen = m->idiag_wqueue;
memcpy(d->src_addr, m->id.idiag_src, sizeof(u32) * 4); memcpy(d->src_addr, m->id.idiag_src, sizeof(u32) * 4);
memcpy(d->dst_addr, m->id.idiag_dst, sizeof(u32) * 4); memcpy(d->dst_addr, m->id.idiag_dst, sizeof(u32) * 4);
d->shutdown = *(u8 *)RTA_DATA(tb[INET_DIAG_SHUTDOWN]);
ret = sk_collect_one(m->idiag_inode, family, &d->sd); ret = sk_collect_one(m->idiag_inode, family, &d->sd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment