summaryrefslogtreecommitdiffstats
path: root/lib/route/link.c
diff options
context:
space:
mode:
authorJef Oliver <jef.oliver@intel.com>2016-05-16 23:23:23 (GMT)
committerThomas Haller <thaller@redhat.com>2016-06-24 17:25:55 (GMT)
commit90c6ebec9bd7adbe6dc7aca114b4304c1ba02f6d (patch)
treefa1ff9172f40f4f70735963488cf657ce92eefb6 /lib/route/link.c
parent3bf503d30c271822158414f63eed620afc9b10cd (diff)
downloadlibnl-90c6ebec9bd7adbe6dc7aca114b4304c1ba02f6d.zip
libnl-90c6ebec9bd7adbe6dc7aca114b4304c1ba02f6d.tar.gz
libnl-90c6ebec9bd7adbe6dc7aca114b4304c1ba02f6d.tar.bz2
link: support RTEXT_FILTER_VF
This patch adds RTEXT_FILTER_VF mask support for SRIOV VFs. Since SRIOV VFs don't have a defined address family (ie bridge), there are no new address family specific operations defined. Exposing this mask makes rtnl_link_get_num_vfs() properly return the number of loaded SRIOV VFs. Signed-off-by: Jef Oliver <jef.oliver@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com> http://lists.infradead.org/pipermail/libnl/2016-May/002115.html http://lists.infradead.org/pipermail/libnl/2016-May/002123.html
Diffstat (limited to 'lib/route/link.c')
-rw-r--r--lib/route/link.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/route/link.c b/lib/route/link.c
index 1fa2672..48eb6d3 100644
--- a/lib/route/link.c
+++ b/lib/route/link.c
@@ -677,6 +677,7 @@ static int link_request_update(struct nl_cache *cache, struct nl_sock *sk)
struct rtnl_link_af_ops *ops;
struct nl_msg *msg;
int err;
+ __u32 vf_mask = RTEXT_FILTER_VF;
msg = nlmsg_alloc_simple(RTM_GETLINK, NLM_F_DUMP);
if (!msg)
@@ -686,12 +687,17 @@ static int link_request_update(struct nl_cache *cache, struct nl_sock *sk)
if (nlmsg_append(msg, &hdr, sizeof(hdr), NLMSG_ALIGNTO) < 0)
goto nla_put_failure;
+ err = nla_put(msg, IFLA_EXT_MASK, sizeof(vf_mask), &vf_mask);
+ if (err)
+ goto nla_put_failure;
+
ops = rtnl_link_af_ops_lookup(family);
if (ops && ops->ao_get_af) {
err = ops->ao_get_af(msg);
if (err)
goto nla_put_failure;
}
+
err = nl_send_auto(sk, msg);
if (err > 0)
err = 0;
@@ -1218,6 +1224,8 @@ int rtnl_link_build_get_request(int ifindex, const char *name,
{
struct ifinfomsg ifi;
struct nl_msg *msg;
+ __u32 vf_mask = RTEXT_FILTER_VF;
+ int err = -NLE_MSGSIZE;
if (ifindex <= 0 && !name) {
APPBUG("ifindex or name must be specified");
@@ -1232,18 +1240,24 @@ int rtnl_link_build_get_request(int ifindex, const char *name,
if (ifindex > 0)
ifi.ifi_index = ifindex;
- if (nlmsg_append(msg, &ifi, sizeof(ifi), NLMSG_ALIGNTO) < 0)
+ if (nlmsg_append(msg, &ifi, sizeof(ifi), NLMSG_ALIGNTO) < 0) {
+ err = -NLE_MSGSIZE;
goto nla_put_failure;
+ }
if (name)
NLA_PUT_STRING(msg, IFLA_IFNAME, name);
+ err = nla_put(msg, IFLA_EXT_MASK, sizeof(vf_mask), &vf_mask);
+ if (err)
+ goto nla_put_failure;
+
*result = msg;
return 0;
nla_put_failure:
nlmsg_free(msg);
- return -NLE_MSGSIZE;
+ return err;
}
/**