From a8b1139dcbb77ef85a2b2b1bf25428df6cd1da84 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Mon, 29 Aug 2022 19:35:56 +0200 Subject: [PATCH] netconfig: Store pointer to netdev instead of ifindex To avoid repeated lookups by ifindex, replace the ifindex member in struct netconfig with a struct netdev pointer. A struct netconfig always lives shorter than the struct netdev. --- src/netconfig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/netconfig.c b/src/netconfig.c index 13960c53..74eaca16 100644 --- a/src/netconfig.c +++ b/src/netconfig.c @@ -54,7 +54,7 @@ struct netconfig { struct l_netconfig *nc; - uint32_t ifindex; + struct netdev *netdev; char *mdns; struct ie_fils_ip_addr_response_info *fils_override; @@ -581,7 +581,7 @@ struct netconfig *netconfig_new(uint32_t ifindex) netconfig = l_new(struct netconfig, 1); netconfig->nc = l_netconfig_new(ifindex); - netconfig->ifindex = ifindex; + netconfig->netdev = netdev; netconfig->resolve = resolve_new(ifindex); debug_level = getenv("IWD_DHCP_DEBUG");