Patch for netlink driver

Benjamin LaHaise (dot@superaje.com)
Thu, 30 May 1996 14:01:48 -0400 (EDT)


Hello!

I have been poking around in an attempt to get a useful IPX tunnel set
up. I thought it could be done entirely from user mode, but I was
wrong: using a SOCK_PACKET, one does not receive IPX packets originating
locally (doh!). I haven't bothered to actually look in to that, but
instead wrote an ether driver that uses NetLink. Works great, except for
the fact that there is no select function for the NetLink device. Here's
a patch against pre2.0.7. (should work against later versions too ;)
Also, methinks that the symbols netlink_attach, netlink_detach and
netlink_post should be exported for modules.

-b

--- linux/net/netlink.c.old Sun May 19 12:10:04 1996
+++ linux/net/netlink.c Thu May 30 13:31:01 1996
@@ -63,6 +63,21 @@
return -EINVAL;
}

+static int netlink_select(struct inode *inode, struct file *file, int sel_type, select_table * wait)
+{
+ unsigned int minor = MINOR(inode->i_rdev);
+ switch (sel_type) {
+ case SEL_IN:
+ if (skb_peek(&skb_queue_rd[minor])!=NULL)
+ return 1;
+ select_wait(&read_space_wait[minor], wait);
+ break;
+ case SEL_OUT:
+ return 1;
+ }
+ return 0;
+}
+
/*
* Write a message to the kernel side of a communication link
*/
@@ -161,7 +176,7 @@
netlink_read,
netlink_write,
NULL, /* netlink_readdir */
- NULL, /* netlink_select */
+ netlink_select,
netlink_ioctl,
NULL, /* netlink_mmap */
netlink_open,