mirror of
https://github.com/ipxe/ipxe
synced 2025-12-12 14:32:49 +03:00
[netdevice] Separate out the concept of hardware and link-layer addresses
The hardware address is an intrinsic property of the hardware, while the link-layer address can be changed at runtime. This separation is exposed via APIs such as PXE and EFI, but is currently elided by gPXE. Expose the hardware and link-layer addresses as separate properties within a net device. Drivers should now fill in hw_addr, which will be used to initialise ll_addr at the time of calling register_netdev().
This commit is contained in:
@@ -357,6 +357,10 @@ int register_netdev ( struct net_device *netdev ) {
|
||||
snprintf ( netdev->name, sizeof ( netdev->name ), "net%d",
|
||||
ifindex++ );
|
||||
|
||||
/* Set initial link-layer address */
|
||||
memcpy ( netdev->ll_addr, netdev->hw_addr,
|
||||
netdev->ll_protocol->ll_addr_len );
|
||||
|
||||
/* Register per-netdev configuration settings */
|
||||
if ( ( rc = register_settings ( netdev_settings ( netdev ),
|
||||
NULL ) ) != 0 ) {
|
||||
@@ -370,7 +374,7 @@ int register_netdev ( struct net_device *netdev ) {
|
||||
list_add_tail ( &netdev->list, &net_devices );
|
||||
DBGC ( netdev, "NETDEV %p registered as %s (phys %s hwaddr %s)\n",
|
||||
netdev, netdev->name, netdev->dev->name,
|
||||
netdev_hwaddr ( netdev ) );
|
||||
netdev_addr ( netdev ) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user