diff mbox series

[6/6] netconfig: Handle missing optimistic_dad /proc file

Message ID 20220920133201.3303119-6-andrew.zaborowski@intel.com (mailing list archive)
State Accepted, archived
Headers show
Series [1/6] net: Allow padding in net_domain_list_parse | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success

Commit Message

Andrew Zaborowski Sept. 20, 2022, 1:32 p.m. UTC
Handle netconfig_proc_read_ipv6_uint_setting(..., "optimistic_dad")
failures more cleanly in case CONFIG_IPV6_OPTIMISTIC_DAD has not been
enabled in the kernel config.  This commit makes no noticeable
difference to the user.
---
 ell/netconfig.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/ell/netconfig.c b/ell/netconfig.c
index c558cad..fe5bf40 100644
--- a/ell/netconfig.c
+++ b/ell/netconfig.c
@@ -90,7 +90,7 @@  struct l_netconfig {
 	struct l_queue *icmp_route_data;
 	struct l_acd *acd;
 	unsigned int orig_disable_ipv6;
-	unsigned int orig_optimistic_dad;
+	long orig_optimistic_dad;
 	uint8_t mac[ETH_ALEN];
 	struct l_timeout *ra_timeout;
 	bool have_lla;
@@ -2010,7 +2010,8 @@  configure_ipv6:
 		netconfig_proc_read_ipv6_uint_setting(netconfig,
 							"optimistic_dad");
 
-	if (!!netconfig->orig_optimistic_dad != optimistic_dad)
+	if (netconfig->orig_optimistic_dad >= 0 &&
+			!!netconfig->orig_optimistic_dad != optimistic_dad)
 		netconfig_proc_write_ipv6_uint_setting(netconfig,
 							"optimistic_dad",
 							optimistic_dad ? 1 : 0);
@@ -2160,7 +2161,8 @@  LIB_EXPORT void l_netconfig_stop(struct l_netconfig *netconfig)
 
 	optimistic_dad = netconfig->optimistic_dad_enabled &&
 		!netconfig->v6_static_addr;
-	if (!!netconfig->orig_optimistic_dad != optimistic_dad)
+	if (netconfig->orig_optimistic_dad >= 0 &&
+			!!netconfig->orig_optimistic_dad != optimistic_dad)
 		netconfig_proc_write_ipv6_uint_setting(netconfig,
 						"optimistic_dad",
 						netconfig->orig_optimistic_dad);