diff options
author | Michael Brown <mcb30@etherboot.org> | 2009-08-11 23:40:27 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2009-08-12 00:23:38 +0100 |
commit | 4eab5bc8ca6b66dc965cf188dd4577ad19c5b879 (patch) | |
tree | 840f354a2f0efa010368118729e8f16315abc1c4 /src/net | |
parent | 37a0aab4ff2c86f4d109d4cd479535be97d07a94 (diff) | |
download | ipxe-4eab5bc8ca6b66dc965cf188dd4577ad19c5b879.tar.gz |
[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).
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/80211/net80211.c | 2 | ||||
-rw-r--r-- | src/net/ethernet.c | 12 | ||||
-rw-r--r-- | src/net/netdevice.c | 3 |
3 files changed, 15 insertions, 2 deletions
diff --git a/src/net/80211/net80211.c b/src/net/80211/net80211.c index f36128531..a07e2fab1 100644 --- a/src/net/80211/net80211.c +++ b/src/net/80211/net80211.c @@ -602,9 +602,11 @@ static struct ll_protocol net80211_ll_protocol __ll_protocol = { .name = "802.11", .push = net80211_ll_push, .pull = net80211_ll_pull, + .init_addr = eth_init_addr, .ntoa = eth_ntoa, .mc_hash = net80211_ll_mc_hash, .ll_proto = htons ( ARPHRD_ETHER ), /* "encapsulated Ethernet" */ + .hw_addr_len = ETH_ALEN, .ll_addr_len = ETH_ALEN, .ll_header_len = IEEE80211_TYP_FRAME_HEADER_LEN + IEEE80211_LLC_HEADER_LEN, diff --git a/src/net/ethernet.c b/src/net/ethernet.c index 5e2793f94..dfeba7cd7 100644 --- a/src/net/ethernet.c +++ b/src/net/ethernet.c @@ -97,6 +97,16 @@ static int eth_pull ( struct net_device *netdev __unused, } /** + * 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 * * @v ll_addr Link-layer 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, }; diff --git a/src/net/netdevice.c b/src/net/netdevice.c index f43ca8a4d..ee0d0b72b 100644 --- a/src/net/netdevice.c +++ b/src/net/netdevice.c @@ -358,8 +358,7 @@ int register_netdev ( struct net_device *netdev ) { ifindex++ ); /* Set initial link-layer address */ - memcpy ( netdev->ll_addr, netdev->hw_addr, - netdev->ll_protocol->ll_addr_len ); + netdev->ll_protocol->init_addr ( netdev->hw_addr, netdev->ll_addr ); /* Register per-netdev configuration settings */ if ( ( rc = register_settings ( netdev_settings ( netdev ), |