]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[igbvf] Assign random MAC address if none is set
authorHannes Reinecke <hare@suse.de>
Tue, 3 Jun 2014 12:01:16 +0000 (14:01 +0200)
committerMichael Brown <mcb30@ipxe.org>
Thu, 12 Jun 2014 16:38:08 +0000 (17:38 +0100)
If the VF doesn't have a MAC address assigned we should create a
random MAC address.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/igbvf/igbvf_main.c

index cd189ecb0d69c907552986095b630bfcb0eb503f..901bba95ed10d9638de37152a431ce9384b0365b 100644 (file)
@@ -871,20 +871,14 @@ int igbvf_probe ( struct pci_device *pdev )
                        DBG ("Error reading MAC address\n");
                        goto err_hw_init;
                }
+               if ( ! is_valid_ether_addr(adapter->hw.mac.addr) ) {
+                       /* Assign random MAC address */
+                       eth_random_addr(adapter->hw.mac.addr);
+               }
        }
 
        memcpy ( netdev->hw_addr, adapter->hw.mac.addr, ETH_ALEN );
 
-       if ( ! is_valid_ether_addr( netdev->hw_addr ) ) {
-               DBG ("Invalid MAC Address: "
-                       "%02x:%02x:%02x:%02x:%02x:%02x\n",
-                       netdev->hw_addr[0], netdev->hw_addr[1],
-                       netdev->hw_addr[2], netdev->hw_addr[3],
-                       netdev->hw_addr[4], netdev->hw_addr[5]);
-               err = -EIO;
-               goto err_hw_init;
-       }
-
        /* reset the hardware with the new settings */
        igbvf_reset ( adapter );