Browse Source

[vlan] Allow duplicate VLAN creation attempts

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 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
 	struct vlan_device *vlan;
301
 	struct vlan_device *vlan;
302
 	int rc;
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
 	/* Sanity checks */
315
 	/* Sanity checks */
305
 	if ( trunk->ll_protocol->ll_addr_len != ETH_ALEN ) {
316
 	if ( trunk->ll_protocol->ll_addr_len != ETH_ALEN ) {
306
 		DBGC ( trunk, "VLAN %s cannot create VLAN for %s device\n",
317
 		DBGC ( trunk, "VLAN %s cannot create VLAN for %s device\n",
320
 		rc = -EINVAL;
331
 		rc = -EINVAL;
321
 		goto err_sanity;
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
 	/* Allocate and initialise structure */
335
 	/* Allocate and initialise structure */
330
 	netdev = alloc_etherdev ( sizeof ( *vlan ) );
336
 	netdev = alloc_etherdev ( sizeof ( *vlan ) );

Loading…
Cancel
Save