History

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.

David Ahern committed 10 years ago

Commit 67eb0331 parent 22fae972 files · +29 −0Browse files

Unified · Split

2 files
  1. drivers/net/vrf.c +21 −0
  2. include/uapi/linux/if_link.h +8 −0
drivers/net/vrf.c+21−0
@@ -877,6 +877,24 @@ static int vrf_fillinfo(struct sk_buff *skb, · 876 unmodified lines
877 return nla_put_u32(skb, IFLA_VRF_TABLE, vrf->tb_id);877 return nla_put_u32(skb, IFLA_VRF_TABLE, vrf->tb_id);
878}878}
879 879
880static 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
886static 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
880static const struct nla_policy vrf_nl_policy[IFLA_VRF_MAX + 1] = {898static const struct nla_policy vrf_nl_policy[IFLA_VRF_MAX + 1] = {
881 [IFLA_VRF_TABLE] = { .type = NLA_U32 },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 .validate = vrf_validate,908 .validate = vrf_validate,
891 .fill_info = vrf_fillinfo,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 .newlink = vrf_newlink,914 .newlink = vrf_newlink,
894 .dellink = vrf_dellink,915 .dellink = vrf_dellink,
895 .setup = vrf_setup,916 .setup = vrf_setup,
include/uapi/linux/if_link.h+8−0
@@ -405,6 +405,14 @@ enum { · 404 unmodified lines
405 405
406#define IFLA_VRF_MAX (__IFLA_VRF_MAX - 1)406#define IFLA_VRF_MAX (__IFLA_VRF_MAX - 1)
407 407
408enum {
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/* IPVLAN section */416/* IPVLAN section */
409enum {417enum {
410 IFLA_IPVLAN_UNSPEC,418 IFLA_IPVLAN_UNSPEC,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t