In that case, you *really* want to go look at how TCP and SCTP and otherprotocols 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.