diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 83969b5777..9483e22966 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1280,13 +1280,19 @@ virNetDevLinkDump(const char *ifname, int ifindex, goto buffer_too_small; } -# if defined(IFLA_EXT_MASK) && defined(RTEXT_FILTER_VF) +# ifdef RTEXT_FILTER_VF /* if this filter exists in the kernel's netlink implementation, * we need to set it, otherwise the response message will not * contain the IFLA_VFINFO_LIST that we're looking for. */ - if (nla_put(nl_msg, IFLA_EXT_MASK, RTEXT_FILTER_VF) < 0) - goto buffer_too_small; + { + uint32_t ifla_ext_mask = RTEXT_FILTER_VF; + + if (nla_put(nl_msg, IFLA_EXT_MASK, + sizeof(ifla_ext_mask), &ifla_ext_mask) < 0) { + goto buffer_too_small; + } + } # endif if (virNetlinkCommand(nl_msg, recvbuf, &recvbuflen, src_pid, dst_pid) < 0)