Re: IP header question

From: Andre Guibert de Bruet <andy_at_siliconlandmark.com>
Date: Sun, 29 Jul 2007 12:49:31 -0400
On Jul 27, 2007, at 1:43 PM, Steve Bertrand wrote:
> First of all, sorry for being off topic here, but I know there are  
> many
> people in this list that know the network stack inside and out.
>
> I have (hopefully) a couple very easy questions:
>
> When the term 'header stripping' is used as a packet is passed up the
> stack, what really happens? I don't understand how if a layers  
> header is
> 'stripped off' as it goes up, it will know where to be sent to as it
> goes back down.

On the way up, the IP header no longer matters once the socket that  
is seeing traffic is determined (Which hosts, port pairs, etc). It is  
important to remember that sockets have state information that gets  
updated with every accept(2) / bind(2) / connect(2) call. Reading the  
associated man pages will enlighten you. You may want to mull over  
the purpose of passing a struct sockaddr * to both of these syscalls.

> Does 'stripping' mean simply reading it on the way up (but not  
> discarding)?

No. Stripping means reading it and discarding it once the  
determination of where the data should go has been made.

> If so, when does the src/dst info for layer-3 and layer-2 get  
> reversed,
> on the way up, or the way back down?

"reversed"? Picture a client making a request to a server. The only  
time you go from layer 3 to layer 2 (Then to layer 1) is when sending  
data. When the server responds, the data makes its way up the various  
layers, starting from 1 all the way to the 7.

> If not, how does each layer know what destination information to  
> insert
> into the headers for the trip back to the source?

See my answers to your first two questions.

> Thanks very much for any insight.

Cheers,

/*  Andre Guibert de Bruet  * 436f 6465 2070 6f65 742e 2042 6974 206a */
/*   Code poet / Sysadmin   * 6f63 6b65 792e 2053 7973 4164 6d69 6e2e */
/*   GSM: +1 734 846 8758   * 2055 4e49 5820 736c 6575 7468 2e00 0000 */
/* WWW: siliconlandmark.com * C/C++, Java, Perl, PHP, SQL, XHTML, XML */
Received on Sun Jul 29 2007 - 15:01:53 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:15 UTC