From 14290e0b9a4d10940b99b760770ffd83772dd325 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Thu, 22 Dec 2022 03:41:43 +0100 Subject: [PATCH] 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(-) diff --git a/src/netconfig.c b/src/netconfig.c index b7a52971..52307025 100644 --- a/src/netconfig.c +++ b/src/netconfig.c @@ -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; }