diff mbox series

netconfig: Don't load settings in netconfig_new

Message ID 20221222024143.632455-1-andrew.zaborowski@intel.com (mailing list archive)
State New
Headers show
Series netconfig: Don't load settings in netconfig_new | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-alpine-ci-fetch success Fetch PR
prestwoj/iwd-ci-gitlint success GitLint
prestwoj/iwd-ci-fetch success Fetch PR
prestwoj/iwd-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-ci-build success Build - Configure
prestwoj/iwd-alpine-ci-makedistcheck success Make Distcheck
prestwoj/iwd-alpine-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-alpine-ci-build success Build - Configure
prestwoj/iwd-ci-clang success clang PASS
prestwoj/iwd-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-ci-makecheck success Make Check
prestwoj/iwd-alpine-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-alpine-ci-makecheck success Make Check
prestwoj/iwd-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-testrunner success test-runner PASS

Commit Message

Andrew Zaborowski Dec. 22, 2022, 2:41 a.m. UTC
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(-)

Comments

Denis Kenzior Dec. 27, 2022, 4:48 p.m. UTC | #1
Hi Andrew,

On 12/21/22 20:41, Andrew Zaborowski wrote:
> 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(-)
> 

Applied, thanks.

Regards,
-Denis
diff mbox series

Patch

diff --git a/src/netconfig.c b/src/netconfig.c
index 6e82add3..d81f8b4c 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;
 }