linuxtcplinux-kernelnetwork-programmingstack

Linux TCP stack packet injection


Could I inject packets to Linux TCP stack without modifying the Ethernet driver? Could I do this with using a library or sth ?

Thank you


Solution

  • If by 'inject packets to Linux TCP stack' you mean send some data that the Linux kernel will treat as a frame coming from an Ethernet interface then you can use a 'tap' device. If an IP packet (layer 3) is good enough, then use a 'tun' device.

    http://en.wikipedia.org/wiki/TUN/TAP

    http://www.kernel.org/pub/linux/kernel/people/marcelo/linux-2.4/Documentation/networking/tuntap.txt