* PF_NETLINK, SOCK_DGRAM, 2 => EPROTONOSUPPORT
@ 2010-08-30 10:02 Thomas Voegtle
2010-08-31 2:06 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Voegtle @ 2010-08-30 10:02 UTC (permalink / raw)
To: netdev
Hello,
This code snippet:
#include <sys/socket.h>
#include <linux/netlink.h>
int main() {
socket(PF_NETLINK, SOCK_DGRAM, NETLINK_USERSOCK);
return 0;
}
ends up with:
socket(PF_NETLINK, SOCK_DGRAM, 2) = -1 EPROTONOSUPPORT (Protocol not
supported)
since 2.6.33.
I bisected it down to:
974c37e9d88c3e5a3e56eb98cb9c84232eb2bdcb is the first bad commit
commit 974c37e9d88c3e5a3e56eb98cb9c84232eb2bdcb
Author: Alexey Dobriyan <adobriyan@gmail.com>
Date: Sat Jan 30 10:05:05 2010 +0000
netlink: fix for too early rmmod
This is strange, because the code snippet even fails on a monolithic
kernel.
When I revert this commit on top of 2.6.36-rc3, it works.
Was this intended, that this code snippet doesn't work this way anymore or
is this just a bug?
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: PF_NETLINK, SOCK_DGRAM, 2 => EPROTONOSUPPORT
2010-08-30 10:02 PF_NETLINK, SOCK_DGRAM, 2 => EPROTONOSUPPORT Thomas Voegtle
@ 2010-08-31 2:06 ` David Miller
2010-08-31 10:15 ` Thomas Voegtle
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2010-08-31 2:06 UTC (permalink / raw)
To: tv; +Cc: netdev
From: Thomas Voegtle <tv@lio96.de>
Date: Mon, 30 Aug 2010 12:02:51 +0200 (CEST)
> Was this intended, that this code snippet doesn't work this way
> anymore or is this just a bug?
It's an unintended regression.
But nobody noticed it, because almost no-one uses NETLINK_USER.
This might fix it, give it a test:
netlink: Make NETLINK_USERSOCK work again.
Once we started enforcing the a nl_table[] entry exist for
a protocol, NETLINK_USERSOCK stopped working. Add a dummy
table entry so that it works again.
Reported-by: Thomas Voegtle <tv@lio96.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 980fe4a..cd96ed3 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2102,6 +2102,26 @@ static void __net_exit netlink_net_exit(struct net *net)
#endif
}
+static void __init netlink_add_usersock_entry(void)
+{
+ unsigned long *listeners;
+ int groups = 32;
+
+ listeners = kzalloc(NLGRPSZ(groups) + sizeof(struct listeners_rcu_head),
+ GFP_KERNEL);
+ if (!listeners)
+ panic("netlink_add_usersock_entry: Cannot allocate listneres\n");
+
+ netlink_table_grab();
+
+ nl_table[NETLINK_USERSOCK].groups = groups;
+ nl_table[NETLINK_USERSOCK].listeners = listeners;
+ nl_table[NETLINK_USERSOCK].module = THIS_MODULE;
+ nl_table[NETLINK_USERSOCK].registered = 1;
+
+ netlink_table_ungrab();
+}
+
static struct pernet_operations __net_initdata netlink_net_ops = {
.init = netlink_net_init,
.exit = netlink_net_exit,
@@ -2150,6 +2170,8 @@ static int __init netlink_proto_init(void)
hash->rehash_time = jiffies;
}
+ netlink_add_usersock_entry();
+
sock_register(&netlink_family_ops);
register_pernet_subsys(&netlink_net_ops);
/* The netlink device handler may be needed early. */
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: PF_NETLINK, SOCK_DGRAM, 2 => EPROTONOSUPPORT
2010-08-31 2:06 ` David Miller
@ 2010-08-31 10:15 ` Thomas Voegtle
2010-08-31 16:50 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Voegtle @ 2010-08-31 10:15 UTC (permalink / raw)
To: David Miller; +Cc: netdev
On Mon, 30 Aug 2010, David Miller wrote:
> From: Thomas Voegtle <tv@lio96.de>
> Date: Mon, 30 Aug 2010 12:02:51 +0200 (CEST)
>
>> Was this intended, that this code snippet doesn't work this way
>> anymore or is this just a bug?
>
> It's an unintended regression.
>
> But nobody noticed it, because almost no-one uses NETLINK_USER.
>
> This might fix it, give it a test:
Yes, that fixes it. Tested with 2.6.35.4 and 2.6.36-rc3.
Thank you,
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PF_NETLINK, SOCK_DGRAM, 2 => EPROTONOSUPPORT
2010-08-31 10:15 ` Thomas Voegtle
@ 2010-08-31 16:50 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-08-31 16:50 UTC (permalink / raw)
To: tv; +Cc: netdev
From: Thomas Voegtle <tv@lio96.de>
Date: Tue, 31 Aug 2010 12:15:26 +0200 (CEST)
> On Mon, 30 Aug 2010, David Miller wrote:
>
>> From: Thomas Voegtle <tv@lio96.de>
>> Date: Mon, 30 Aug 2010 12:02:51 +0200 (CEST)
>>
>>> Was this intended, that this code snippet doesn't work this way
>>> anymore or is this just a bug?
>>
>> It's an unintended regression.
>>
>> But nobody noticed it, because almost no-one uses NETLINK_USER.
>>
>> This might fix it, give it a test:
>
>
> Yes, that fixes it. Tested with 2.6.35.4 and 2.6.36-rc3.
Thanks for testing.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-31 16:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-30 10:02 PF_NETLINK, SOCK_DGRAM, 2 => EPROTONOSUPPORT Thomas Voegtle
2010-08-31 2:06 ` David Miller
2010-08-31 10:15 ` Thomas Voegtle
2010-08-31 16:50 ` 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).