mirror of https://github.com/ipxe/ipxe.git
[netdevice] Reset MAC address when asked to clear the "mac" setting
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/13/head
parent
08bf79582a
commit
c4bce43c3c
|
@ -61,10 +61,18 @@ struct setting chip_setting __setting ( SETTING_NETDEV ) = {
|
|||
*/
|
||||
static int netdev_store_mac ( struct net_device *netdev,
|
||||
const void *data, size_t len ) {
|
||||
struct ll_protocol *ll_protocol = netdev->ll_protocol;
|
||||
|
||||
/* Record new MAC address */
|
||||
if ( data ) {
|
||||
if ( len != netdev->ll_protocol->ll_addr_len )
|
||||
return -EINVAL;
|
||||
memcpy ( netdev->ll_addr, data, len );
|
||||
} else {
|
||||
/* Reset MAC address if clearing setting */
|
||||
ll_protocol->init_addr ( netdev->hw_addr, netdev->ll_addr );
|
||||
}
|
||||
|
||||
if ( len != netdev->ll_protocol->ll_addr_len )
|
||||
return -EINVAL;
|
||||
memcpy ( netdev->ll_addr, data, len );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue