diff options
author | Michael Brown <mcb30@ipxe.org> | 2023-07-05 15:24:32 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2023-07-05 15:24:32 +0100 |
commit | f3036fc213b6e6cce0bf5572167b93b9e9959a3a (patch) | |
tree | c88cac6a3bbd77e2c38787bb61000052fa4f9869 | |
parent | 59d065c9ac6e5476a21fb9b277f719fd4ae5b372 (diff) | |
download | ipxe-f3036fc213b6e6cce0bf5572167b93b9e9959a3a.zip ipxe-f3036fc213b6e6cce0bf5572167b93b9e9959a3a.tar.gz ipxe-f3036fc213b6e6cce0bf5572167b93b9e9959a3a.tar.bz2 |
[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>
-rw-r--r-- | src/drivers/linux/tap.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/drivers/linux/tap.c b/src/drivers/linux/tap.c index 9b52c20..c1364dd 100644 --- a/src/drivers/linux/tap.c +++ b/src/drivers/linux/tap.c @@ -56,6 +56,10 @@ struct tap_nic { int fd; }; +/** Default MAC address */ +static const uint8_t tap_default_mac[ETH_ALEN] = + { 0x52, 0x54, 0x00, 0x12, 0x34, 0x56 }; + /** Open the TAP device */ 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; linux_set_drvdata(device, netdev); netdev->dev = &device->dev; + memcpy ( netdev->hw_addr, tap_default_mac, ETH_ALEN ); memset(nic, 0, sizeof(*nic)); /* Look for the mandatory if setting */ |