Allows userspace to have direct access to VRF table association versus looking up master device and its table.
Unified · Split
| @@ -877,6 +877,24 @@ static int vrf_fillinfo(struct sk_buff *skb, · 876 unmodified lines | ||
| 877 | 877 | return nla_put_u32(skb, IFLA_VRF_TABLE, vrf->tb_id); |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | +static size_t vrf_get_slave_size(const struct net_device *bond_dev, | |
| 881 | + const struct net_device *slave_dev) | |
| 882 | +{ | |
| 883 | + return nla_total_size(sizeof(u32)); /* IFLA_VRF_PORT_TABLE */ | |
| 884 | +} | |
| 885 | + | |
| 886 | +static int vrf_fill_slave_info(struct sk_buff *skb, | |
| 887 | + const struct net_device *vrf_dev, | |
| 888 | + const struct net_device *slave_dev) | |
| 889 | +{ | |
| 890 | + struct net_vrf *vrf = netdev_priv(vrf_dev); | |
| 891 | + | |
| 892 | + if (nla_put_u32(skb, IFLA_VRF_PORT_TABLE, vrf->tb_id)) | |
| 893 | + return -EMSGSIZE; | |
| 894 | + | |
| 895 | + return 0; | |
| 896 | +} | |
| 897 | + | |
| 880 | 898 | static const struct nla_policy vrf_nl_policy[IFLA_VRF_MAX + 1] = { |
| 881 | 899 | [IFLA_VRF_TABLE] = { .type = NLA_U32 }, |
| 882 | 900 | }; |
| @@ -890,6 +908,9 @@ static struct rtnl_link_ops vrf_link_ops __read_mostly = { · 7 unmodified lines | ||
| 890 | 908 | .validate = vrf_validate, |
| 891 | 909 | .fill_info = vrf_fillinfo, |
| 892 | 910 | |
| 911 | + .get_slave_size = vrf_get_slave_size, | |
| 912 | + .fill_slave_info = vrf_fill_slave_info, | |
| 913 | + | |
| 893 | 914 | .newlink = vrf_newlink, |
| 894 | 915 | .dellink = vrf_dellink, |
| 895 | 916 | .setup = vrf_setup, |
| @@ -405,6 +405,14 @@ enum { · 404 unmodified lines | ||
| 405 | 405 | |
| 406 | 406 | #define IFLA_VRF_MAX (__IFLA_VRF_MAX - 1) |
| 407 | 407 | |
| 408 | +enum { | |
| 409 | + IFLA_VRF_PORT_UNSPEC, | |
| 410 | + IFLA_VRF_PORT_TABLE, | |
| 411 | + __IFLA_VRF_PORT_MAX | |
| 412 | +}; | |
| 413 | + | |
| 414 | +#define IFLA_VRF_PORT_MAX (__IFLA_VRF_PORT_MAX - 1) | |
| 415 | + | |
| 408 | 416 | /* IPVLAN section */ |
| 409 | 417 | enum { |
| 410 | 418 | IFLA_IPVLAN_UNSPEC, |