mirror of
https://github.com/ipxe/ipxe
synced 2025-12-29 11:03:15 +03:00
[netdevice] Allow the hardware and link-layer addresses to differ in size
IPoIB has a 20-byte link-layer address, of which only eight bytes represent anything relating to a "hardware address". The PXE and EFI SNP APIs expect the permanent address to be the same size as the link-layer address, so fill in the "permanent address" field with the initial link layer address (as generated by register_netdev() based upon the real hardware address).
This commit is contained in:
@@ -96,6 +96,16 @@ static int eth_pull ( struct net_device *netdev __unused,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise Ethernet address
|
||||
*
|
||||
* @v hw_addr Hardware address
|
||||
* @v ll_addr Link-layer address
|
||||
*/
|
||||
void eth_init_addr ( const void *hw_addr, void *ll_addr ) {
|
||||
memcpy ( ll_addr, hw_addr, ETH_ALEN );
|
||||
}
|
||||
|
||||
/**
|
||||
* Transcribe Ethernet address
|
||||
*
|
||||
@@ -143,10 +153,12 @@ static int eth_mc_hash ( unsigned int af, const void *net_addr,
|
||||
struct ll_protocol ethernet_protocol __ll_protocol = {
|
||||
.name = "Ethernet",
|
||||
.ll_proto = htons ( ARPHRD_ETHER ),
|
||||
.hw_addr_len = ETH_ALEN,
|
||||
.ll_addr_len = ETH_ALEN,
|
||||
.ll_header_len = ETH_HLEN,
|
||||
.push = eth_push,
|
||||
.pull = eth_pull,
|
||||
.init_addr = eth_init_addr,
|
||||
.ntoa = eth_ntoa,
|
||||
.mc_hash = eth_mc_hash,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user