VOM: vxlan-tunnel mcast interface fix
[vpp.git] / src / vcl / ldp.c
index f3ac310..2468bcc 100644 (file)
@@ -646,6 +646,9 @@ ldp_select_libc_map_merge (clib_bitmap_t * result, fd_set * __restrict libcb)
 {
   uword fd;
 
+  if (!libcb)
+    return;
+
   /* *INDENT-OFF* */
   clib_bitmap_foreach (fd, result, ({
     FD_SET ((int)fd, libcb);
@@ -728,7 +731,8 @@ ldp_pselect (int nfds, fd_set * __restrict readfds,
       goto done;
     }
 
-  libc_tspec = si_bits ? libc_tspec : *timeout;
+  if (!si_bits)
+    libc_tspec = timeout ? *timeout : libc_tspec;
 
   do
     {
@@ -1478,7 +1482,7 @@ recvfrom (int fd, void *__restrict buf, size_t n, int flags,
          __SOCKADDR_ARG addr, socklen_t * __restrict addr_len)
 {
   vls_handle_t sid;
-  ssize_t size;
+  ssize_t size, rv;
 
   if ((errno = -ldp_init ()))
     return -1;
@@ -1495,7 +1499,11 @@ recvfrom (int fd, void *__restrict buf, size_t n, int flags,
          size = vls_recvfrom (sid, buf, n, flags, &ep);
 
          if (size > 0)
-           size = ldp_copy_ep_to_sockaddr (addr, addr_len, &ep);
+           {
+             rv = ldp_copy_ep_to_sockaddr (addr, addr_len, &ep);
+             if (rv < 0)
+               size = rv;
+           }
        }
       else
        size = vls_recvfrom (sid, buf, n, flags, NULL);