[openbeosnetteam] Re: Network stack question

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: openbeosnetteam@xxxxxxxxxxxxx
  • Date: Tue, 10 Jul 2007 14:13:33 +0200 CEST

Ivo Vachkov <ivo@xxxxxxxxxxx> wrote:
> Axel Dörfler wrote:
> > On the sending side of things, ICMP should register itself as the 
> > error 
> > handling protocol for the domain (via new stack methods to do 
> > that). I 
> > am not yet sure how to go from there - probably, there has to be a 
> > stack function send_error() that gets the protocol module as well 
> > as 
> > the data as error_reply() above, and will then call the error 
> > handler 
> > (ie. ICMPv4) to build a reply buffer then is then pushed down the 
> > stack 
> > using error_reply() - which I would then rename to send_error() as 
> > well. It will probably also need to know where to send the error to 
> > - 
> > either from the error-causing buffer, or from some route that the 
> > stack's send_error() would then also need to get.
> I am a bit confused. So I'll try to explain my understanding of the 
> following like this:
> 1. Handling Received ICMP info/error messages:
> in IP module:
> - we see it's an ICMP packet
> - we send it to icmp receive_data()
> in ICMP module:
> - we check if we can deal with that packet
> - if we can deal - we handle it appropriately (like 
> echo/timestamp/information replies)
> - if we can not:
>       - set a module pointer to the appropriate protocol module
>       - call module->error();

If we cannot, we:
        - call the domain's receive_error() function (currently called 
        - and that is propagating the packet (and error code) to the right 

> 2. Generating/Sending ICMP error messages:
> in IP module:
> - module->receive_data() returns error
> - we call module->error_reply()
> in module->error_reply():
> - set a pointer to the icmp protocol module
> - call icmp_module->error_reply()
> Is this the proper way ? Am I missing something ?

Above, I've described that process very differently, but I'm not too 
sure how well it would work (though I think it would be worth a try) 
(the ICMP module registered with the stack as error handler of the IPv4 
- a module which needs to send an error packet will call a stack method 
which in turn let's the error handler do its job (it will need a route, 
- only ICMP would implement the send_error() call then (currently 
called error_reply()), and call send_routed_data() on the domain to 
push the data to the network

Alternatively, it could look like this:
- a module which needs to send an error will call the send_error() 
function of the next protocol in the chain
- the IPv4 module will call the registered error handler to build the 
packet, and will then send it further.

In both cases, module->receive_data() would not need to fail, and IPv4 
would still not have any special handling in case it does.
I'm not sure which one would be better - for IPv4 both of them would be 
reasonably, but I don't know for other protocol's needs, such as IPv6. 
Maybe Hugo can shed a light on that.


Other related posts: