From 2e64a82d8fb232d0accf63d4cba4912709e33122 Mon Sep 17 00:00:00 2001 From: Jan Gutter Date: Wed, 4 Oct 2017 15:37:46 +0200 Subject: [PATCH] Fix "Message truncated" issue with many VF's * When querying a Physical Function netdev with a large amount of VF's, the resulting return message can overflow the 16K netlink message buffer. * This can be fixed by enabling message peeking on the socket and resizing the buffer on receive, or by simply enlarging the receive buffer. * Since there's an upper limit to the number of VF's per PF, it's relatively sane to just enlarge the receive buffer. * Test case: # Observed on Ubuntu kernel 4.4.0-93-generic on 14.04 and 16.04 # Set up 60 VF's on an SR-IOV device ip link show > /dev/null Message truncated Message truncated Message truncated Signed-off-by: Jan Gutter --- lib/libnetlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libnetlink.c b/lib/libnetlink.c index 9e2a7958..b02d536d 100644 --- a/lib/libnetlink.c +++ b/lib/libnetlink.c @@ -193,7 +193,7 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth, .msg_iov = &iov, .msg_iovlen = 1, }; - char buf[16384]; + char buf[65536]; int dump_intr = 0; iov.iov_base = buf; -- 2.14.2