]> Pileus Git - ~andy/linux/commitdiff
genetlink: Add genl_notify()
authorPravin B Shelar <pshelar@nicira.com>
Fri, 11 Nov 2011 03:14:37 +0000 (19:14 -0800)
committerJesse Gross <jesse@nicira.com>
Sat, 3 Dec 2011 17:35:05 +0000 (09:35 -0800)
Open vSwitch uses Generic Netlink interface for communication
between userspace and kernel module. genl_notify() is used
for sending notification back to userspace.

genl_notify() is analogous to rtnl_notify() but uses genl_sock
instead of rtnl.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
include/net/genetlink.h
net/netlink/genetlink.c

index 82d8d09faa44d4adeb108e127d2a22696a761b83..7db32995ccd34b6aa8298f79f0bbc42ae4ebc5bb 100644 (file)
@@ -128,6 +128,8 @@ extern int genl_register_mc_group(struct genl_family *family,
                                  struct genl_multicast_group *grp);
 extern void genl_unregister_mc_group(struct genl_family *family,
                                     struct genl_multicast_group *grp);
+extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid,
+                       u32 group, struct nlmsghdr *nlh, gfp_t flags);
 
 /**
  * genlmsg_put - Add generic netlink header to netlink message
index 482fa571b4eecb9b89bc67ac523f0ff6c08ef0f5..8a36599d35550e237b317d228b4c7839ca1e4ff7 100644 (file)
@@ -946,3 +946,16 @@ int genlmsg_multicast_allns(struct sk_buff *skb, u32 pid, unsigned int group,
        return genlmsg_mcast(skb, pid, group, flags);
 }
 EXPORT_SYMBOL(genlmsg_multicast_allns);
+
+void genl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group,
+                struct nlmsghdr *nlh, gfp_t flags)
+{
+       struct sock *sk = net->genl_sock;
+       int report = 0;
+
+       if (nlh)
+               report = nlmsg_report(nlh);
+
+       nlmsg_notify(sk, skb, pid, group, report, flags);
+}
+EXPORT_SYMBOL(genl_notify);