How do you write your own IP protocol? (Assuming TCP and UDP are not suitable)

Assuming that you determined that for a particular case, neither TCP nor UDP are ideal, how would you start writing your own IP-based protocol?

For example, if you are working on Linux, where would you look into the kernel to โ€œplug inโ€ your protocol?

Where to begin?

+7
source share
3 answers

You can do this through the kernel module. I would start by reading how arp works, for example. This is a simpler protocol because user space does not send it directly.

The entry point for creating a new network protocol is dev_add_pack , and the code for arp can be found here .

+9
source

If your protocol can be implemented directly over IP addresses, it can also be implemented in UDP packets, and the latter has the advantage of passing through existing NAT devices and firewalls that simply lose your own protocol.

+3
source

Read about UNIX sockets and networking. This does not so much โ€œinterceptโ€ the kernel as it opens the socket and sends you binary data.

+1
source

All Articles