Hello All,
Added Patch into kernel to send the udev events to userspace.Please find the attached one.
Regards,
Ankur
---
net/core/Makefile | 1 +
net/core/uevent.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
create mode 100644 net/core/uevent.c
diff --git a/net/core/Makefile b/net/core/Makefile
index b33b996..a2139a7 100644
--- a/net/core/Makefile
+++ b/net/core/Makefile
@@ -22,3 +22,4 @@ obj-$(CONFIG_TRACEPOINTS) += net-traces.o
obj-$(CONFIG_NET_DROP_MONITOR) += drop_monitor.o
obj-$(CONFIG_NETWORK_PHY_TIMESTAMPING) += timestamping.o
obj-$(CONFIG_NETPRIO_CGROUP) += netprio_cgroup.o
+obj-$(CONFIG_HOTPLUG) += uevent.o
diff --git a/net/core/uevent.c b/net/core/uevent.c
new file mode 100644
index 0000000..14b1e6e
--- /dev/null
+++ b/net/core/uevent.c
@@ -0,0 +1,43 @@
+/*
+ * Linux network device event notification
+ */
+
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/kobject.h>
+#include <linux/notifier.h>
+
+/*
+ * Generate uevent in response to network device state changes.
+ * Other events are already handled by device subsystem.
+ */
+static int netdev_event(struct notifier_block *this, unsigned long event,
+ void *ptr)
+{
+ struct net_device *netdev = ptr;
+
+ switch (event) {
+ case NETDEV_UP:
+ kobject_uevent(&netdev->dev.kobj, KOBJ_ADD);
+ break;
+ case NETDEV_DOWN:
+ kobject_uevent(&netdev->dev.kobj, KOBJ_REMOVE);
+ break;
+ case NETDEV_CHANGE:{
+ kobject_uevent(&netdev->dev.kobj, KOBJ_CHANGE);
+ break;
+ }
+ }
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block netdev_uevent_notifier = {
+ .notifier_call = netdev_event,
+};
+
+static int __init netdev_uevent_init(void)
+{
+ return register_netdevice_notifier(&netdev_uevent_notifier);
+}
+
+device_initcall(netdev_uevent_init);
--