[Olsr-dev] about olsrd problem "sendto(v4): Resource temporarily unavailable"

simba226 (spam-protected)
Wed Jan 7 09:31:16 CET 2009

    Our project is to mount several virtual interfaces on only one real wireless interface drived by madwifi in a host pc. Meanwhile, OLSR is operated on the virtual interfaces, which is achieved by tun/tap.
It is a bi-direction link. Standing on the point of the host machine,when a virtual interface called "tap0" sends packets, we captures the packets on the virtual interfaces by libpcap ,then forwarding the captured packets to the host machine's real interface called "ath0" by libnet to send to the node outside the host machine. On the other direction,when a packet outside the host machine is to send to the virtual interface,at first it arrives at the real interface "ath0",we captured the packet on "ath0" then "write" the packet to "tap0".
    Then we run olsrd on these nodes.At the beginning,it worked  well.We can find the virtual interfaces in the network topology.But after a few minutes, about sending 366 packets,the olsrd running on the  virtual interfaces didn't send packets.Meanwhile, the command line running olsrd output the error that "sendto(v4): Resource temporarily unavailable".The connection between the virtual interface and other real interfaces is interrupted.
    I look into the source of olsrd,and find that select() is only used in receiving function, but not used in sending function.I added select() in the olsr_sendto()(in src/linux/net.c) to set the waiting time in tvp like this:
ssize_t  olsr_sendto(int s, 
        const void *buf, 
        size_t len, 
        int flags, 
        const struct sockaddr *to, 
        socklen_t tolen)
  fd_set wrbits;
  struct timeval tvp = {0,100000};
  int n,maxfdp1;
  FD_SET(s, &wrbits);
  n= olsr_select( maxfdp1+1, NULL,&wrbits, NULL, &tvp);
   if(n == 0)
   return 0;
   if (n < 0) 
      if(errno != EINTR) {
        const char * const err_msg = strerror(errno);
        OLSR_PRINTF(1, "Error select: %s", err_msg);
      return 0;

       if(FD_ISSET(s, &wrbits))
  return sendto(s, buf, len, flags, to, tolen);    
But it always has such a problem.Before adding select(),it always sends about 366 packets then display "sendto(v4): Resource temporarily unavailable".Now it sends about 183 packets and then doesn't send packets, but the error response that "sendto(v4): Resource temporarily unavailable" doesn't exhibit.Who can tell me why the problem occur?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20090107/45525014/attachment.html>

More information about the Olsr-dev mailing list