[PATCH 1/1] drivers/net: param for lapbether for specific ethernet device

Subsystems: networking drivers, the rest, x.25 stack

STALE4792d

4 messages, 2 authors, 2013-06-19 · open the first message on its own page

[PATCH 1/1] drivers/net: param for lapbether for specific ethernet device

From: Stephen Moorby <hidden>
Date: 2013-06-19 15:27:30

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 <redacted>
---
 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

Re: [PATCH 1/1] drivers/net: param for lapbether for specific ethernet device

From: David Miller <davem@davemloft.net>
Date: 2013-06-19 19:18:06

From: Stephen Moorby <redacted>
Date: Wed, 19 Jun 2013 16:26:53 +0100
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 <redacted>
I rejected this patch last night, stating that module parameters are
deeply discouraged and therefore you need to create a runtime mechanism
to control this.

Re: [PATCH 1/1] drivers/net: param for lapbether for specific ethernet device

From: Stephen Moorby <hidden>
Date: 2013-06-19 20:19:42

I will be using an Ubuntu 10.04 kernel with the 'eth_dev' module 
parameter patch.  I appreciate a better solution needs to be designed 
but it is not one I can contribute to.  I still advocate the patch as an 
improvement on the current non functional situation.

On 19/06/13 20:18, David Miller wrote:
From: Stephen Moorby <redacted>
Date: Wed, 19 Jun 2013 16:26:53 +0100
quoted
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 <redacted>
I rejected this patch last night, stating that module parameters are
deeply discouraged and therefore you need to create a runtime mechanism
to control this.

Re: [PATCH 1/1] drivers/net: param for lapbether for specific ethernet device

From: David Miller <davem@davemloft.net>
Date: 2013-06-19 22:48:57

From: Stephen Moorby <redacted>
Date: Wed, 19 Jun 2013 21:19:31 +0100
I will be using an Ubuntu 10.04 kernel with the 'eth_dev' module
parameter patch.  I appreciate a better solution needs to be designed
but it is not one I can contribute to.  I still advocate the patch as
an improvement on the current non functional situation.
We don't put poorly designed changes into the tree simply because
a properly implemented version doesn't exist yet.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help