Skip to contentSkip to conversation

genetlink: add auto module loading

PATCH Applied Stephen Hemminger 2 participants 4 messages Dec 28, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 genetlink: add auto module loading

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.

net/netlink/genetlink.c +9 -0
@@ -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;
 	}
 
maintainer Applied
#1 lore raw

From: Stephen Hemminger <[email protected]>
Date: Wed, 28 Dec 2011 10:19:58 -0800

Quoted 5 lines

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.

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.

#2 lore raw
Quoted 7 lines · On Wed, 28 Dec 2011 13:49:39 -0500 (EST) David Miller <[email protected]>…

From: Stephen Hemminger <[email protected]>
Date: Wed, 28 Dec 2011 10:19:58 -0800

Quoted 4 lines

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.

Quoted 8 lines
Quoted 1 line

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.

maintainer
#3 lore raw

From: Stephen Hemminger <[email protected]>
Date: Wed, 28 Dec 2011 11:02:08 -0800

Quoted 15 lines
Quoted 12 lines · On Wed, 28 Dec 2011 13:49:39 -0500 (EST) David Miller <[email protected]>…

From: Stephen Hemminger <[email protected]>
Date: Wed, 28 Dec 2011 10:19:58 -0800

Quoted 5 lines

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.

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

Quoted 7 lines
Quoted 3 lines

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.