mirror of
https://github.com/ipxe/ipxe
synced 2025-12-16 17:41:18 +03:00
[linux] Give tap devices a name and bus type
Give tap devices a meaningful name, and avoid segmentation faults when
attempting to retrieve ${net0/bustype} by assigning a new bus type for
tap devices.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -120,6 +120,7 @@ static int netdev_fetch_bustype ( struct net_device *netdev, void *data,
|
||||
[BUS_TYPE_EISA] = "EISA",
|
||||
[BUS_TYPE_MCA] = "MCA",
|
||||
[BUS_TYPE_ISA] = "ISA",
|
||||
[BUS_TYPE_TAP] = "TAP",
|
||||
};
|
||||
struct device_description *desc = &netdev->dev->desc;
|
||||
const char *bustype;
|
||||
@@ -127,7 +128,7 @@ static int netdev_fetch_bustype ( struct net_device *netdev, void *data,
|
||||
assert ( desc->bus_type < ( sizeof ( bustypes ) /
|
||||
sizeof ( bustypes[0] ) ) );
|
||||
bustype = bustypes[desc->bus_type];
|
||||
assert ( bustypes != NULL );
|
||||
assert ( bustype != NULL );
|
||||
strncpy ( data, bustype, len );
|
||||
return strlen ( bustype );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user