RFC 3330 states,
127.0.0.0/8 - This block is assigned for use as the Internet host loopback address. A datagram sent by a higher level protocol to an address anywhere within this block should loop back inside the host. This is ordinarily implemented using only 127.0.0.1/32 for loopback, but no addresses within this block should ever appear on any network anywhere.
Okay, here's what I know.
Datagrams are UDP PDU's (Layer 3).
Segments are TCP PDU's (Layer 3).
Packets are IP PDU's (Layer 2).
Frames are Layer 1 PDU's.
(Using TCP/ IP Model for reference)
Ping uses ICMP which, from what I understood, is a Layer 2 (Internet) protocol. According to RFC 3330, "A datagram sent by a higher level protocol to [a loopback address] should loop back inside the host."
Now, is RFC 3330 using "datagram" in a general manner, as a generic PDU, and not specifically referring to a UDP PDU?
If not, how is it that ping, using the ICMP protocol, is sending a datagram (Layer 3 PDU) to the loopback address when, if I'm not mistaken, it should be sending a packet (Layer 2/ Internet PDU)? Doesn't ping bypass the Transport layer (thus it does not need TCP or UDP ports, but rather, uses raw sockets)?