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.

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

mercurial