[Xorp-hackers] XRL is busy and does not send

Philip Hugg phugg at crc.ca
Thu May 19 08:24:09 PDT 2011


Hello everyone,

I'm currently working on Xorp-OLSR.

The problem with OLSR is the route flapping.
I've managed to find a few obvious bugs up to now however this one
involves the interface to the XRL. I'm not sure how to fix.

The problem I found is in file 'xrl_port.cc' where OLSR is sending the 
packets

Here's the portion of the code:
(extracted from the xorp/socket_programming document)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

//
// Sending operations.
//
template  <>
bool  PortBase<IPv4>
::send_to(const  IPv4&  dst_address,
         const  uint16_t  dst_port,
         const  vector<uint8_t>&  payload)
{
     if  (_pending)  {
         debug_msg("PortOutput %p: send skipped (pending XRL)\n",this);
         return  false;
     }
  
     XrlSocket4V0p1Client cl(&_xrl_router);

     bool  success=  cl.send_send_to(_socket_server_name.c_str(),
                                    _socket_id,
                                    dst_address,
                                    dst_port,
                                    payload,
                                    callback(this,&PortBase::send_cb));
  
     debug_msg("Sent %u bytes to %s:%u from %s:%u\n",
               XORP_UINT_CAST(payload.size()),
               cstring(_dst_addr), XORP_UINT_CAST(_dst_port),
               cstring(_src_addr), XORP_UINT_CAST(_src_port));

     if  (success)
         _pending=  true;

     return  success;
}

template  <typename  A>
void
PortBase::send_cb(const  XrlError&  e)
{
     debug_msg("SendCB %s\n", e.str().c_str());

     if  (e!=  XrlError::OKAY())  {
         XLOG_WARNING("Failed to send datagram.");
     }
  
     _pending=  false;
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Now what I'm seeing is the debug message "PortOutput ...: send skipped 
(pending XRL)".
It doesn't happen all the time but it's just enough to cause route flapping.

My question is how could I fix the pending issue without causing a race 
condition in the code?


I haven't looked into XRL yet but I don't understand why the packet is 
not sent.
Should it be OLSR's responsibility to re-shedule the resending of the 
packet?
Does this problem occur on the other routing protocols (BGP, OSPF ...)?

Thanks,
Phil.




More information about the Xorp-hackers mailing list