1 From 0d37e6edc09c99e683dd91ca0e83bbc0df8477b3 Mon Sep 17 00:00:00 2001
2 From: Felix Fietkau <nbd@nbd.name>
3 Date: Sun, 16 Jul 2017 16:56:10 +0200
4 Subject: lib: add uevent_next_seqnum()
6 Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 include/linux/kobject.h | 5 +++++
9 lib/kobject_uevent.c | 37 +++++++++++++++++++++++++++++++++++++
10 2 files changed, 42 insertions(+)
12 diff --git a/include/linux/kobject.h b/include/linux/kobject.h
13 index a7dc9e61f433..3d6950c957cd 100644
14 --- a/include/linux/kobject.h
15 +++ b/include/linux/kobject.h
22 #ifdef CONFIG_UEVENT_HELPER
23 /* path to the userspace helper executed on an event */
24 extern char uevent_helper[];
25 @@ -227,4 +229,7 @@ int kobject_action_type(const char *buf, size_t count,
26 int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
29 +int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
32 #endif /* _KOBJECT_H_ */
33 diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
34 index ac0c7cfa7292..bd13381a410f 100644
35 --- a/lib/kobject_uevent.c
36 +++ b/lib/kobject_uevent.c
37 @@ -460,6 +460,43 @@ int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
38 EXPORT_SYMBOL_GPL(broadcast_uevent);
40 #if defined(CONFIG_NET)
41 +int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
44 + struct uevent_sock *ue_sk;
47 + /* send netlink message */
48 + mutex_lock(&uevent_sock_mutex);
49 + list_for_each_entry(ue_sk, &uevent_sock_list, list) {
50 + struct sock *uevent_sock = ue_sk->sk;
51 + struct sk_buff *skb2;
53 + skb2 = skb_clone(skb, allocation);
57 + err = netlink_broadcast(uevent_sock, skb2, pid, group,
62 + mutex_unlock(&uevent_sock_mutex);
68 +int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
75 +EXPORT_SYMBOL_GPL(broadcast_uevent);
77 +#if defined(CONFIG_NET)
78 static int uevent_net_init(struct net *net)
80 struct uevent_sock *ue_sk;