aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2016-07-03 07:31:34 -0400
committerSimon Wunderlich <sw@simonwunderlich.de>2016-08-09 01:54:35 -0400
commit94969208c8c7f3dd06c0e5e61155077b573d5d5f (patch)
tree89c6b26ef6947976a857b9c731a532a8aba69268 /net/batman-adv
parent275019d2f00ed93e800f505a7b6f9e8ecf396898 (diff)
batman-adv: Suppress debugfs entries for netns's
Debugfs is not netns aware. It thus has problems when the same interface name exists in multiple network name spaces. Work around this by not creating entries for interfaces in name spaces other than the default name space. This means meshes in network namespaces cannot be managed via debugfs, but there will soon be a netlink interface which is netns aware. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/debugfs.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c
index 1d68b6e63b96..b4ffba7dd583 100644
--- a/net/batman-adv/debugfs.c
+++ b/net/batman-adv/debugfs.c
@@ -31,6 +31,7 @@
31#include <linux/stddef.h> 31#include <linux/stddef.h>
32#include <linux/stringify.h> 32#include <linux/stringify.h>
33#include <linux/sysfs.h> 33#include <linux/sysfs.h>
34#include <net/net_namespace.h>
34 35
35#include "bat_algo.h" 36#include "bat_algo.h"
36#include "bridge_loop_avoidance.h" 37#include "bridge_loop_avoidance.h"
@@ -305,12 +306,16 @@ void batadv_debugfs_destroy(void)
305 */ 306 */
306int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface) 307int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface)
307{ 308{
309 struct net *net = dev_net(hard_iface->net_dev);
308 struct batadv_debuginfo **bat_debug; 310 struct batadv_debuginfo **bat_debug;
309 struct dentry *file; 311 struct dentry *file;
310 312
311 if (!batadv_debugfs) 313 if (!batadv_debugfs)
312 goto out; 314 goto out;
313 315
316 if (net != &init_net)
317 return 0;
318
314 hard_iface->debug_dir = debugfs_create_dir(hard_iface->net_dev->name, 319 hard_iface->debug_dir = debugfs_create_dir(hard_iface->net_dev->name,
315 batadv_debugfs); 320 batadv_debugfs);
316 if (!hard_iface->debug_dir) 321 if (!hard_iface->debug_dir)
@@ -341,6 +346,11 @@ out:
341 */ 346 */
342void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface) 347void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface)
343{ 348{
349 struct net *net = dev_net(hard_iface->net_dev);
350
351 if (net != &init_net)
352 return;
353
344 if (batadv_debugfs) { 354 if (batadv_debugfs) {
345 debugfs_remove_recursive(hard_iface->debug_dir); 355 debugfs_remove_recursive(hard_iface->debug_dir);
346 hard_iface->debug_dir = NULL; 356 hard_iface->debug_dir = NULL;
@@ -351,11 +361,15 @@ int batadv_debugfs_add_meshif(struct net_device *dev)
351{ 361{
352 struct batadv_priv *bat_priv = netdev_priv(dev); 362 struct batadv_priv *bat_priv = netdev_priv(dev);
353 struct batadv_debuginfo **bat_debug; 363 struct batadv_debuginfo **bat_debug;
364 struct net *net = dev_net(dev);
354 struct dentry *file; 365 struct dentry *file;
355 366
356 if (!batadv_debugfs) 367 if (!batadv_debugfs)
357 goto out; 368 goto out;
358 369
370 if (net != &init_net)
371 return 0;
372
359 bat_priv->debug_dir = debugfs_create_dir(dev->name, batadv_debugfs); 373 bat_priv->debug_dir = debugfs_create_dir(dev->name, batadv_debugfs);
360 if (!bat_priv->debug_dir) 374 if (!bat_priv->debug_dir)
361 goto out; 375 goto out;
@@ -392,6 +406,10 @@ out:
392void batadv_debugfs_del_meshif(struct net_device *dev) 406void batadv_debugfs_del_meshif(struct net_device *dev)
393{ 407{
394 struct batadv_priv *bat_priv = netdev_priv(dev); 408 struct batadv_priv *bat_priv = netdev_priv(dev);
409 struct net *net = dev_net(dev);
410
411 if (net != &init_net)
412 return;
395 413
396 batadv_debug_log_cleanup(bat_priv); 414 batadv_debug_log_cleanup(bat_priv);
397 415