if (n_msgs)
vec_delete (nm->nl_msg_queue, n_msgs, 0);
- NL_INFO ("Processed %u messages", n_msgs);
+ NL_DBG ("Processed %u messages", n_msgs);
return n_msgs;
}
msg_info->msg = msg;
nlmsg_get (msg);
- /* notify process node if netlink notification processing is active */
- if (nm->nl_status == NL_STATUS_NOTIF_PROC)
- {
- vlib_process_signal_event (vlib_get_main (), nl_route_process_node.index,
- NL_EVENT_READ, 0);
- }
-
return 0;
}
int err;
nl_main_t *nm = &nl_main;
- /* Read until there's an error. Unless the error is ENOBUFS, which means
- * the kernel couldn't send a message due to socket buffer overflow.
- * Continue reading when that happens.
- *
- * libnl translates both ENOBUFS and ENOMEM to NLE_NOMEM. So we need to
- * check return status and errno to make sure we should keep going.
- */
- while ((err = nl_recvmsgs_default (nm->sk_route)) > -1 ||
- (err == -NLE_NOMEM && errno == ENOBUFS))
+ /* Read until there's an error */
+ while ((err = nl_recvmsgs_default (nm->sk_route)) > -1)
;
/* If there was an error other then EAGAIN, signal process node */
if (err != -NLE_AGAIN)
vlib_process_signal_event (vlib_get_main (), nl_route_process_node.index,
NL_EVENT_ERR, 0);
+ else
+ {
+ /* If netlink notification processing is active, signal process node
+ * there were notifications read
+ */
+ if (nm->nl_status == NL_STATUS_NOTIF_PROC)
+ vlib_process_signal_event (
+ vlib_get_main (), nl_route_process_node.index, NL_EVENT_READ, 0);
+ }
return err;
}
nm->sk_route_sync[sock_type] = sk_route = nl_socket_alloc ();
dest_ns_fd = lcp_get_default_ns_fd ();
- if (dest_ns_fd)
+ if (dest_ns_fd > 0)
{
curr_ns_fd = clib_netns_open (NULL /* self */);
- clib_setns (dest_ns_fd);
+ if (clib_setns (dest_ns_fd) == -1)
+ NL_ERROR ("Cannot set destination ns");
}
nl_connect (sk_route, NETLINK_ROUTE);
- if (dest_ns_fd)
+ if (dest_ns_fd > 0)
{
- clib_setns (curr_ns_fd);
- close (curr_ns_fd);
+ if (curr_ns_fd == -1)
+ {
+ NL_ERROR ("No previous ns to set");
+ }
+ else
+ {
+ if (clib_setns (curr_ns_fd) == -1)
+ NL_ERROR ("Cannot set previous ns");
+ close (curr_ns_fd);
+ }
}
NL_INFO ("Opened netlink synchronization socket %d of type %d",