The maximum message size for recent Linux kernels is 32Kb and in older
kernels it is 16KB.

See http://www.spinics.net/lists/netdev/msg431592.html

Adjust the size checked and update a comment.

Signed-off-by: Greg Rose <gvrose8...@gmail.com>
---
 lib/netlink-socket.c | 2 +-
 lib/netlink.c        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index ccfd55e..507d764 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -613,7 +613,7 @@ nl_sock_recv__(struct nl_sock *sock, struct ofpbuf *buf, 
bool wait)
      * caller is supposed to have allocated enough space in 'buf' to handle the
      * "typical" case.  To handle exceptions, we make available enough space in
      * 'tail' to allow Netlink messages to be up to 64 kB long (a reasonable
-     * figure since that's the maximum length of a Netlink attribute). */
+     * figure since the kernel's maximum length message is 32KB). */
     struct nlmsghdr *nlmsghdr;
     uint8_t tail[65536];
     struct iovec iov[2];
diff --git a/lib/netlink.c b/lib/netlink.c
index de3ebcd..04310ff 100644
--- a/lib/netlink.c
+++ b/lib/netlink.c
@@ -570,7 +570,7 @@ nl_msg_next(struct ofpbuf *buffer, struct ofpbuf *msg)
 bool
 nl_attr_oversized(size_t payload_size)
 {
-    return payload_size > UINT16_MAX - NLA_HDRLEN;
+    return payload_size > INT16_MAX - NLA_HDRLEN;
 }
 
 /* Attributes. */
-- 
1.8.3.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to