[Xorp-hackers] RFC: Use one socket per interface for receiving packets in the FEA.

Ben Greear greearb at candelatech.com
Sun Mar 2 22:28:19 PST 2008


Bruce M Simpson wrote:
> Ben Greear wrote:
>>
>> The new patch is attached.
>
> First of all, thanks for the patch. I'm sure we need to implement 
> semantics like this.
>
> The patch touches a few places in the xorp-olsr branch where I've 
> converted MFEA related code to use libcomm functions which had to be 
> implemented for OLSR support.
>
> BTW, quick question: why do you need to use a XorpFd* instead of a 
> reference?
I like to be able to return NULL if we cannot find the socket, rather 
than create one that is
invalid.  It's also more efficient to pass back pointers than use an 
object copy (and you can't
pass back a reference to some tmp object on the stack, so you can't just 
pass back some dummy
object that is logically equiv to NULL.)

But, it's just a matter of taste...I'll not complain if you eventually 
apply something
that uses references instead...
>
> XorpFd's constructor guarantees that it is initialized to an invalid 
> value regardless of the platform it's on, which covers the case where 
> lazy allocation is needed (a quick read suggests you are lazy 
> allocating the fd).

Yes, I am lazy allocating it...but even if we weren't, it's possible for 
code (buggy or otherwise) to request a socket
for a device that just does not currently exist..and I wouldn't want to 
create a dummy to pass back
as reference in that case.

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com> 
Candela Technologies Inc  http://www.candelatech.com




More information about the Xorp-hackers mailing list