[ipxe-devel] [PATCH 03/10] ethernet: do not construct EUI-64 identifier for empty MAC
Hannes Reinecke
hare at suse.de
Thu Apr 30 13:18:43 UTC 2015
If the MAC address is empty we should not construct an EUI-64
identifier, but rather return an error.
Signed-off-by: Hannes Reinecke <hare at suse.de>
---
src/net/ethernet.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/net/ethernet.c b/src/net/ethernet.c
index 33e0572..cb4febe 100644
--- a/src/net/ethernet.c
+++ b/src/net/ethernet.c
@@ -46,6 +46,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** Ethernet broadcast MAC address */
uint8_t eth_broadcast[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+/** Empty Ethernet MAC address */
+uint8_t eth_empty[ETH_ALEN];
+
/**
* Add Ethernet link-layer header
*
@@ -198,7 +201,8 @@ int eth_eth_addr ( const void *ll_addr, void *eth_addr ) {
* @ret rc Return status code
*/
int eth_eui64 ( const void *ll_addr, void *eui64 ) {
-
+ if (!memcmp(ll_addr, eth_empty, ETH_ALEN))
+ return -ENXIO;
memcpy ( ( eui64 + 0 ), ( ll_addr + 0 ), 3 );
memcpy ( ( eui64 + 5 ), ( ll_addr + 3 ), 3 );
*( ( uint16_t * ) ( eui64 + 3 ) ) = htons ( 0xfffe );
--
1.8.4.5
More information about the ipxe-devel
mailing list