-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Staging: batman-adv: Move device for icmp injection to debugfs
batctl uses /dev/batman-adv to send special batman-adv icmp packets to other nodes in the mesh. To get it working with multiple batX devices we must ensure that every mesh device can have their own socket which is used to inject those packets in exactly one mesh. The current implementation still doesn't allow to use complete separated meshes as we rely on structures which are not part of the private data of a batman device. Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
- Loading branch information
Sven Eckelmann
authored and
Greg Kroah-Hartman
committed
Jun 22, 2010
1 parent
1bd2c21
commit c412143
Showing
9 changed files
with
463 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright (C) 2010 B.A.T.M.A.N. contributors: | ||
* | ||
* Marek Lindner | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of version 2 of the GNU General Public | ||
* License as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
* 02110-1301, USA | ||
* | ||
*/ | ||
|
||
#include <linux/debugfs.h> | ||
|
||
#include "main.h" | ||
#include "bat_debugfs.h" | ||
#include "translation-table.h" | ||
#include "originator.h" | ||
#include "hard-interface.h" | ||
#include "vis.h" | ||
#include "icmp_socket.h" | ||
|
||
static struct dentry *bat_debugfs; | ||
|
||
void debugfs_init(void) | ||
{ | ||
bat_debugfs = debugfs_create_dir(DEBUGFS_BAT_SUBDIR, NULL); | ||
} | ||
|
||
void debugfs_destroy(void) | ||
{ | ||
if (bat_debugfs) { | ||
debugfs_remove_recursive(bat_debugfs); | ||
bat_debugfs = NULL; | ||
} | ||
} | ||
|
||
int debugfs_add_meshif(struct net_device *dev) | ||
{ | ||
struct bat_priv *bat_priv = netdev_priv(dev); | ||
|
||
if (!bat_debugfs) | ||
goto out; | ||
|
||
bat_priv->debug_dir = debugfs_create_dir(dev->name, bat_debugfs); | ||
if (!bat_priv->debug_dir) | ||
goto out; | ||
|
||
bat_socket_setup(bat_priv); | ||
|
||
return 0; | ||
out: | ||
#ifdef CONFIG_DEBUG_FS | ||
return -ENOMEM; | ||
#else | ||
return 0; | ||
#endif /* CONFIG_DEBUG_FS */ | ||
} | ||
|
||
void debugfs_del_meshif(struct net_device *dev) | ||
{ | ||
struct bat_priv *bat_priv = netdev_priv(dev); | ||
|
||
if (bat_debugfs) { | ||
debugfs_remove_recursive(bat_priv->debug_dir); | ||
bat_priv->debug_dir = NULL; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (C) 2010 B.A.T.M.A.N. contributors: | ||
* | ||
* Marek Lindner | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of version 2 of the GNU General Public | ||
* License as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
* 02110-1301, USA | ||
* | ||
*/ | ||
|
||
|
||
#ifndef BAT_DEBUGFS_H | ||
#define BAT_DEBUGFS_H | ||
|
||
#define DEBUGFS_BAT_SUBDIR "batman_adv" | ||
|
||
void debugfs_init(void); | ||
void debugfs_destroy(void); | ||
int debugfs_add_meshif(struct net_device *dev); | ||
void debugfs_del_meshif(struct net_device *dev); | ||
|
||
#endif |
Oops, something went wrong.