netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] genetlink: add auto module loading
@ 2011-12-28 18:19 Stephen Hemminger
  2011-12-28 18:49 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2011-12-28 18:19 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

When testing L2TP support, I discovered that the l2tp module is not autoloaded
as are other netlink interfaces. There is because of lack of hook in genetlink to call
request_module and load the module.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/net/netlink/genetlink.c	2011-12-24 11:13:44.373214171 -0800
+++ b/net/netlink/genetlink.c	2011-12-24 11:13:59.361360729 -0800
@@ -792,6 +792,15 @@ static int ctrl_getfamily(struct sk_buff
 
 		name = nla_data(info->attrs[CTRL_ATTR_FAMILY_NAME]);
 		res = genl_family_find_byname(name);
+#ifdef CONFIG_MODULES
+		if (res == NULL) {
+			genl_unlock();
+			request_module("net-pf-%d-proto-%d-type-%s",
+				       PF_NETLINK, NETLINK_GENERIC, name);
+			genl_lock();
+			res = genl_family_find_byname(name);
+		}
+#endif
 		err = -ENOENT;
 	}
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] genetlink: add auto module loading
  2011-12-28 18:19 [PATCH] genetlink: add auto module loading Stephen Hemminger
@ 2011-12-28 18:49 ` David Miller
  2011-12-28 19:02   ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2011-12-28 18:49 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 28 Dec 2011 10:19:58 -0800

> When testing L2TP support, I discovered that the l2tp module is not autoloaded
> as are other netlink interfaces. There is because of lack of hook in genetlink to call
> request_module and load the module.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied, but for completeness we should probably also handle the "by ID" case right
above this code block too.

Could you please submit a patch for that?

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] genetlink: add auto module loading
  2011-12-28 18:49 ` David Miller
@ 2011-12-28 19:02   ` Stephen Hemminger
  2011-12-28 19:03     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2011-12-28 19:02 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Wed, 28 Dec 2011 13:49:39 -0500 (EST)
David Miller <davem@davemloft.net> wrote:

> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Wed, 28 Dec 2011 10:19:58 -0800
> 
> > When testing L2TP support, I discovered that the l2tp module is not autoloaded
> > as are other netlink interfaces. There is because of lack of hook in genetlink to call
> > request_module and load the module.
> > 
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> Applied, but for completeness we should probably also handle the "by ID" case right
> above this code block too.
> 
> Could you please submit a patch for that?
> 
> Thanks.

There is no point really. All the existing drivers,
use GENL_ID_GENERATE which generates the ID when they are loaded.
Chicken and egg principle.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] genetlink: add auto module loading
  2011-12-28 19:02   ` Stephen Hemminger
@ 2011-12-28 19:03     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-12-28 19:03 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 28 Dec 2011 11:02:08 -0800

> On Wed, 28 Dec 2011 13:49:39 -0500 (EST)
> David Miller <davem@davemloft.net> wrote:
> 
>> From: Stephen Hemminger <shemminger@vyatta.com>
>> Date: Wed, 28 Dec 2011 10:19:58 -0800
>> 
>> > When testing L2TP support, I discovered that the l2tp module is not autoloaded
>> > as are other netlink interfaces. There is because of lack of hook in genetlink to call
>> > request_module and load the module.
>> > 
>> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>> 
>> Applied, but for completeness we should probably also handle the "by ID" case right
>> above this code block too.
>> 
>> Could you please submit a patch for that?
>> 
>> Thanks.
> 
> There is no point really. All the existing drivers,
> use GENL_ID_GENERATE which generates the ID when they are loaded.
> Chicken and egg principle.

Ok, then I wonder why we support ID based lookups at all.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-28 19:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-28 18:19 [PATCH] genetlink: add auto module loading Stephen Hemminger
2011-12-28 18:49 ` David Miller
2011-12-28 19:02   ` Stephen Hemminger
2011-12-28 19:03     ` David Miller

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).