How does the transport layer retrieve the source IP address from the datagram packet?

How does the transport layer retrieve the source IP address from the datagram packet? From what I understand, iPaddress is in the network layer header, and the transport layer header contains only the source port and destination port. Please let me know if I missed something.

+4
source share
1 answer

The simple answer is: the transport layer does not extract the IP address from the datagram packet.

When a datagram is sent from a source to a destination, here are simple steps for how IP works when the datagram moves:

  • The top-level application sends the packet to the network layer.
  • Calculation of data along with a checksum.
  • Created IP header and datagram.
  • Routing through gateways.
  • Each level of the IP gateway performs a checksum. If the checksum does not match, the datagram will be deleted and an error message will be sent back to the sending machine. Along the way, if the TTL decreases to 0, the same result will take place. And the routing path of the destination address will be determined at each stop when the datagram passes along the network.
  • The datagram goes to the network layer of the destination.
  • The checksum is calculated.
  • IP header selected.
  • The message goes to the top-level application.

EDIT

An application binds a socket to its data transfer endpoint, which is a combination of an IP address and a service port. This binding is then used to determine which application at the application level should pass.

For example, application A provides the UDP service on a specific port X. Then, when application A starts up, it will try to bind to port X. If it cannot bind to it because the port is in use, the operating system will cause an error that the application must process. In addition, in the OSI architecture, each layer relies on the underlying layer to actually transfer data, add or provide specific functions for its own purpose.

According to RFC

The pseudo header, conceptually preceded by the UDP header, contains the source address, destination address, protocol, and UDP length. This information provides protection against missing datagrams. This checksum procedure is the same as in TCP.

See RFC User Datagram Protocol for more details.

0
source

Source: https://habr.com/ru/post/1384826/


All Articles