From: Stephen Moorby <steve.moorby@ntlworld.com>
To: davem@davemloft.net, jiri@resnulli.us, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/1] drivers/net: param for lapbether for specific ethernet device
Date: Wed, 19 Jun 2013 09:21:27 +0100 [thread overview]
Message-ID: <51C16A07.3070903@ntlworld.com> (raw)
From 35607dd0607bca5322860703143c31cb04377764 Mon Sep 17 00:00:00 2001
From: Stephen Moorby <steve.moorby@ntlworld.com>
Date: Wed, 19 Jun 2013 08:22:51 +0100
Subject: [PATCH 1/1] drivers/net: param for lapbether for specific ethernet
device
The lapbether driver binds to the first ethernet device that comes up.
This causes problems in hardware with multiple ethernet interfaces,
potentially resulting in the LAPB traffic on the wrong interface.
Have added a module parameter 'eth_dev' to specify the ethernet
interface over which lapbether should operate. The module behaves
as before if no device is specified.
Patch created on linux-next 18-Jun-2013.
Tested on 2.6.32-45-generic.
Signed-off-by: Stephen Moorby <steve.moorby@ntlworld.com>
---
drivers/net/wan/lapbether.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index a33a46f..510fc4a 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -47,6 +47,7 @@
#include <net/x25device.h>
+static char *eth_dev;
static const u8 bcast_addr[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
/* If this number is made larger, check that the temporary string buffer
@@ -381,8 +382,14 @@ static int lapbeth_device_event(struct
notifier_block *this,
switch (event) {
case NETDEV_UP:
/* New ethernet device -> new LAPB interface */
- if (lapbeth_get_x25_dev(dev) == NULL)
- lapbeth_new_device(dev);
+ if (lapbeth_get_x25_dev(dev) == NULL) {
+ if (NULL != eth_dev) {
+ if (0 == strcmp(dev->name, eth_dev))
+ lapbeth_new_device(dev);
+ } else {
+ lapbeth_new_device(dev);
+ }
+ }
break;
case NETDEV_DOWN:
/* ethernet device closed -> close LAPB interface */
@@ -446,6 +453,10 @@ static void __exit lapbeth_cleanup_driver(void)
}
module_exit(lapbeth_cleanup_driver);
+module_param(eth_dev, charp, S_IRUGO);
+MODULE_PARM_DESC(eth_dev, "Ethernet device to use");
+
+
MODULE_AUTHOR("Jonathan Naylor <g4klx@g4klx.demon.co.uk>");
MODULE_DESCRIPTION("The unofficial LAPB over Ethernet driver");
MODULE_LICENSE("GPL");
--
1.8.1.2
next reply other threads:[~2013-06-19 8:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 8:21 Stephen Moorby [this message]
2013-06-19 8:37 ` [PATCH 1/1] drivers/net: param for lapbether for specific ethernet device David Miller
2013-06-19 13:47 ` Sergei Shtylyov
2013-06-19 16:16 ` Ben Hutchings
-- strict thread matches above, loose matches on Subject: below --
2013-06-19 15:26 Stephen Moorby
2013-06-19 19:18 ` David Miller
2013-06-19 20:19 ` Stephen Moorby
2013-06-19 22:48 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51C16A07.3070903@ntlworld.com \
--to=steve.moorby@ntlworld.com \
--cc=davem@davemloft.net \
--cc=jiri@resnulli.us \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).