]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[vlan] Allow duplicate VLAN creation attempts
authorMichael Brown <mcb30@ipxe.org>
Thu, 25 Nov 2010 23:45:30 +0000 (23:45 +0000)
committerMichael Brown <mcb30@ipxe.org>
Fri, 26 Nov 2010 01:09:35 +0000 (01:09 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/vlan.c

index a764f3051e3f76528e3c9e31301f76536a174eab..5ecc7e1ca1b50d353369758391998e6acb6484f3 100644 (file)
@@ -301,6 +301,17 @@ int vlan_create ( struct net_device *trunk, unsigned int tag,
        struct vlan_device *vlan;
        int rc;
 
+       /* If VLAN already exists, just update the priority */
+       if ( ( netdev = vlan_find ( trunk, tag ) ) != NULL ) {
+               vlan = netdev->priv;
+               if ( priority != vlan->priority ) {
+                       DBGC ( netdev, "VLAN %s priority changed from %d to "
+                              "%d\n", netdev->name, vlan->priority, priority );
+               }
+               vlan->priority = priority;
+               return 0;
+       }
+
        /* Sanity checks */
        if ( trunk->ll_protocol->ll_addr_len != ETH_ALEN ) {
                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,
                rc = -EINVAL;
                goto err_sanity;
        }
-       if ( ( netdev = vlan_find ( trunk, tag ) ) != NULL ) {
-               DBGC ( netdev, "VLAN %s already exists\n", netdev->name );
-               rc = -EEXIST;
-               goto err_sanity;
-       }
 
        /* Allocate and initialise structure */
        netdev = alloc_etherdev ( sizeof ( *vlan ) );