|
From: David W. <dw...@in...> - 2000-08-25 12:28:55
|
ku...@ms... said:
> Ethertap device has just been replaced.
> netlink_dev is open for removal rather than for improvements.
OK. The new Ethertap in 2.4 looks far nicer.
2.2 is still a problem though. I'd like to see either the new Ethertap or
this patch go in.
Index: include/net/sock.h
===================================================================
RCS file: /inst/cvs/linux/include/net/sock.h,v
retrieving revision 1.8
diff -u -r1.8 sock.h
--- include/net/sock.h 2000/06/07 09:55:39 1.8
+++ include/net/sock.h 2000/08/23 12:05:09
@@ -115,6 +115,7 @@
unsigned groups;
pid_t dst_pid;
unsigned dst_groups;
+ int netlink_dev;
int (*handler)(int unit, struct sk_buff *skb);
atomic_t locks;
struct netlink_callback *cb;
Index: net/netlink/af_netlink.c
===================================================================
RCS file: /inst/cvs/linux/net/netlink/af_netlink.c,v
retrieving revision 1.5
diff -u -r1.5 af_netlink.c
--- net/netlink/af_netlink.c 2000/06/07 09:54:25 1.5
+++ net/netlink/af_netlink.c 2000/08/23 12:05:50
@@ -254,7 +254,8 @@
return -EINVAL;
/* Only superuser is allowed to listen multicasts */
- if (nladdr->nl_groups && !capable(CAP_NET_ADMIN))
+ if (nladdr->nl_groups && !sk->protinfo.af_netlink.netlink_dev &&
+ !capable(CAP_NET_ADMIN))
return -EPERM;
if (sk->protinfo.af_netlink.pid) {
@@ -506,7 +507,8 @@
return -EINVAL;
dst_pid = addr->nl_pid;
dst_groups = addr->nl_groups;
- if (dst_groups && !capable(CAP_NET_ADMIN))
+ if (dst_groups && !sk->protinfo.af_netlink.netlink_dev &&
+ !capable(CAP_NET_ADMIN))
return -EPERM;
} else {
dst_pid = sk->protinfo.af_netlink.dst_pid;
Index: net/netlink/netlink_dev.c
===================================================================
RCS file: /inst/cvs/linux/net/netlink/netlink_dev.c,v
retrieving revision 1.2
diff -u -r1.2 netlink_dev.c
--- net/netlink/netlink_dev.c 2000/06/07 09:54:25 1.2
+++ net/netlink/netlink_dev.c 2000/08/23 12:05:56
@@ -25,6 +25,7 @@
#include <linux/netlink.h>
#include <linux/poll.h>
#include <linux/init.h>
+#include <net/sock.h>
#include <asm/system.h>
#include <asm/uaccess.h>
@@ -134,6 +135,7 @@
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
nladdr.nl_groups = ~0;
+ sock->sk->protinfo.af_netlink.netlink_dev = 1;
if ((err = sock->ops->bind(sock, (struct sockaddr*)&nladdr, sizeof(nladdr))) < 0) {
sock_release(sock);
goto out;
--
dwmw2
|