tun-device: Read from tun to buffer on stack to avoid over-allocation of packets
authorMartin Willi <martin@revosec.ch>
Fri, 21 Nov 2014 10:23:08 +0000 (11:23 +0100)
committerMartin Willi <martin@revosec.ch>
Fri, 21 Nov 2014 11:02:07 +0000 (12:02 +0100)
commit946cf367d4129635ea35254b33977f07335488ff
treed2ecc744df3ba8f83baa1ce1ae9211e2a6ba70dd
parenteaca7f2143ab4ef454227c0ed286733a0e0e1759
tun-device: Read from tun to buffer on stack to avoid over-allocation of packets

Instead of allocating MTU-sized buffers for each packet, read to a stack buffer
and copy to an allocation of the actual packet size. While it requires an
additional copy on non-Apple platforms, this should make allocation more
efficient for small packets.
src/libstrongswan/networking/tun_device.c