[Xorp-users] Question on supporting multiple routing tables [PATCH]

Ben Greear greearb at candelatech.com
Thu Aug 30 11:21:08 PDT 2007


Pavlin Radoslavov wrote:
> Ben Greear <greearb at candelatech.com> wrote:
> 
>> Here's a CVS diff that appears to add BINDTODEVICE support.  I still 
>> don't have OSPF
>> working properly..but I am not sure if that is related to my 
>> configuration or socket binding.
>>
>> Comments welcome.
> 
> I just committed the small delta for the XLOG_WARNING() message
> itself (with slight variation of the printed output):
> 
> Revision  Changes                               Path
> 1.11      +3 -3;  commitid: 115a646d7000f7ea6; xorp/fea/data_plane/io/io_ip_socket.cc
> 
> About the setsockopt(SO_BINDTODEVICE) code itself, I belive it
> should be moved to the IoIpSocket::proto_socket_transmit() method,
> because that method is called from several places, and it is the one
> that actually transmits the packet.

I can do this.  One question:  In the comments for send_packet, it says
if_name is optional for unicast packets..however it looks like the
actual code will error out if the ifp is not found:

     ifp = iftree().find_interface(if_name);
     if (ifp == NULL) {
	error_msg = c_format("No interface %s", if_name.c_str());
	return (XORP_ERROR);
     }

I assume the comments are wrong, or maybe the find_interface will grab
some random interface if if_name is blank?

For the proto_sock_transmit(), I guess I should just get the name from the ifp
and bind to that, or would you rather me pass in if_name ?

> Based on earlier analyses, I believe that for transmission purpose
> setsockopt(SO_BINDTODEVICE) is not needed for multicast packets,
> because we already set the outgoing interface/vif for such packets.

Ok, I did see multicast pkts on the 'wire' before making my changes,
so I think you are right.

> Finally, would it work if you replace "nl" with NULL when you try to
> un-bind.

Doesn't seem "NULL" is valid according to the man page.  Evidently you
can set the 'length' argument to 0 and have that work, but I wanted to
be doubly sure in case other OSs do things slightly different.

Thanks,
Ben

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



More information about the Xorp-users mailing list