S
Sam
Esmond Pitt said:Sam
OK, if UDP or TCP or ICMP or whatever transport layer matches the socket
to the inbound IP packet, instead of IP, the local IP address *still*
doesn't get 'thrown away as the data goes up the protocol stack',
because it must still be there in the IP packet for TCP or UDP to do
this matching, and it must also available be in the socket descriptor to
be matched. Can we agree on that?
Now, that I can agree with. In fact, the "table" which matches ip and
port number to the socket turns out to be a linked series of data
blocks, each of which must contain at least a local port, but could
contain local ip, foriegn ip and foriegn port as well. These
eventuaully link back to the actual process via series of pointers,
according to Stevens' description of Berkely 4.x distributions.
This also means that TCP, UDP, ICMP &co indeed deal with IP data, &
just goes to show that TCP/IP implementation layering is not as clean as
you might like to think. Certainly IP doesn't have to deal with TCP
data, but the other way round does happen (no worse than a derived class
using methods from its base class really).
Of course Stevens vol II only describes one implementation. I don't know
that a 'cleaner' implementation where IP despatches packets to sockets
is infeasible either
What I learned was the traditional 5-layer model - App / Transport
(TCP,UDP)/ Ip / Link / Physical, is clarifed nicely in some key areas
by Steven's description of how the implementation itself is layered,
i.e:
Process / Socket Layer / Protocol Layer (TCP, UDP, IP, ICMP, IGMP) /
Interface layer.
So, here it becomes apparent that the "protocol layer" incorporates
both TCP and IP Data, assigning it to to the correct socket in the
end. This melds the transport and ip layer together in the
implementation stack, and there is clearly data overlap between the
two, specifically IP address. Nonetheless, the IP input and UDP and
TCP input routines and funtionality are clearly distinct.
Ca suffit,
Sam90