This patch explicitely set timeout for select in mnl_batch_talk. Timeout used at the second call was the time spend on first select and this was not looking correct. Instead this patch set a short timeout as we are supposed to dequeue waiting kernel messages. Signed-off-by: Eric Leblond <eric@xxxxxxxxx> --- src/mnl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mnl.c b/src/mnl.c index 76a9714..2da1074 100644 --- a/src/mnl.c +++ b/src/mnl.c @@ -246,7 +246,7 @@ int mnl_batch_talk(struct mnl_socket *nl, struct list_head *err_list) char rcv_buf[MNL_SOCKET_BUFFER_SIZE]; fd_set readfds; struct timeval tv = { - .tv_sec = 0, + .tv_sec = 10, .tv_usec = 0 }; @@ -274,6 +274,8 @@ int mnl_batch_talk(struct mnl_socket *nl, struct list_head *err_list) if (ret == -1) mnl_err_list_node_add(err_list, errno, nlh->nlmsg_seq); + tv.tv_sec = 0; + tv.tv_usec = 1000; ret = select(fd+1, &readfds, NULL, NULL, &tv); if (ret == -1) return -1; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html