aboutsummaryrefslogtreecommitdiff
path: root/lib/netlink-socket.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-01-11 16:05:37 -0800
committerBen Pfaff <blp@nicira.com>2011-01-27 09:26:05 -0800
commit6b7c12fdc1d3a08a934b29109fa6ffac6b45ebe0 (patch)
tree70dd3b66365d0ffa0d6ac994e06c6c4bda197087 /lib/netlink-socket.c
parentcceb11f5b12d09cc8afc87ca4fd03e941234d439 (diff)
netlink-socket: New function for draining the receive buffer.
This will be used in an upcoming patch. Reviewed by Justin Pettit.
Diffstat (limited to 'lib/netlink-socket.c')
-rw-r--r--lib/netlink-socket.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index 8e81da9c..9e3dd977 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -28,6 +28,7 @@
#include "netlink-protocol.h"
#include "ofpbuf.h"
#include "poll-loop.h"
+#include "socket-util.h"
#include "stress.h"
#include "vlog.h"
@@ -446,6 +447,13 @@ recv:
return 0;
}
+/* Drain all the messages currently in 'sock''s receive queue. */
+int
+nl_sock_drain(struct nl_sock *sock)
+{
+ return drain_rcvbuf(sock->fd);
+}
+
/* Starts a Netlink "dump" operation, by sending 'request' to the kernel via
* 'sock', and initializes 'dump' to reflect the state of the operation.
*