Commit 67eb0331 authored by David Ahern's avatar David Ahern Committed by David S. Miller

net: Add support for fill_slave_info to VRF device

Allows userspace to have direct access to VRF table association
versus looking up master device and its table.
Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 22fae97d
...@@ -877,6 +877,24 @@ static int vrf_fillinfo(struct sk_buff *skb, ...@@ -877,6 +877,24 @@ static int vrf_fillinfo(struct sk_buff *skb,
return nla_put_u32(skb, IFLA_VRF_TABLE, vrf->tb_id); return nla_put_u32(skb, IFLA_VRF_TABLE, vrf->tb_id);
} }
static size_t vrf_get_slave_size(const struct net_device *bond_dev,
const struct net_device *slave_dev)
{
return nla_total_size(sizeof(u32)); /* IFLA_VRF_PORT_TABLE */
}
static int vrf_fill_slave_info(struct sk_buff *skb,
const struct net_device *vrf_dev,
const struct net_device *slave_dev)
{
struct net_vrf *vrf = netdev_priv(vrf_dev);
if (nla_put_u32(skb, IFLA_VRF_PORT_TABLE, vrf->tb_id))
return -EMSGSIZE;
return 0;
}
static const struct nla_policy vrf_nl_policy[IFLA_VRF_MAX + 1] = { static const struct nla_policy vrf_nl_policy[IFLA_VRF_MAX + 1] = {
[IFLA_VRF_TABLE] = { .type = NLA_U32 }, [IFLA_VRF_TABLE] = { .type = NLA_U32 },
}; };
...@@ -890,6 +908,9 @@ static struct rtnl_link_ops vrf_link_ops __read_mostly = { ...@@ -890,6 +908,9 @@ static struct rtnl_link_ops vrf_link_ops __read_mostly = {
.validate = vrf_validate, .validate = vrf_validate,
.fill_info = vrf_fillinfo, .fill_info = vrf_fillinfo,
.get_slave_size = vrf_get_slave_size,
.fill_slave_info = vrf_fill_slave_info,
.newlink = vrf_newlink, .newlink = vrf_newlink,
.dellink = vrf_dellink, .dellink = vrf_dellink,
.setup = vrf_setup, .setup = vrf_setup,
......
...@@ -405,6 +405,14 @@ enum { ...@@ -405,6 +405,14 @@ enum {
#define IFLA_VRF_MAX (__IFLA_VRF_MAX - 1) #define IFLA_VRF_MAX (__IFLA_VRF_MAX - 1)
enum {
IFLA_VRF_PORT_UNSPEC,
IFLA_VRF_PORT_TABLE,
__IFLA_VRF_PORT_MAX
};
#define IFLA_VRF_PORT_MAX (__IFLA_VRF_PORT_MAX - 1)
/* IPVLAN section */ /* IPVLAN section */
enum { enum {
IFLA_IPVLAN_UNSPEC, IFLA_IPVLAN_UNSPEC,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment