mirror of https://github.com/ipxe/ipxe.git
[linux] Set a default MAC address for tap devices
Avoid the need to always specify a local MAC address on the command line by setting a default hardware MAC address (using the same default address as for slirp devices). Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/990/head
parent
59d065c9ac
commit
f3036fc213
|
@ -56,6 +56,10 @@ struct tap_nic {
|
||||||
int fd;
|
int fd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Default MAC address */
|
||||||
|
static const uint8_t tap_default_mac[ETH_ALEN] =
|
||||||
|
{ 0x52, 0x54, 0x00, 0x12, 0x34, 0x56 };
|
||||||
|
|
||||||
/** Open the TAP device */
|
/** Open the TAP device */
|
||||||
static int tap_open(struct net_device * netdev)
|
static int tap_open(struct net_device * netdev)
|
||||||
{
|
{
|
||||||
|
@ -202,6 +206,7 @@ static int tap_probe(struct linux_device *device, struct linux_device_request *r
|
||||||
nic = netdev->priv;
|
nic = netdev->priv;
|
||||||
linux_set_drvdata(device, netdev);
|
linux_set_drvdata(device, netdev);
|
||||||
netdev->dev = &device->dev;
|
netdev->dev = &device->dev;
|
||||||
|
memcpy ( netdev->hw_addr, tap_default_mac, ETH_ALEN );
|
||||||
memset(nic, 0, sizeof(*nic));
|
memset(nic, 0, sizeof(*nic));
|
||||||
|
|
||||||
/* Look for the mandatory if setting */
|
/* Look for the mandatory if setting */
|
||||||
|
|
Loading…
Reference in New Issue