[haiku-development] Re: GSoC ICMP implementation

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 24 Mar 2008 18:03:55 +0100 CET

"Alvarez, Alan SPC MIL USA FORSCOM" <alan.alvarez@xxxxxxxxxxx> wrote:
> > If ICMP registers itself with IPv4 anyway, the error handler could 
> > be called separately and before the header is cut off. Maybe you'll 
> > find a better solution, though :-)
> Ok, so since the bytes that contain the IPv4 header aren't exactly 
> removed,
> would it be safe then for the ICMP module to get the IPv4 header by 
> doing something like:

As I tried to explain earlier, this is not possible - the header might 
be in a different buffer internally, and would then be freed upon 
removal.

> I'm not exactly sure what you means by claimed.

The net_buffer module internally divides each net_buffer into 2048 byte 
chunks. The space in there is either marked used or free; when you 
remove a header, that space is marked free again. If someone else adds 
a new header, that space will be claimed again.

> If there is no way to safely get the IPv4 header back, another 
> approach could be
> to have all packets go through the ICMP module first before they get 
> to the upper
> layer modules. This would probably add unneeded overhead though and 
> the ICMP
> layer would need to know particular things about the upper layer 
> which I don't think
> is a good design.

Me neither.

> Another one would be to store the header somewhere temporarily and 
> have the IPv4
> module clean it up at a later time when it's obvious there weren't 
> any errors to report back.

Which would also imply a certain overhead per buffer.

Besides my suggestion above, there would also be the possibility to 
make each protocol be able to configure the IP level to its needs (this 
could then be stored in the sReceivingProtocol array).
Then each protocol could decide wether or not it wants to see the 
header or not.

Bye,
   Axel.


Other related posts: