Skip to contentSkip to conversation

netconfig: Don't load settings in netconfig_new

PATCH Applied Andrew Zaborowski 2 participants 2 messages Dec 22, 2022 – Dec 27, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netconfig: Don't load settings in netconfig_new

Move the l_netconfig_set_route_priority() and l_netconfig_set_optimistic_dad_enabled() calls from netconfig_new, which is called once for the l_netconfig object's lifetime, to netconfig_load_settings, which is called before every connection attempt. This is needed because we clean up the l_netconfig configuration by calling l_netconfig_reset_config() at different points in connection setup and teardown so we'd reset the route priority that we've set in netconfig_new, back to 0 and never reload it.

---
 src/netconfig.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
src/netconfig.c +5 -5
index 6e82add3..d81f8b4c 100644
@@ -413,7 +413,7 @@ mdns:
 		}
 
 		if (!success)
-			goto check_config;
+			goto route_priority;
 	}
 
 	if (!mdns && mdns_global) {
@@ -426,7 +426,10 @@ mdns:
 		}
 	}
 
-check_config:
+route_priority:
+	l_netconfig_set_route_priority(netconfig->nc, ROUTE_PRIORITY_OFFSET);
+	l_netconfig_set_optimistic_dad_enabled(netconfig->nc, true);
+
 	if (!l_netconfig_check_config(netconfig->nc)) {
 		l_error("netconfig: Invalid configuration");
 		success = false;
@@ -734,9 +737,6 @@ struct netconfig *netconfig_new(uint32_t ifindex)
 		l_icmp6_client_set_debug(icmp6, do_debug, "[ICMPv6] ", NULL);
 	}
 
-	l_netconfig_set_route_priority(netconfig->nc, ROUTE_PRIORITY_OFFSET);
-	l_netconfig_set_optimistic_dad_enabled(netconfig->nc, true);
-
 	return netconfig;
 }
 
Signature · 1 line
2.34.1
#1 lore raw

Hi Andrew,

Quoted 8 lines · Andrew Zaborowski

Move the l_netconfig_set_route_priority() and l_netconfig_set_optimistic_dad_enabled() calls from netconfig_new, which is called once for the l_netconfig object's lifetime, to netconfig_load_settings, which is called before every connection attempt. This is needed because we clean up the l_netconfig configuration by calling l_netconfig_reset_config() at different points in connection setup and teardown so we'd reset the route priority that we've set in netconfig_new, back to 0 and never reload it.

Quoted 4 lines
---
  src/netconfig.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)

Applied, thanks.

Regards,
-Denis