Jan Gutter
2017-01-12 10:29:24 UTC
When enumerating devices on systems with a large amount of
network virtual functions, the netlink receive buffer could
be too small and the message gets truncated.
This patch enables peeking: libnl will first query the buffer
size, expand the receive buffer to the correct size, then
receive the full buffer.
For a similar issue in libvirt.git, look at commit ID:
8c70d04bab7278c96390a913fa949a17cd3124f9
Reviewed-by: Dinan Gunawardena <***@netronome.com>
Signed-off-by: Jan Gutter <***@netronome.com>
---
src/dutil_linux.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/dutil_linux.c b/src/dutil_linux.c
index f1bf8e0..742153a 100644
--- a/src/dutil_linux.c
+++ b/src/dutil_linux.c
@@ -687,6 +687,7 @@ int netlink_init(struct netcf *ncf) {
goto error;
if (nl_connect(ncf->driver->nl_sock, NETLINK_ROUTE) < 0)
goto error;
+ nl_socket_enable_msg_peek(ncf->driver->nl_sock);
ncf->driver->link_cache = __rtnl_link_alloc_cache(ncf->driver->nl_sock);
if (ncf->driver->link_cache == NULL)
network virtual functions, the netlink receive buffer could
be too small and the message gets truncated.
This patch enables peeking: libnl will first query the buffer
size, expand the receive buffer to the correct size, then
receive the full buffer.
For a similar issue in libvirt.git, look at commit ID:
8c70d04bab7278c96390a913fa949a17cd3124f9
Reviewed-by: Dinan Gunawardena <***@netronome.com>
Signed-off-by: Jan Gutter <***@netronome.com>
---
src/dutil_linux.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/dutil_linux.c b/src/dutil_linux.c
index f1bf8e0..742153a 100644
--- a/src/dutil_linux.c
+++ b/src/dutil_linux.c
@@ -687,6 +687,7 @@ int netlink_init(struct netcf *ncf) {
goto error;
if (nl_connect(ncf->driver->nl_sock, NETLINK_ROUTE) < 0)
goto error;
+ nl_socket_enable_msg_peek(ncf->driver->nl_sock);
ncf->driver->link_cache = __rtnl_link_alloc_cache(ncf->driver->nl_sock);
if (ncf->driver->link_cache == NULL)
--
2.11.0
_______________________________________________
netcf-devel mailing list -- netcf-***@lists.fedorahosted.org
To unsubscribe send
2.11.0
_______________________________________________
netcf-devel mailing list -- netcf-***@lists.fedorahosted.org
To unsubscribe send