aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstephen hemminger <stephen@networkplumber.org>2015-09-24 00:33:34 -0400
committerDavid S. Miller <davem@davemloft.net>2015-09-25 15:27:22 -0400
commitf1f39f91102733bcde2462c6a138f636ee541ea8 (patch)
tree5b5acaad2c0b996f0fa516f65b1c43c80da0cce7
parentf37db85d0c1eb6e4e8460cf7a13cfba42bfc2cb0 (diff)
l2tp: auto load type modules
It should not be necessary to do explicit module loading when configuring L2TP. Modules should be loaded as needed instead (as is done already with netlink and other tunnel types). This patch adds a new module alias type and code to load the sub module on demand. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/l2tp/l2tp_core.h3
-rw-r--r--net/l2tp/l2tp_eth.c1
-rw-r--r--net/l2tp/l2tp_netlink.c7
-rw-r--r--net/l2tp/l2tp_ppp.c1
4 files changed, 12 insertions, 0 deletions
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h
index 68aa9ffd4ae4..5871537af387 100644
--- a/net/l2tp/l2tp_core.h
+++ b/net/l2tp/l2tp_core.h
@@ -321,4 +321,7 @@ do { \
321#define l2tp_dbg(ptr, type, fmt, ...) \ 321#define l2tp_dbg(ptr, type, fmt, ...) \
322 l2tp_printk(ptr, type, pr_debug, fmt, ##__VA_ARGS__) 322 l2tp_printk(ptr, type, pr_debug, fmt, ##__VA_ARGS__)
323 323
324#define MODULE_ALIAS_L2TP_PWTYPE(type) \
325 MODULE_ALIAS("net-l2tp-type-" __stringify(type))
326
324#endif /* _L2TP_CORE_H_ */ 327#endif /* _L2TP_CORE_H_ */
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index 4b552873b556..e253c26f31ac 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -358,3 +358,4 @@ MODULE_LICENSE("GPL");
358MODULE_AUTHOR("James Chapman <jchapman@katalix.com>"); 358MODULE_AUTHOR("James Chapman <jchapman@katalix.com>");
359MODULE_DESCRIPTION("L2TP ethernet pseudowire driver"); 359MODULE_DESCRIPTION("L2TP ethernet pseudowire driver");
360MODULE_VERSION("1.0"); 360MODULE_VERSION("1.0");
361MODULE_ALIAS_L2TP_PWTYPE(5);
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
index 9e13c2ff8789..f93c5be612a7 100644
--- a/net/l2tp/l2tp_netlink.c
+++ b/net/l2tp/l2tp_netlink.c
@@ -576,6 +576,13 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf
576 if (info->attrs[L2TP_ATTR_MRU]) 576 if (info->attrs[L2TP_ATTR_MRU])
577 cfg.mru = nla_get_u16(info->attrs[L2TP_ATTR_MRU]); 577 cfg.mru = nla_get_u16(info->attrs[L2TP_ATTR_MRU]);
578 578
579#ifdef CONFIG_MODULES
580 if (l2tp_nl_cmd_ops[cfg.pw_type] == NULL) {
581 genl_unlock();
582 request_module("net-l2tp-type-%u", cfg.pw_type);
583 genl_lock();
584 }
585#endif
579 if ((l2tp_nl_cmd_ops[cfg.pw_type] == NULL) || 586 if ((l2tp_nl_cmd_ops[cfg.pw_type] == NULL) ||
580 (l2tp_nl_cmd_ops[cfg.pw_type]->session_create == NULL)) { 587 (l2tp_nl_cmd_ops[cfg.pw_type]->session_create == NULL)) {
581 ret = -EPROTONOSUPPORT; 588 ret = -EPROTONOSUPPORT;
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index f56c9f69e9f2..1ad18c55064c 100644
--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -1863,3 +1863,4 @@ MODULE_DESCRIPTION("PPP over L2TP over UDP");
1863MODULE_LICENSE("GPL"); 1863MODULE_LICENSE("GPL");
1864MODULE_VERSION(PPPOL2TP_DRV_VERSION); 1864MODULE_VERSION(PPPOL2TP_DRV_VERSION);
1865MODULE_ALIAS("pppox-proto-" __stringify(PX_PROTO_OL2TP)); 1865MODULE_ALIAS("pppox-proto-" __stringify(PX_PROTO_OL2TP));
1866MODULE_ALIAS_L2TP_PWTYPE(11);