aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/ipxe/netdevice.h2
-rw-r--r--src/net/netdevice.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/src/include/ipxe/netdevice.h b/src/include/ipxe/netdevice.h
index d0e628a..7288ad8 100644
--- a/src/include/ipxe/netdevice.h
+++ b/src/include/ipxe/netdevice.h
@@ -300,6 +300,8 @@ struct net_device {
struct list_head list;
/** List of open network devices */
struct list_head open_list;
+ /** Index of this network device */
+ unsigned int index;
/** Name of this network device */
char name[12];
/** Underlying hardware device */
diff --git a/src/net/netdevice.c b/src/net/netdevice.c
index 5af9c6d..283632f 100644
--- a/src/net/netdevice.c
+++ b/src/net/netdevice.c
@@ -498,10 +498,11 @@ int register_netdev ( struct net_device *netdev ) {
uint32_t seed;
int rc;
- /* Create device name */
+ /* Record device index and create device name */
+ netdev->index = ifindex++;
if ( netdev->name[0] == '\0' ) {
snprintf ( netdev->name, sizeof ( netdev->name ), "net%d",
- ifindex++ );
+ netdev->index );
}
/* Set initial link-layer address, if not already set */