summaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/8021q/vlan.c')
-rw-r--r--net/8021q/vlan.c11
1 files changed, 8 insertions, 3 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