IFLA_NUM_VF not set or improperly parsed

Thomas Graf tgraf at suug.ch
Thu Mar 13 08:02:10 EDT 2014


On 02/20/14 at 05:03pm, Jef Oliver wrote:
> I have this patched and working per your suggestion, and the
> definition of RTEXT_FILTER_VF. I want to make sure that
> rtnl_link_build_get_request() is the right area to do this in.
> Patching here allows rtnl_link_get_kernel() to properly report VFs
> on the system. However, it does not allow for cache operations to
> see that there are VFs. I'd imagine that being able to do this in
> cache operations is useful in some way, but I could be wrong.

Extending rtnl_link_build_get_request() will fix
rtnl_link_get_kernel() as you have confirmed. In order to also
fix it for cache operations, the function link_request_update()
needs to be extended to something like this:

static int link_request_update(struct nl_cache *cache, struct nl_sock *sk)
{
        struct ifinfomsg ifi;
        struct nl_msg *msg;
	int err = 0;

        memset(&ifi, 0, sizeof(ifi));

        if (!(msg = nlmsg_alloc_simple(RTM_GETLINK, NLM_F_DUMP)))
                return -NLE_NOMEM;

	ifi.ifi_family = cache->c_iarg1;

        if (nlmsg_append(msg, &ifi, sizeof(ifi), NLMSG_ALIGNTO) < 0) {
		err = -NLE_MSGSIZE;
                goto nla_put_failure;
	}

	NLA_PUT_U32(msg, IFLA_EXT_MASK, RTEXT_FILTER_VF);

	nl_send_auto(sk, msg);

nla_put_failure:
        nlmsg_free(msg);
        return err;
}



More information about the libnl mailing list