Ignore NLMSG_DONE Netlink messages in dpif.
authorBen Pfaff <blp@nicira.com>
Wed, 28 May 2008 23:03:36 +0000 (16:03 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 28 May 2008 23:03:36 +0000 (16:03 -0700)
Otherwise the secchan considers the NLMSG_DONE at the end of a stats
dump to be an error and disconnects from the netlink connection.

Thanks to Martin for discovering the problem.

lib/dpif.c

index b5b4fb4b2fa4a6eb89f5a3f8cccebfb31327b6fe..506efe3dd296f11938f2500c8f6739a9b76a19b8 100644 (file)
@@ -135,7 +135,10 @@ dpif_recv_openflow(struct dpif *dp, struct buffer **bufferp,
     do {
         buffer_delete(buffer);
         retval = nl_sock_recv(dp->sock, &buffer, wait);
-    } while (retval == ENOBUFS || (!retval && nl_msg_nlmsgerr(buffer, NULL)));
+    } while (retval == ENOBUFS
+             || (!retval
+                 && (nl_msg_nlmsgerr(buffer, NULL)
+                     || nl_msg_nlmsghdr(buffer)->nlmsg_type == NLMSG_DONE)));
     if (retval) {
         if (retval != EAGAIN) {
             VLOG_WARN("dpif_recv_openflow: %s", strerror(retval));