mirror of
https://github.com/ipxe/ipxe
synced 2025-12-19 02:50:25 +03:00
[netdevice] Add method for generating EUI-64 address from link-layer address
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -599,6 +599,7 @@ static struct ll_protocol net80211_ll_protocol __ll_protocol = {
|
||||
.ntoa = eth_ntoa,
|
||||
.mc_hash = eth_mc_hash,
|
||||
.eth_addr = eth_eth_addr,
|
||||
.eui64 = eth_eui64,
|
||||
.ll_proto = htons ( ARPHRD_ETHER ), /* "encapsulated Ethernet" */
|
||||
.hw_addr_len = ETH_ALEN,
|
||||
.ll_addr_len = ETH_ALEN,
|
||||
|
||||
@@ -165,6 +165,21 @@ int eth_eth_addr ( const void *ll_addr, void *eth_addr ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate EUI-64 address
|
||||
*
|
||||
* @v ll_addr Link-layer address
|
||||
* @v eui64 EUI-64 address to fill in
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int eth_eui64 ( const void *ll_addr, void *eui64 ) {
|
||||
|
||||
memcpy ( ( eui64 + 0 ), ( ll_addr + 0 ), 3 );
|
||||
memcpy ( ( eui64 + 5 ), ( ll_addr + 3 ), 3 );
|
||||
*( ( uint16_t * ) ( eui64 + 3 ) ) = htons ( 0xfffe );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Ethernet protocol */
|
||||
struct ll_protocol ethernet_protocol __ll_protocol = {
|
||||
.name = "Ethernet",
|
||||
@@ -178,6 +193,7 @@ struct ll_protocol ethernet_protocol __ll_protocol = {
|
||||
.ntoa = eth_ntoa,
|
||||
.mc_hash = eth_mc_hash,
|
||||
.eth_addr = eth_eth_addr,
|
||||
.eui64 = eth_eui64,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user