1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tun/tun.patch Mon Jan 12 19:09:19 2009 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +Index: linux/2.2/tun.c 1.5 +--- linux/2.2/tun.c.orig 2006-10-10 14:45:00.338589000 +0200 1.6 ++++ linux/2.2/tun.c 2006-10-10 14:44:05.695404000 +0200 1.7 +@@ -178,10 +178,22 @@ 1.8 + 1.9 + DBG( KERN_INFO "%s: tun_chr_poll\n", tun->name); 1.10 + 1.11 ++ /* Data written to the /dev/tunX device is immediately placed into a socket buffer, making it 1.12 ++ * available to networking code at the tunX interface. Writes never block. 1.13 ++ * Likewise, data flows from the network stack, through the tunX interface and into the /dev/tun* device, 1.14 ++ * where it is queued, making it available for read(). 1.15 ++ * Thus the character device /dev/tunX is: 1.16 ++ * - readable if data was "transmitted" to the tunX interface and is now queued at the /dev/tunX device. 1.17 ++ * - always writable. 1.18 ++ * Everything written here is equally true of taps. 1.19 ++ * The author made a mistake when implementing this routine; he forgot that the device is always writable. 1.20 ++ * -jeff stearns 22-Dec-2005 1.21 ++ */ 1.22 ++ 1.23 + poll_wait(file, &tun->read_wait, wait); 1.24 + 1.25 + if( skb_queue_len(&tun->txq) ) 1.26 +- return POLLIN | POLLRDNORM; 1.27 ++ return POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM; 1.28 + 1.29 + return POLLOUT | POLLWRNORM; 1.30 + } 1.31 +Index: linux/2.4/tun.c 1.32 +--- linux/2.4/tun.c.orig 2006-10-10 14:41:57.910408000 +0200 1.33 ++++ linux/2.4/tun.c 2006-10-10 14:43:40.067700000 +0200 1.34 +@@ -176,9 +176,21 @@ 1.35 + DBG(KERN_INFO "%s: tun_chr_poll\n", tun->name); 1.36 + 1.37 + poll_wait(file, &tun->read_wait, wait); 1.38 ++ 1.39 ++ /* Data written to the /dev/tunX device is immediately placed into a socket buffer, making it 1.40 ++ * available to networking code at the tunX interface. Writes never block. 1.41 ++ * Likewise, data flows from the network stack, through the tunX interface and into the /dev/tun* device, 1.42 ++ * where it is queued, making it available for read(). 1.43 ++ * Thus the character device /dev/tunX is: 1.44 ++ * - readable if data was "transmitted" to the tunX interface and is now queued at the /dev/tunX device. 1.45 ++ * - always writable. 1.46 ++ * Everything written here is equally true of taps. 1.47 ++ * The author made a mistake when implementing this routine; he forgot that the device is always writable. 1.48 ++ * -jeff stearns 22-Dec-2005 1.49 ++ */ 1.50 + 1.51 + if (skb_queue_len(&tun->txq)) 1.52 +- return POLLIN | POLLRDNORM; 1.53 ++ return POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM; 1.54 + 1.55 + return POLLOUT | POLLWRNORM; 1.56 + }