[Ns-developers] TCP and UDP layer refactoring

Mathieu Lacage mathieu.lacage at sophia.inria.fr
Mon Jul 7 10:03:36 PDT 2008


On Mon, 2008-07-07 at 14:33 +0100, Gustavo Carneiro wrote:

> OK, I'll chip in with some comments, since I hacked that code in the past (
> http://www.nsnam.org/bugzilla/show_bug.cgi?id=136).
> 
> It sounds OK to remove the interface pointer parameter, but then you have to
> replace it with either:
>   1- A list of addresses associated with the netdevice in question;
>   2- A tag containing: a) a list of addresses, or b) NetDevice index;
> 
> The endpoint demux matching algorithm in question is supposed to be along
> these lines (at least a part of it):
> 
> FOREACH endpoint:
> 
>   // match destination address
>   IF packet.destAddr is unicast:
>          IF endpoint.destAddr != 0 AND packet.destAddr != endpoint.destAddr:
>                 CONTINUE
> 
>   ELSE: // broadcast or multicast
> 
>          IF endpoint.destAddr == 0:
>                PASS // socket is not bound to any specific interface, this
> always matches
>          ELSE:
>                interfaceMatches = False
>                FOREACH interfaceAddress IN
> incomingInterface.GetAllAddresses():
>                      IF endpoint.destAddr == interfaceAddress:
>                             interfaceMatch = True
>                             BREAK
>                IF NOT interfaceMatches:
>                       CONTINUE
> 
>   // match destination port
>   IF endpoint.destPort != 0 AND packet.destPort != endpoint.destPort:
>          CONTINUE
> 
>   matches.push_back (endpoint);
> 
> Now, the only thing that can change here is how to obtain the information
> incomingInterface.GetAllAddresses(), but the information needs to come from
> somewhere.

Another option would be to filter out unwanted packets at the socket
layer when the socket has been bound to a specific interface.

Mathieu



More information about the Ns-developers mailing list