rtnetlink.c (69e12d887cf4a22de736209df27604e3d2ff9845) | rtnetlink.c (645359930231d5e78fd3296a38b98c1a658a7ade) |
---|---|
1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Routing netlink socket interface: protocol independent part. 7 * 8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> --- 753 unchanged lines hidden (view full) --- 762 + nla_total_size(4) /* IFLA_NUM_RX_QUEUES */ 763 + nla_total_size(1) /* IFLA_OPERSTATE */ 764 + nla_total_size(1) /* IFLA_LINKMODE */ 765 + nla_total_size(ext_filter_mask 766 & RTEXT_FILTER_VF ? 4 : 0) /* IFLA_NUM_VF */ 767 + rtnl_vfinfo_size(dev, ext_filter_mask) /* IFLA_VFINFO_LIST */ 768 + rtnl_port_size(dev) /* IFLA_VF_PORTS + IFLA_PORT_SELF */ 769 + rtnl_link_get_size(dev) /* IFLA_LINKINFO */ | 1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Routing netlink socket interface: protocol independent part. 7 * 8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> --- 753 unchanged lines hidden (view full) --- 762 + nla_total_size(4) /* IFLA_NUM_RX_QUEUES */ 763 + nla_total_size(1) /* IFLA_OPERSTATE */ 764 + nla_total_size(1) /* IFLA_LINKMODE */ 765 + nla_total_size(ext_filter_mask 766 & RTEXT_FILTER_VF ? 4 : 0) /* IFLA_NUM_VF */ 767 + rtnl_vfinfo_size(dev, ext_filter_mask) /* IFLA_VFINFO_LIST */ 768 + rtnl_port_size(dev) /* IFLA_VF_PORTS + IFLA_PORT_SELF */ 769 + rtnl_link_get_size(dev) /* IFLA_LINKINFO */ |
770 + rtnl_link_get_af_size(dev) /* IFLA_AF_SPEC */ 771 + nla_total_size(MAX_PHYS_PORT_ID_LEN); /* IFLA_PHYS_PORT_ID */ | 770 + rtnl_link_get_af_size(dev); /* IFLA_AF_SPEC */ |
772} 773 774static int rtnl_vf_ports_fill(struct sk_buff *skb, struct net_device *dev) 775{ 776 struct nlattr *vf_ports; 777 struct nlattr *vf_port; 778 int vf; 779 int err; --- 62 unchanged lines hidden (view full) --- 842 err = rtnl_vf_ports_fill(skb, dev); 843 if (err) 844 return err; 845 } 846 847 return 0; 848} 849 | 771} 772 773static int rtnl_vf_ports_fill(struct sk_buff *skb, struct net_device *dev) 774{ 775 struct nlattr *vf_ports; 776 struct nlattr *vf_port; 777 int vf; 778 int err; --- 62 unchanged lines hidden (view full) --- 841 err = rtnl_vf_ports_fill(skb, dev); 842 if (err) 843 return err; 844 } 845 846 return 0; 847} 848 |
850static int rtnl_phys_port_id_fill(struct sk_buff *skb, struct net_device *dev) 851{ 852 int err; 853 struct netdev_phys_port_id ppid; 854 855 err = dev_get_phys_port_id(dev, &ppid); 856 if (err) { 857 if (err == -EOPNOTSUPP) 858 return 0; 859 return err; 860 } 861 862 if (nla_put(skb, IFLA_PHYS_PORT_ID, ppid.id_len, ppid.id)) 863 return -EMSGSIZE; 864 865 return 0; 866} 867 | |
868static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, 869 int type, u32 pid, u32 seq, u32 change, 870 unsigned int flags, u32 ext_filter_mask) 871{ 872 struct ifinfomsg *ifm; 873 struct nlmsghdr *nlh; 874 struct rtnl_link_stats64 temp; 875 const struct rtnl_link_stats64 *stats; --- 51 unchanged lines hidden (view full) --- 927 } 928 929 if (dev->addr_len) { 930 if (nla_put(skb, IFLA_ADDRESS, dev->addr_len, dev->dev_addr) || 931 nla_put(skb, IFLA_BROADCAST, dev->addr_len, dev->broadcast)) 932 goto nla_put_failure; 933 } 934 | 849static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, 850 int type, u32 pid, u32 seq, u32 change, 851 unsigned int flags, u32 ext_filter_mask) 852{ 853 struct ifinfomsg *ifm; 854 struct nlmsghdr *nlh; 855 struct rtnl_link_stats64 temp; 856 const struct rtnl_link_stats64 *stats; --- 51 unchanged lines hidden (view full) --- 908 } 909 910 if (dev->addr_len) { 911 if (nla_put(skb, IFLA_ADDRESS, dev->addr_len, dev->dev_addr) || 912 nla_put(skb, IFLA_BROADCAST, dev->addr_len, dev->broadcast)) 913 goto nla_put_failure; 914 } 915 |
935 if (rtnl_phys_port_id_fill(skb, dev)) 936 goto nla_put_failure; 937 | |
938 attr = nla_reserve(skb, IFLA_STATS, 939 sizeof(struct rtnl_link_stats)); 940 if (attr == NULL) 941 goto nla_put_failure; 942 943 stats = dev_get_stats(dev, &temp); 944 copy_rtnl_link_stats(nla_data(attr), stats); 945 --- 184 unchanged lines hidden (view full) --- 1130 [IFLA_VFINFO_LIST] = {. type = NLA_NESTED }, 1131 [IFLA_VF_PORTS] = { .type = NLA_NESTED }, 1132 [IFLA_PORT_SELF] = { .type = NLA_NESTED }, 1133 [IFLA_AF_SPEC] = { .type = NLA_NESTED }, 1134 [IFLA_EXT_MASK] = { .type = NLA_U32 }, 1135 [IFLA_PROMISCUITY] = { .type = NLA_U32 }, 1136 [IFLA_NUM_TX_QUEUES] = { .type = NLA_U32 }, 1137 [IFLA_NUM_RX_QUEUES] = { .type = NLA_U32 }, | 916 attr = nla_reserve(skb, IFLA_STATS, 917 sizeof(struct rtnl_link_stats)); 918 if (attr == NULL) 919 goto nla_put_failure; 920 921 stats = dev_get_stats(dev, &temp); 922 copy_rtnl_link_stats(nla_data(attr), stats); 923 --- 184 unchanged lines hidden (view full) --- 1108 [IFLA_VFINFO_LIST] = {. type = NLA_NESTED }, 1109 [IFLA_VF_PORTS] = { .type = NLA_NESTED }, 1110 [IFLA_PORT_SELF] = { .type = NLA_NESTED }, 1111 [IFLA_AF_SPEC] = { .type = NLA_NESTED }, 1112 [IFLA_EXT_MASK] = { .type = NLA_U32 }, 1113 [IFLA_PROMISCUITY] = { .type = NLA_U32 }, 1114 [IFLA_NUM_TX_QUEUES] = { .type = NLA_U32 }, 1115 [IFLA_NUM_RX_QUEUES] = { .type = NLA_U32 }, |
1138 [IFLA_PHYS_PORT_ID] = { .type = NLA_BINARY, .len = MAX_PHYS_PORT_ID_LEN }, | |
1139}; 1140EXPORT_SYMBOL(ifla_policy); 1141 1142static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { 1143 [IFLA_INFO_KIND] = { .type = NLA_STRING }, 1144 [IFLA_INFO_DATA] = { .type = NLA_NESTED }, 1145}; 1146 --- 1027 unchanged lines hidden (view full) --- 2174 struct net_device *dev, 2175 const unsigned char *addr) 2176{ 2177 int err = -EOPNOTSUPP; 2178 2179 /* If aging addresses are supported device will need to 2180 * implement its own handler for this. 2181 */ | 1116}; 1117EXPORT_SYMBOL(ifla_policy); 1118 1119static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { 1120 [IFLA_INFO_KIND] = { .type = NLA_STRING }, 1121 [IFLA_INFO_DATA] = { .type = NLA_NESTED }, 1122}; 1123 --- 1027 unchanged lines hidden (view full) --- 2151 struct net_device *dev, 2152 const unsigned char *addr) 2153{ 2154 int err = -EOPNOTSUPP; 2155 2156 /* If aging addresses are supported device will need to 2157 * implement its own handler for this. 2158 */ |
2182 if (ndm->ndm_state & NUD_PERMANENT) { | 2159 if (!(ndm->ndm_state & NUD_PERMANENT)) { |
2183 pr_info("%s: FDB only supports static addresses\n", dev->name); 2184 return -EINVAL; 2185 } 2186 2187 if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr)) 2188 err = dev_uc_del(dev, addr); 2189 else if (is_multicast_ether_addr(addr)) 2190 err = dev_mc_del(dev, addr); --- 593 unchanged lines hidden --- | 2160 pr_info("%s: FDB only supports static addresses\n", dev->name); 2161 return -EINVAL; 2162 } 2163 2164 if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr)) 2165 err = dev_uc_del(dev, addr); 2166 else if (is_multicast_ether_addr(addr)) 2167 err = dev_mc_del(dev, addr); --- 593 unchanged lines hidden --- |