Skip to content

Commit 263ba61

Browse files
Pravin B Shelarjessegross
authored andcommitted
genetlink: Add genl_notify()
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 <[email protected]> Signed-off-by: Jesse Gross <[email protected]>
1 parent 340e8dc commit 263ba61

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

include/net/genetlink.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ extern int genl_register_mc_group(struct genl_family *family,
128128
struct genl_multicast_group *grp);
129129
extern void genl_unregister_mc_group(struct genl_family *family,
130130
struct genl_multicast_group *grp);
131+
extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid,
132+
u32 group, struct nlmsghdr *nlh, gfp_t flags);
131133

132134
/**
133135
* genlmsg_put - Add generic netlink header to netlink message

net/netlink/genetlink.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,3 +946,16 @@ int genlmsg_multicast_allns(struct sk_buff *skb, u32 pid, unsigned int group,
946946
return genlmsg_mcast(skb, pid, group, flags);
947947
}
948948
EXPORT_SYMBOL(genlmsg_multicast_allns);
949+
950+
void genl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group,
951+
struct nlmsghdr *nlh, gfp_t flags)
952+
{
953+
struct sock *sk = net->genl_sock;
954+
int report = 0;
955+
956+
if (nlh)
957+
report = nlmsg_report(nlh);
958+
959+
nlmsg_notify(sk, skb, pid, group, report, flags);
960+
}
961+
EXPORT_SYMBOL(genl_notify);

0 commit comments

Comments
 (0)