Title: icmp_err_pack()


icmp_err_pack(pack, icmp_hdr) creates an icmp message and encapsulates the message in an ip header.

In order to do this, icmp_err_pack() first cuts out everything except the ip header and the first 8 bytes of data from the ip packet pack, icmp_err_pack()'s first parameter. Next, icmp_err_pack() zeroizes most of the fields (all fields except ih_chksum; the other fields must be set by the calling function) of the icmp header icmp_hdr, icmp_err_pack()'s second parameter, and appends the remains of the ip packet to the icmp header to create an icmp message. Finally, icmp_err_pack() creates an ip header and appends the newly created icmp message to this ip header.