linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: tunnels - enable module autoloading
@ 2014-05-13  8:48 Tom Gundersen
  2014-05-15 19:37 ` David Miller
  2014-05-15 21:32 ` [PATCH] " Stephen Hemminger
  0 siblings, 2 replies; 8+ messages in thread
From: Tom Gundersen @ 2014-05-13  8:48 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, kaber, yoshfuji, jmorris, kuznet, davem, Tom Gundersen

Enable the module alias hookup to allow tunnel modules to be autoloaded on demand.

This is in line with how most other netdev kinds work, and will allow userspace
to create tunnels without having CAP_SYS_MODULE.

Signed-off-by: Tom Gundersen <teg@jklm.no>
Tested-by: Susant Sahani <susant@redhat.com>
---
 net/ipv4/ipip.c       | 1 +
 net/ipv6/ip6_tunnel.c | 1 +
 net/ipv6/sit.c        | 1 +
 3 files changed, 3 insertions(+)

diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 812b183..d8155cf 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -486,4 +486,5 @@ static void __exit ipip_fini(void)
 module_init(ipip_init);
 module_exit(ipip_fini);
 MODULE_LICENSE("GPL");
+MODULE_ALIAS_RTNL_LINK("ipip")
 MODULE_ALIAS_NETDEV("tunl0");
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index b05b609..fe61545 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -61,6 +61,7 @@
 MODULE_AUTHOR("Ville Nuorvala");
 MODULE_DESCRIPTION("IPv6 tunneling device");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS_RTNL_LINK("ip6tnl");
 MODULE_ALIAS_NETDEV("ip6tnl0");
 
 #ifdef IP6_TNL_DEBUG
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index e5a453c..f438004 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1828,4 +1828,5 @@ xfrm_tunnel_failed:
 module_init(sit_init);
 module_exit(sit_cleanup);
 MODULE_LICENSE("GPL");
+MODULE_ALIAS_RTNL_LINK("sit");
 MODULE_ALIAS_NETDEV("sit0");
-- 
1.9.0


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

* Re: [PATCH] net: tunnels - enable module autoloading
  2014-05-13  8:48 [PATCH] net: tunnels - enable module autoloading Tom Gundersen
@ 2014-05-15 19:37 ` David Miller
  2014-05-15 21:21   ` [PATCH v2] " Tom Gundersen
  2014-05-15 21:32 ` [PATCH] " Stephen Hemminger
  1 sibling, 1 reply; 8+ messages in thread
From: David Miller @ 2014-05-15 19:37 UTC (permalink / raw)
  To: teg; +Cc: netdev, linux-kernel, kaber, yoshfuji, jmorris, kuznet

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: Text/Plain; charset=iso-8859-7, Size: 1376 bytes --]

From: Tom Gundersen <teg@jklm.no>
Date: Tue, 13 May 2014 10:48:28 +0200

> Enable the module alias hookup to allow tunnel modules to be autoloaded on demand.
> 
> This is in line with how most other netdev kinds work, and will allow userspace
> to create tunnels without having CAP_SYS_MODULE.
> 
> Signed-off-by: Tom Gundersen <teg@jklm.no>
> Tested-by: Susant Sahani <susant@redhat.com>

This doesn't even compile:

  CC [M]  net/ipv4/ipip.o
In file included from include/linux/module.h:17:0,
                 from net/ipv4/ipip.c:95:
include/linux/moduleparam.h:21:1: error: expected ¡,¢ or ¡;¢ before ¡static¢
 static const char __UNIQUE_ID(name)[]       \
 ^
include/linux/module.h:86:32: note: in expansion of macro ¡__MODULE_INFO¢
 #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
                                ^
include/linux/module.h:89:30: note: in expansion of macro ¡MODULE_INFO¢
 #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
                              ^
include/linux/netdevice.h:3283:2: note: in expansion of macro ¡MODULE_ALIAS¢
  MODULE_ALIAS("netdev-" device)
  ^
net/ipv4/ipip.c:490:1: note: in expansion of macro ¡MODULE_ALIAS_NETDEV¢
 MODULE_ALIAS_NETDEV("tunl0");
 ^
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* [PATCH v2] net: tunnels - enable module autoloading
  2014-05-15 19:37 ` David Miller
@ 2014-05-15 21:21   ` Tom Gundersen
  2014-05-21 19:47     ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Gundersen @ 2014-05-15 21:21 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, kaber, yoshfuji, jmorris, kuznet, davem, Tom Gundersen

Enable the module alias hookup to allow tunnel modules to be autoloaded on demand.

This is in line with how most other netdev kinds work, and will allow userspace
to create tunnels without having CAP_SYS_MODULE.

Signed-off-by: Tom Gundersen <teg@jklm.no>
---
v2: add ';'

Hi Dave,

I must have sent out the wrong version of this patch. Sorry for the inconvenience!

Cheers,

Tom

 net/ipv4/ipip.c       | 1 +
 net/ipv6/ip6_tunnel.c | 1 +
 net/ipv6/sit.c        | 1 +
 3 files changed, 3 insertions(+)

diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 812b183..4bc508f 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -486,4 +486,5 @@ static void __exit ipip_fini(void)
 module_init(ipip_init);
 module_exit(ipip_fini);
 MODULE_LICENSE("GPL");
+MODULE_ALIAS_RTNL_LINK("ipip");
 MODULE_ALIAS_NETDEV("tunl0");
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index b05b609..fe61545 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -61,6 +61,7 @@
 MODULE_AUTHOR("Ville Nuorvala");
 MODULE_DESCRIPTION("IPv6 tunneling device");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS_RTNL_LINK("ip6tnl");
 MODULE_ALIAS_NETDEV("ip6tnl0");
 
 #ifdef IP6_TNL_DEBUG
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index e5a453c..f438004 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1828,4 +1828,5 @@ xfrm_tunnel_failed:
 module_init(sit_init);
 module_exit(sit_cleanup);
 MODULE_LICENSE("GPL");
+MODULE_ALIAS_RTNL_LINK("sit");
 MODULE_ALIAS_NETDEV("sit0");
-- 
1.9.0


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

* Re: [PATCH] net: tunnels - enable module autoloading
  2014-05-13  8:48 [PATCH] net: tunnels - enable module autoloading Tom Gundersen
  2014-05-15 19:37 ` David Miller
@ 2014-05-15 21:32 ` Stephen Hemminger
  2014-05-15 21:42   ` Tom Gundersen
  1 sibling, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2014-05-15 21:32 UTC (permalink / raw)
  To: Tom Gundersen
  Cc: netdev, linux-kernel, kaber, yoshfuji, jmorris, kuznet, davem

On Tue, 13 May 2014 10:48:28 +0200
Tom Gundersen <teg@jklm.no> wrote:

> Enable the module alias hookup to allow tunnel modules to be autoloaded on demand.
> 
> This is in line with how most other netdev kinds work, and will allow userspace
> to create tunnels without having CAP_SYS_MODULE.
> 
> Signed-off-by: Tom Gundersen <teg@jklm.no>
> Tested-by: Susant Sahani <susant@redhat.com>
> ---
>  net/ipv4/ipip.c       | 1 +
>  net/ipv6/ip6_tunnel.c | 1 +
>  net/ipv6/sit.c        | 1 +
>  3 files changed, 3 insertions(+)

But tunnel modules are autoloaded now.
If I create a tunnel with ip tunnel based on the existing MODULE_ALIAS_NETDEV().


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

* Re: [PATCH] net: tunnels - enable module autoloading
  2014-05-15 21:32 ` [PATCH] " Stephen Hemminger
@ 2014-05-15 21:42   ` Tom Gundersen
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Gundersen @ 2014-05-15 21:42 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: netdev, LKML, Patrick McHardy, yoshfuji, jmorris,
	Alexey Kuznetsov, David Miller

On Thu, May 15, 2014 at 11:32 PM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Tue, 13 May 2014 10:48:28 +0200
> Tom Gundersen <teg@jklm.no> wrote:
>
>> Enable the module alias hookup to allow tunnel modules to be autoloaded on demand.
>>
>> This is in line with how most other netdev kinds work, and will allow userspace
>> to create tunnels without having CAP_SYS_MODULE.
>>
>> Signed-off-by: Tom Gundersen <teg@jklm.no>
>> Tested-by: Susant Sahani <susant@redhat.com>
>> ---
>>  net/ipv4/ipip.c       | 1 +
>>  net/ipv6/ip6_tunnel.c | 1 +
>>  net/ipv6/sit.c        | 1 +
>>  3 files changed, 3 insertions(+)
>
> But tunnel modules are autoloaded now.
> If I create a tunnel with ip tunnel based on the existing MODULE_ALIAS_NETDEV().

Hm, please correct me if I'm wrong, but this only works if you create
a tunnel with one of the hardcoded tunnel names, right? And also, if I
read the code correctly, it only works if you use the ioctl interface
and not the rtnl interface?

What we'd like to do is to use the rtnl interface to create tunnels
with arbitrary names, is there a way this can already be done that I
have missed?

Cheers,

Tom

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

* Re: [PATCH v2] net: tunnels - enable module autoloading
  2014-05-15 21:21   ` [PATCH v2] " Tom Gundersen
@ 2014-05-21 19:47     ` David Miller
  2014-06-02 18:57       ` Tom Gundersen
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2014-05-21 19:47 UTC (permalink / raw)
  To: teg; +Cc: netdev, linux-kernel, kaber, yoshfuji, jmorris, kuznet

From: Tom Gundersen <teg@jklm.no>
Date: Thu, 15 May 2014 23:21:30 +0200

> Enable the module alias hookup to allow tunnel modules to be autoloaded on demand.
> 
> This is in line with how most other netdev kinds work, and will allow userspace
> to create tunnels without having CAP_SYS_MODULE.
> 
> Signed-off-by: Tom Gundersen <teg@jklm.no>
> ---
> v2: add ';'
> 
> Hi Dave,
> 
> I must have sent out the wrong version of this patch. Sorry for the inconvenience!

Applied to net-next, although I never saw a firm conclusion in the
thread for the original patch where there was a discussion about
whether this is already possible or not.

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

* Re: [PATCH v2] net: tunnels - enable module autoloading
  2014-05-21 19:47     ` David Miller
@ 2014-06-02 18:57       ` Tom Gundersen
  2014-06-02 20:40         ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Gundersen @ 2014-06-02 18:57 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, LKML, Patrick McHardy, yoshfuji, jmorris, Alexey Kuznetsov

On Wed, May 21, 2014 at 9:47 PM, David Miller <davem@davemloft.net> wrote:
> From: Tom Gundersen <teg@jklm.no>
> Date: Thu, 15 May 2014 23:21:30 +0200
>
>> Enable the module alias hookup to allow tunnel modules to be autoloaded on demand.
>>
>> This is in line with how most other netdev kinds work, and will allow userspace
>> to create tunnels without having CAP_SYS_MODULE.
>>
>> Signed-off-by: Tom Gundersen <teg@jklm.no>
>> ---
>> v2: add ';'
>>
>> Hi Dave,
>>
>> I must have sent out the wrong version of this patch. Sorry for the inconvenience!
>
> Applied to net-next

Thanks!

> although I never saw a firm conclusion in the
> thread for the original patch where there was a discussion about
> whether this is already possible or not.

It is my understanding that this is not already possible, which is why
the MODULE_ALIAS_RTNL_LINK exists.

Would this patch be suitable for stable? While it does not fix a
regression, it appears to fix the intended behaviour of
MODULE_ALIAS_RTNL_LINK?

What I'll do in userspace is to drop CAP_SYS_MODULE and just tell
people who want tunnels to wait for a new kernel (or backport the
patch), but having it in stable would obviously make it simpler.

Cheers,

Tom

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

* Re: [PATCH v2] net: tunnels - enable module autoloading
  2014-06-02 18:57       ` Tom Gundersen
@ 2014-06-02 20:40         ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2014-06-02 20:40 UTC (permalink / raw)
  To: teg; +Cc: netdev, linux-kernel, kaber, yoshfuji, jmorris, kuznet

From: Tom Gundersen <teg@jklm.no>
Date: Mon, 2 Jun 2014 20:57:02 +0200

> Would this patch be suitable for stable? While it does not fix a
> regression, it appears to fix the intended behaviour of
> MODULE_ALIAS_RTNL_LINK?

It probably is suitable... I'll queue it up, thanks.

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

end of thread, other threads:[~2014-06-02 20:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-13  8:48 [PATCH] net: tunnels - enable module autoloading Tom Gundersen
2014-05-15 19:37 ` David Miller
2014-05-15 21:21   ` [PATCH v2] " Tom Gundersen
2014-05-21 19:47     ` David Miller
2014-06-02 18:57       ` Tom Gundersen
2014-06-02 20:40         ` David Miller
2014-05-15 21:32 ` [PATCH] " Stephen Hemminger
2014-05-15 21:42   ` Tom Gundersen

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