aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/kobject_uevent.c10
-rw-r--r--net/core/net-sysfs.c26
2 files changed, 34 insertions, 2 deletions
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 52e5abbc41db..5f72767ddd9b 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -88,11 +88,17 @@ out:
88#ifdef CONFIG_NET 88#ifdef CONFIG_NET
89static int kobj_bcast_filter(struct sock *dsk, struct sk_buff *skb, void *data) 89static int kobj_bcast_filter(struct sock *dsk, struct sk_buff *skb, void *data)
90{ 90{
91 struct kobject *kobj = data; 91 struct kobject *kobj = data, *ksobj;
92 const struct kobj_ns_type_operations *ops; 92 const struct kobj_ns_type_operations *ops;
93 93
94 ops = kobj_ns_ops(kobj); 94 ops = kobj_ns_ops(kobj);
95 if (ops) { 95 if (!ops && kobj->kset) {
96 ksobj = &kobj->kset->kobj;
97 if (ksobj->parent != NULL)
98 ops = kobj_ns_ops(ksobj->parent);
99 }
100
101 if (ops && ops->netlink_ns && kobj->ktype->namespace) {
96 const void *sock_ns, *ns; 102 const void *sock_ns, *ns;
97 ns = kobj->ktype->namespace(kobj); 103 ns = kobj->ktype->namespace(kobj);
98 sock_ns = ops->netlink_ns(dsk); 104 sock_ns = ops->netlink_ns(dsk);
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 7eeadeecc5a2..93886246a0b4 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -744,10 +744,23 @@ static void rx_queue_release(struct kobject *kobj)
744 dev_put(queue->dev); 744 dev_put(queue->dev);
745} 745}
746 746
747static const void *rx_queue_namespace(struct kobject *kobj)
748{
749 struct netdev_rx_queue *queue = to_rx_queue(kobj);
750 struct device *dev = &queue->dev->dev;
751 const void *ns = NULL;
752
753 if (dev->class && dev->class->ns_type)
754 ns = dev->class->namespace(dev);
755
756 return ns;
757}
758
747static struct kobj_type rx_queue_ktype = { 759static struct kobj_type rx_queue_ktype = {
748 .sysfs_ops = &rx_queue_sysfs_ops, 760 .sysfs_ops = &rx_queue_sysfs_ops,
749 .release = rx_queue_release, 761 .release = rx_queue_release,
750 .default_attrs = rx_queue_default_attrs, 762 .default_attrs = rx_queue_default_attrs,
763 .namespace = rx_queue_namespace
751}; 764};
752 765
753static int rx_queue_add_kobject(struct net_device *net, int index) 766static int rx_queue_add_kobject(struct net_device *net, int index)
@@ -1093,10 +1106,23 @@ static void netdev_queue_release(struct kobject *kobj)
1093 dev_put(queue->dev); 1106 dev_put(queue->dev);
1094} 1107}
1095 1108
1109static const void *netdev_queue_namespace(struct kobject *kobj)
1110{
1111 struct netdev_queue *queue = to_netdev_queue(kobj);
1112 struct device *dev = &queue->dev->dev;
1113 const void *ns = NULL;
1114
1115 if (dev->class && dev->class->ns_type)
1116 ns = dev->class->namespace(dev);
1117
1118 return ns;
1119}
1120
1096static struct kobj_type netdev_queue_ktype = { 1121static struct kobj_type netdev_queue_ktype = {
1097 .sysfs_ops = &netdev_queue_sysfs_ops, 1122 .sysfs_ops = &netdev_queue_sysfs_ops,
1098 .release = netdev_queue_release, 1123 .release = netdev_queue_release,
1099 .default_attrs = netdev_queue_default_attrs, 1124 .default_attrs = netdev_queue_default_attrs,
1125 .namespace = netdev_queue_namespace,
1100}; 1126};
1101 1127
1102static int netdev_queue_add_kobject(struct net_device *net, int index) 1128static int netdev_queue_add_kobject(struct net_device *net, int index)