Browse Source

[vlan] Allow duplicate VLAN creation attempts

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
7e1b1d6145
1 changed files with 11 additions and 5 deletions
  1. 11
    5
      src/net/vlan.c

+ 11
- 5
src/net/vlan.c View File

@@ -301,6 +301,17 @@ int vlan_create ( struct net_device *trunk, unsigned int tag,
301 301
 	struct vlan_device *vlan;
302 302
 	int rc;
303 303
 
304
+	/* If VLAN already exists, just update the priority */
305
+	if ( ( netdev = vlan_find ( trunk, tag ) ) != NULL ) {
306
+		vlan = netdev->priv;
307
+		if ( priority != vlan->priority ) {
308
+			DBGC ( netdev, "VLAN %s priority changed from %d to "
309
+			       "%d\n", netdev->name, vlan->priority, priority );
310
+		}
311
+		vlan->priority = priority;
312
+		return 0;
313
+	}
314
+
304 315
 	/* Sanity checks */
305 316
 	if ( trunk->ll_protocol->ll_addr_len != ETH_ALEN ) {
306 317
 		DBGC ( trunk, "VLAN %s cannot create VLAN for %s device\n",
@@ -320,11 +331,6 @@ int vlan_create ( struct net_device *trunk, unsigned int tag,
320 331
 		rc = -EINVAL;
321 332
 		goto err_sanity;
322 333
 	}
323
-	if ( ( netdev = vlan_find ( trunk, tag ) ) != NULL ) {
324
-		DBGC ( netdev, "VLAN %s already exists\n", netdev->name );
325
-		rc = -EEXIST;
326
-		goto err_sanity;
327
-	}
328 334
 
329 335
 	/* Allocate and initialise structure */
330 336
 	netdev = alloc_etherdev ( sizeof ( *vlan ) );

Loading…
Cancel
Save