Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278807
b: refs/heads/master
c: 22931d3
h: refs/heads/master
i:
  278805: a094f1c
  278803: 71c0480
  278799: 1eef5d3
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Dec 16, 2011
1 parent 0f0cd11 commit feb76bb
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fa7ff56f75add89bbedaf2dfcfa8f6661e8e8b3a
refs/heads/master: 22931d3b906cd0a1726a49a09713f9220a5fab8a
24 changes: 24 additions & 0 deletions trunk/include/linux/unix_diag.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef __UNIX_DIAG_H__
#define __UNIX_DIAG_H__

struct unix_diag_req {
__u8 sdiag_family;
__u8 sdiag_protocol;
__u16 pad;
__u32 udiag_states;
__u32 udiag_ino;
__u32 udiag_show;
__u32 udiag_cookie[2];
};

struct unix_diag_msg {
__u8 udiag_family;
__u8 udiag_type;
__u8 udiag_state;
__u8 pad;

__u32 udiag_ino;
__u32 udiag_cookie[2];
};

#endif
57 changes: 57 additions & 0 deletions trunk/net/unix/diag.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/sock_diag.h>
#include <linux/unix_diag.h>
#include <linux/skbuff.h>
#include <net/netlink.h>
#include <net/af_unix.h>
#include <net/tcp_states.h>

#define UNIX_DIAG_PUT(skb, attrtype, attrlen) \
RTA_DATA(__RTA_PUT(skb, attrtype, attrlen))

static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
return 0;
}

static int unix_diag_get_exact(struct sk_buff *in_skb,
const struct nlmsghdr *nlh,
struct unix_diag_req *req)
{
return -EAFNOSUPPORT;
}

static int unix_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h)
{
int hdrlen = sizeof(struct unix_diag_req);

if (nlmsg_len(h) < hdrlen)
return -EINVAL;

if (h->nlmsg_flags & NLM_F_DUMP)
return netlink_dump_start(sock_diag_nlsk, skb, h,
unix_diag_dump, NULL, 0);
else
return unix_diag_get_exact(skb, h, (struct unix_diag_req *)NLMSG_DATA(h));
}

static struct sock_diag_handler unix_diag_handler = {
.family = AF_UNIX,
.dump = unix_diag_handler_dump,
};

static int __init unix_diag_init(void)
{
return sock_diag_register(&unix_diag_handler);
}

static void __exit unix_diag_exit(void)
{
sock_diag_unregister(&unix_diag_handler);
}

module_init(unix_diag_init);
module_exit(unix_diag_exit);
MODULE_LICENSE("GPL");
MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_NETLINK, NETLINK_SOCK_DIAG, 1 /* AF_LOCAL */);

0 comments on commit feb76bb

Please sign in to comment.