ICMP is the Internet Control Message Protocol. It is used for diagnostic purposes, for querying information, and for transmitting network-level error messages. ICMPv6, the version for IPv6, is also used for configuring nodes on the link.
ICMP is technically at the same layer as TCP, UDP, SCTP, or DCCP, but ICMP is not a transport protocol in the sense that it is not used by user programs. In fact, under Unix and Linux you need root privileges to send or receive ICMP packets.
ICMP is used to
- query a node about information
- transmit network-level error messages (such as network unreachable or destination unreachable)
- diagnose network problems
ICMPv6 does even more, with IPv6 ARP and IGMP are gone and reborn as ICMPv6 neighbor discovery and multicast listener discovery. Thus ICMPv6 is also used to configure nodes on the link. It is therefore of paramount importance for IPv6 not to filter ICMPv6 away as is custom with legacy IP. For more details on how to filter ICMPv6 properly see RFC 4890.