tun/tun.patch

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 75
b3a835aa617c
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

     1 Index: solaris/configure
     2 --- solaris/configure.orig	2000-05-04 21:24:53.000000000 +0200
     3 +++ solaris/configure	2012-09-07 01:25:49.313354333 +0200
     4 @@ -769,6 +769,7 @@
     5  s%@oldincludedir@%$oldincludedir%g
     6  s%@infodir@%$infodir%g
     7  s%@mandir@%$mandir%g
     8 +s%@CC@%$CC%g
     9  s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
    10  s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
    11  s%@INSTALL_DATA@%$INSTALL_DATA%g
    12 Index: linux/2.2/tun.c
    13 --- linux/2.2/tun.c.orig	2006-10-10 14:45:00.338589000 +0200
    14 +++ linux/2.2/tun.c	2006-10-10 14:44:05.695404000 +0200
    15 @@ -178,10 +178,22 @@
    17     DBG( KERN_INFO "%s: tun_chr_poll\n", tun->name);
    19 +   /* Data written to the /dev/tunX device is immediately placed into a socket buffer, making it
    20 +    * available to networking code at the tunX interface.  Writes never block.
    21 +    * Likewise, data flows from the network stack, through the tunX interface and into the /dev/tun* device,
    22 +    * where it is queued, making it available for read().
    23 +    * Thus the character device /dev/tunX is:
    24 +    *   - readable if data was "transmitted" to the tunX interface and is now queued at the /dev/tunX device.
    25 +    *   - always writable.
    26 +    * Everything written here is equally true of taps.
    27 +    * The author made a mistake when implementing this routine; he forgot that the device is always writable.
    28 +    * -jeff stearns 22-Dec-2005
    29 +    */
    30 +
    31     poll_wait(file, &tun->read_wait, wait);
    33     if( skb_queue_len(&tun->txq) )
    34 -      return POLLIN | POLLRDNORM;
    35 +      return POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM;
    37     return POLLOUT | POLLWRNORM;
    38  }
    39 Index: linux/2.4/tun.c
    40 --- linux/2.4/tun.c.orig	2006-10-10 14:41:57.910408000 +0200
    41 +++ linux/2.4/tun.c	2006-10-10 14:43:40.067700000 +0200
    42 @@ -176,9 +176,21 @@
    43  	DBG(KERN_INFO "%s: tun_chr_poll\n", tun->name);
    45  	poll_wait(file, &tun->read_wait, wait);
    46 +
    47 +	/* Data written to the /dev/tunX device is immediately placed into a socket buffer, making it
    48 +	 * available to networking code at the tunX interface.  Writes never block.
    49 +	 * Likewise, data flows from the network stack, through the tunX interface and into the /dev/tun* device,
    50 +	 * where it is queued, making it available for read().
    51 +	 * Thus the character device /dev/tunX is:
    52 +	 *   - readable if data was "transmitted" to the tunX interface and is now queued at the /dev/tunX device.
    53 +	 *   - always writable.
    54 +	 * Everything written here is equally true of taps.
    55 +	 * The author made a mistake when implementing this routine; he forgot that the device is always writable.
    56 +	 * -jeff stearns 22-Dec-2005
    57 +	 */
    59  	if (skb_queue_len(&tun->txq))
    60 -		return POLLIN | POLLRDNORM;
    61 +		return POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM;
    63  	return POLLOUT | POLLWRNORM;
    64  }

mercurial