summaryrefslogtreecommitdiff
path: root/lib/netlink-notifier.c
diff options
context:
space:
mode:
authorDaniele Di Proietto <ddiproietto@vmware.com>2014-07-22 06:38:57 +0000
committerAlex Wang <alexw@nicira.com>2014-07-22 16:33:42 -0700
commit222f04515fe158935e61c3db9e974ce5b8615944 (patch)
treeb65db6248395c70d38be0dfd3e86b7f7bad320b8 /lib/netlink-notifier.c
parent5a80e6062adcc2cfd937be56314281d17f9d517c (diff)
downloadopenvswitch-222f04515fe158935e61c3db9e974ce5b8615944.tar.gz
netlink-notifier: Exit loop if nl_sock_recv() returns an error
An error from nl_sock_recv() could mean that there are some issues with the netlink socket (EBADF, ENOTSOCK, ...). Calling nl_sock_recv() in this case is harmful: nln_run() will never return and since we are calling it from the main thread, vswitchd becomes unresponsive. Also, with this commit we avoid calling the notifier callback in case of error (except for ENOBUFS, which means that there could be too many notifications) Suggested-by: Alex Wang <alexw@nicira.com> Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com> Acked-by: Ben Pfaff <blp@nicira.com> Acked-by: Alex Wang <alexw@nicira.com>
Diffstat (limited to 'lib/netlink-notifier.c')
-rw-r--r--lib/netlink-notifier.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/netlink-notifier.c b/lib/netlink-notifier.c
index 9aa185d5b..0be851838 100644
--- a/lib/netlink-notifier.c
+++ b/lib/netlink-notifier.c
@@ -182,12 +182,15 @@ nln_run(struct nln *nln)
return;
} else {
if (error == ENOBUFS) {
+ /* The socket buffer might be full, there could be too many
+ * notifications, so it makes sense to call nln_report() */
+ nln_report(nln, NULL);
VLOG_WARN_RL(&rl, "netlink receive buffer overflowed");
} else {
VLOG_WARN_RL(&rl, "error reading netlink socket: %s",
ovs_strerror(error));
}
- nln_report(nln, NULL);
+ return;
}
}
}