tun/tun.patch

Thu, 04 Oct 2012 20:30:05 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 04 Oct 2012 20:30:05 +0200
changeset 715
c10fb90893b9
parent 75
b3a835aa617c
permissions
-rw-r--r--

Correct out of date build configuration, porting to Solaris 11 network
link infrastructure and new libpcap logic. This additionally allows for
device drivers in subdirectories of /dev. Correct packaged nmap
personalities and signatures to work out of the box. Finally, hack
arpd logic to properly close sockets and quit on TERM by repeating
signaling in the run command script. Sadly, all this fails to correct
the run time behaviour of honeyd which fails to bind to the IP layer.

     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