diff -r 6f9166cf333a -r b3a835aa617c tun/tun.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tun/tun.patch Mon Jan 12 19:09:19 2009 +0100 @@ -0,0 +1,53 @@ +Index: linux/2.2/tun.c +--- linux/2.2/tun.c.orig 2006-10-10 14:45:00.338589000 +0200 ++++ linux/2.2/tun.c 2006-10-10 14:44:05.695404000 +0200 +@@ -178,10 +178,22 @@ + + DBG( KERN_INFO "%s: tun_chr_poll\n", tun->name); + ++ /* Data written to the /dev/tunX device is immediately placed into a socket buffer, making it ++ * available to networking code at the tunX interface. Writes never block. ++ * Likewise, data flows from the network stack, through the tunX interface and into the /dev/tun* device, ++ * where it is queued, making it available for read(). ++ * Thus the character device /dev/tunX is: ++ * - readable if data was "transmitted" to the tunX interface and is now queued at the /dev/tunX device. ++ * - always writable. ++ * Everything written here is equally true of taps. ++ * The author made a mistake when implementing this routine; he forgot that the device is always writable. ++ * -jeff stearns 22-Dec-2005 ++ */ ++ + poll_wait(file, &tun->read_wait, wait); + + if( skb_queue_len(&tun->txq) ) +- return POLLIN | POLLRDNORM; ++ return POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM; + + return POLLOUT | POLLWRNORM; + } +Index: linux/2.4/tun.c +--- linux/2.4/tun.c.orig 2006-10-10 14:41:57.910408000 +0200 ++++ linux/2.4/tun.c 2006-10-10 14:43:40.067700000 +0200 +@@ -176,9 +176,21 @@ + DBG(KERN_INFO "%s: tun_chr_poll\n", tun->name); + + poll_wait(file, &tun->read_wait, wait); ++ ++ /* Data written to the /dev/tunX device is immediately placed into a socket buffer, making it ++ * available to networking code at the tunX interface. Writes never block. ++ * Likewise, data flows from the network stack, through the tunX interface and into the /dev/tun* device, ++ * where it is queued, making it available for read(). ++ * Thus the character device /dev/tunX is: ++ * - readable if data was "transmitted" to the tunX interface and is now queued at the /dev/tunX device. ++ * - always writable. ++ * Everything written here is equally true of taps. ++ * The author made a mistake when implementing this routine; he forgot that the device is always writable. ++ * -jeff stearns 22-Dec-2005 ++ */ + + if (skb_queue_len(&tun->txq)) +- return POLLIN | POLLRDNORM; ++ return POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM; + + return POLLOUT | POLLWRNORM; + }