Sending an IP packet

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Fri Feb 22 10:40:20 EST 2013


On Fri, 22 Feb 2013 17:15:35 +0200, you said:

> I am trying to implement a new protocol that we've designed which works on
> top of the IP layer, so I am using ICMP messages to carry control
> information for the protocol.
> Why using ICMP, it seemed natural since our protocol is a Network-layer
> protocol and ICMP is a control messages protocol.

In that case, you *really* want to go look at how TCP and SCTP and other
protocols handle ICMP integration.  You want an API that integrates your ICMP
handling with the rest of the protocol stack, because otherwise you'll
end up with an unmaintainable mess.  Also, it will be about 436 times easier
to extend your protocol to work correctly over IPv6. :)

Go look at net/ipv4/udp.c, functions __udp4_lib_err() and __udp_lib_rcv(),
particularly the latter's use of icmp_send().  You'll want to extend icmp_send()
to handle your additional control information.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130222/d457d5a2/attachment.bin 


More information about the Kernelnewbies mailing list