summaryrefslogtreecommitdiffstats
path: root/net/8021q
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-06 21:39:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-06 21:39:49 -0400
commit1c8c5a9d38f607c0b6fd12c91cbe1a4418762a21 (patch)
treedcc97181d4d187252e0cc8fdf29d9b365fa3ffd0 /net/8021q
parent285767604576148fc1be7fcd112e4a90eb0d6ad2 (diff)
parent7170e6045a6a8b33f4fa5753589dc77b16198e2d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: 1) Add Maglev hashing scheduler to IPVS, from Inju Song. 2) Lots of new TC subsystem tests from Roman Mashak. 3) Add TCP zero copy receive and fix delayed acks and autotuning with SO_RCVLOWAT, from Eric Dumazet. 4) Add XDP_REDIRECT support to mlx5 driver, from Jesper Dangaard Brouer. 5) Add ttl inherit support to vxlan, from Hangbin Liu. 6) Properly separate ipv6 routes into their logically independant components. fib6_info for the routing table, and fib6_nh for sets of nexthops, which thus can be shared. From David Ahern. 7) Add bpf_xdp_adjust_tail helper, which can be used to generate ICMP messages from XDP programs. From Nikita V. Shirokov. 8) Lots of long overdue cleanups to the r8169 driver, from Heiner Kallweit. 9) Add BTF ("BPF Type Format"), from Martin KaFai Lau. 10) Add traffic condition monitoring to iwlwifi, from Luca Coelho. 11) Plumb extack down into fib_rules, from Roopa Prabhu. 12) Add Flower classifier offload support to igb, from Vinicius Costa Gomes. 13) Add UDP GSO support, from Willem de Bruijn. 14) Add documentation for eBPF helpers, from Quentin Monnet. 15) Add TLS tx offload to mlx5, from Ilya Lesokhin. 16) Allow applications to be given the number of bytes available to read on a socket via a control message returned from recvmsg(), from Soheil Hassas Yeganeh. 17) Add x86_32 eBPF JIT compiler, from Wang YanQing. 18) Add AF_XDP sockets, with zerocopy support infrastructure as well. From Björn Töpel. 19) Remove indirect load support from all of the BPF JITs and handle these operations in the verifier by translating them into native BPF instead. From Daniel Borkmann. 20) Add GRO support to ipv6 gre tunnels, from Eran Ben Elisha. 21) Allow XDP programs to do lookups in the main kernel routing tables for forwarding. From David Ahern. 22) Allow drivers to store hardware state into an ELF section of kernel dump vmcore files, and use it in cxgb4. From Rahul Lakkireddy. 23) Various RACK and loss detection improvements in TCP, from Yuchung Cheng. 24) Add TCP SACK compression, from Eric Dumazet. 25) Add User Mode Helper support and basic bpfilter infrastructure, from Alexei Starovoitov. 26) Support ports and protocol values in RTM_GETROUTE, from Roopa Prabhu. 27) Support bulking in ->ndo_xdp_xmit() API, from Jesper Dangaard Brouer. 28) Add lots of forwarding selftests, from Petr Machata. 29) Add generic network device failover driver, from Sridhar Samudrala. * ra.kernel.org:/pub/scm/linux/kernel/git/davem/net-next: (1959 commits) strparser: Add __strp_unpause and use it in ktls. rxrpc: Fix terminal retransmission connection ID to include the channel net: hns3: Optimize PF CMDQ interrupt switching process net: hns3: Fix for VF mailbox receiving unknown message net: hns3: Fix for VF mailbox cannot receiving PF response bnx2x: use the right constant Revert "net: sched: cls: Fix offloading when ingress dev is vxlan" net: dsa: b53: Fix for brcm tag issue in Cygnus SoC enic: fix UDP rss bits netdev-FAQ: clarify DaveM's position for stable backports rtnetlink: validate attributes in do_setlink() mlxsw: Add extack messages for port_{un, }split failures netdevsim: Add extack error message for devlink reload devlink: Add extack to reload and port_{un, }split operations net: metrics: add proper netlink validation ipmr: fix error path when ipmr_new_table fails ip6mr: only set ip6mr_table from setsockopt when ip6mr_new_table succeeds net: hns3: remove unused hclgevf_cfg_func_mta_filter netfilter: provide udp*_lib_lookup for nf_tproxy qed*: Utilize FW 8.37.2.0 ...
Diffstat (limited to 'net/8021q')
-rw-r--r--net/8021q/vlan.c11
-rw-r--r--net/8021q/vlan.h3
-rw-r--r--net/8021q/vlan_dev.c4
-rw-r--r--net/8021q/vlan_netlink.c45
4 files changed, 47 insertions, 16 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 5505ee6ebdbe..73a65789271b 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -118,17 +118,21 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head)
118} 118}
119 119
120int vlan_check_real_dev(struct net_device *real_dev, 120int vlan_check_real_dev(struct net_device *real_dev,
121 __be16 protocol, u16 vlan_id) 121 __be16 protocol, u16 vlan_id,
122 struct netlink_ext_ack *extack)
122{ 123{
123 const char *name = real_dev->name; 124 const char *name = real_dev->name;
124 125
125 if (real_dev->features & NETIF_F_VLAN_CHALLENGED) { 126 if (real_dev->features & NETIF_F_VLAN_CHALLENGED) {
126 pr_info("VLANs not supported on %s\n", name); 127 pr_info("VLANs not supported on %s\n", name);
128 NL_SET_ERR_MSG_MOD(extack, "VLANs not supported on device");
127 return -EOPNOTSUPP; 129 return -EOPNOTSUPP;
128 } 130 }
129 131
130 if (vlan_find_dev(real_dev, protocol, vlan_id) != NULL) 132 if (vlan_find_dev(real_dev, protocol, vlan_id) != NULL) {
133 NL_SET_ERR_MSG_MOD(extack, "VLAN device already exists");
131 return -EEXIST; 134 return -EEXIST;
135 }
132 136
133 return 0; 137 return 0;
134} 138}
@@ -215,7 +219,8 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
215 if (vlan_id >= VLAN_VID_MASK) 219 if (vlan_id >= VLAN_VID_MASK)
216 return -ERANGE; 220 return -ERANGE;
217 221
218 err = vlan_check_real_dev(real_dev, htons(ETH_P_8021Q), vlan_id); 222 err = vlan_check_real_dev(real_dev, htons(ETH_P_8021Q), vlan_id,
223 NULL);
219 if (err < 0) 224 if (err < 0)
220 return err; 225 return err;
221 226
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index e23aac3e4d37..44df1c3df02d 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -109,7 +109,8 @@ int vlan_dev_change_flags(const struct net_device *dev, u32 flag, u32 mask);
109void vlan_dev_get_realdev_name(const struct net_device *dev, char *result); 109void vlan_dev_get_realdev_name(const struct net_device *dev, char *result);
110 110
111int vlan_check_real_dev(struct net_device *real_dev, 111int vlan_check_real_dev(struct net_device *real_dev,
112 __be16 protocol, u16 vlan_id); 112 __be16 protocol, u16 vlan_id,
113 struct netlink_ext_ack *extack);
113void vlan_setup(struct net_device *dev); 114void vlan_setup(struct net_device *dev);
114int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack); 115int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack);
115void unregister_vlan_dev(struct net_device *dev, struct list_head *head); 116void unregister_vlan_dev(struct net_device *dev, struct list_head *head);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 236452ebbd9e..546af0e73ac3 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -215,7 +215,9 @@ int vlan_dev_set_egress_priority(const struct net_device *dev,
215 return 0; 215 return 0;
216} 216}
217 217
218/* Flags are defined in the vlan_flags enum in include/linux/if_vlan.h file. */ 218/* Flags are defined in the vlan_flags enum in
219 * include/uapi/linux/if_vlan.h file.
220 */
219int vlan_dev_change_flags(const struct net_device *dev, u32 flags, u32 mask) 221int vlan_dev_change_flags(const struct net_device *dev, u32 flags, u32 mask)
220{ 222{
221 struct vlan_dev_priv *vlan = vlan_dev_priv(dev); 223 struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index 6689c0b272a7..9b60c1e399e2 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -47,14 +47,20 @@ static int vlan_validate(struct nlattr *tb[], struct nlattr *data[],
47 int err; 47 int err;
48 48
49 if (tb[IFLA_ADDRESS]) { 49 if (tb[IFLA_ADDRESS]) {
50 if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN) 50 if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN) {
51 NL_SET_ERR_MSG_MOD(extack, "Invalid link address");
51 return -EINVAL; 52 return -EINVAL;
52 if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS]))) 53 }
54 if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS]))) {
55 NL_SET_ERR_MSG_MOD(extack, "Invalid link address");
53 return -EADDRNOTAVAIL; 56 return -EADDRNOTAVAIL;
57 }
54 } 58 }
55 59
56 if (!data) 60 if (!data) {
61 NL_SET_ERR_MSG_MOD(extack, "VLAN properties not specified");
57 return -EINVAL; 62 return -EINVAL;
63 }
58 64
59 if (data[IFLA_VLAN_PROTOCOL]) { 65 if (data[IFLA_VLAN_PROTOCOL]) {
60 switch (nla_get_be16(data[IFLA_VLAN_PROTOCOL])) { 66 switch (nla_get_be16(data[IFLA_VLAN_PROTOCOL])) {
@@ -62,29 +68,38 @@ static int vlan_validate(struct nlattr *tb[], struct nlattr *data[],
62 case htons(ETH_P_8021AD): 68 case htons(ETH_P_8021AD):
63 break; 69 break;
64 default: 70 default:
71 NL_SET_ERR_MSG_MOD(extack, "Invalid VLAN protocol");
65 return -EPROTONOSUPPORT; 72 return -EPROTONOSUPPORT;
66 } 73 }
67 } 74 }
68 75
69 if (data[IFLA_VLAN_ID]) { 76 if (data[IFLA_VLAN_ID]) {
70 id = nla_get_u16(data[IFLA_VLAN_ID]); 77 id = nla_get_u16(data[IFLA_VLAN_ID]);
71 if (id >= VLAN_VID_MASK) 78 if (id >= VLAN_VID_MASK) {
79 NL_SET_ERR_MSG_MOD(extack, "Invalid VLAN id");
72 return -ERANGE; 80 return -ERANGE;
81 }
73 } 82 }
74 if (data[IFLA_VLAN_FLAGS]) { 83 if (data[IFLA_VLAN_FLAGS]) {
75 flags = nla_data(data[IFLA_VLAN_FLAGS]); 84 flags = nla_data(data[IFLA_VLAN_FLAGS]);
76 if ((flags->flags & flags->mask) & 85 if ((flags->flags & flags->mask) &
77 ~(VLAN_FLAG_REORDER_HDR | VLAN_FLAG_GVRP | 86 ~(VLAN_FLAG_REORDER_HDR | VLAN_FLAG_GVRP |
78 VLAN_FLAG_LOOSE_BINDING | VLAN_FLAG_MVRP)) 87 VLAN_FLAG_LOOSE_BINDING | VLAN_FLAG_MVRP)) {
88 NL_SET_ERR_MSG_MOD(extack, "Invalid VLAN flags");
79 return -EINVAL; 89 return -EINVAL;
90 }
80 } 91 }
81 92
82 err = vlan_validate_qos_map(data[IFLA_VLAN_INGRESS_QOS]); 93 err = vlan_validate_qos_map(data[IFLA_VLAN_INGRESS_QOS]);
83 if (err < 0) 94 if (err < 0) {
95 NL_SET_ERR_MSG_MOD(extack, "Invalid ingress QOS map");
84 return err; 96 return err;
97 }
85 err = vlan_validate_qos_map(data[IFLA_VLAN_EGRESS_QOS]); 98 err = vlan_validate_qos_map(data[IFLA_VLAN_EGRESS_QOS]);
86 if (err < 0) 99 if (err < 0) {
100 NL_SET_ERR_MSG_MOD(extack, "Invalid egress QOS map");
87 return err; 101 return err;
102 }
88 return 0; 103 return 0;
89} 104}
90 105
@@ -126,14 +141,21 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev,
126 __be16 proto; 141 __be16 proto;
127 int err; 142 int err;
128 143
129 if (!data[IFLA_VLAN_ID]) 144 if (!data[IFLA_VLAN_ID]) {
145 NL_SET_ERR_MSG_MOD(extack, "VLAN id not specified");
130 return -EINVAL; 146 return -EINVAL;
147 }
131 148
132 if (!tb[IFLA_LINK]) 149 if (!tb[IFLA_LINK]) {
150 NL_SET_ERR_MSG_MOD(extack, "link not specified");
133 return -EINVAL; 151 return -EINVAL;
152 }
153
134 real_dev = __dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK])); 154 real_dev = __dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK]));
135 if (!real_dev) 155 if (!real_dev) {
156 NL_SET_ERR_MSG_MOD(extack, "link does not exist");
136 return -ENODEV; 157 return -ENODEV;
158 }
137 159
138 if (data[IFLA_VLAN_PROTOCOL]) 160 if (data[IFLA_VLAN_PROTOCOL])
139 proto = nla_get_be16(data[IFLA_VLAN_PROTOCOL]); 161 proto = nla_get_be16(data[IFLA_VLAN_PROTOCOL]);
@@ -146,7 +168,8 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev,
146 dev->priv_flags |= (real_dev->priv_flags & IFF_XMIT_DST_RELEASE); 168 dev->priv_flags |= (real_dev->priv_flags & IFF_XMIT_DST_RELEASE);
147 vlan->flags = VLAN_FLAG_REORDER_HDR; 169 vlan->flags = VLAN_FLAG_REORDER_HDR;
148 170
149 err = vlan_check_real_dev(real_dev, vlan->vlan_proto, vlan->vlan_id); 171 err = vlan_check_real_dev(real_dev, vlan->vlan_proto, vlan->vlan_id,
172 extack);
150 if (err < 0) 173 if (err < 0)
151 return err; 174 return err;
152 175