Skip to content

Commit

Permalink
Merge 'tun' config value if set in source configuration
Browse files Browse the repository at this point in the history
This commit modifies the `merge_config` function to include the 'tun' value from the source configuration if it is set. Previously, this value was not being merged, leading to inconsistencies in the final configuration.

The change checks if 'tun' in the source configuration is different from its default value before merging it into the destination configuration.

This ensures that the 'tun' setting is correctly propagated when configurations are merged, allowing for more flexible and accurate VPN setups.
  • Loading branch information
DblD authored and DimitriPapadopoulos committed Sep 25, 2023
1 parent 62a1913 commit 8b0dc6b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ void merge_config(struct vpn_config *dst, struct vpn_config *src)
free(dst->pinentry);
dst->pinentry = src->pinentry;
}
if (src->tun != invalid_cfg.tun) {
dst->tun = src->tun;
}
if (src->realm[0])
strcpy(dst->realm, src->realm);
if (src->iface_name[0])
Expand Down

2 comments on commit 8b0dc6b

@DblD
Copy link
Author

@DblD DblD commented on 8b0dc6b Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mea culpa mea ultima culpa
appologies @DimitriPapadopoulos

I have managed to cock that build up by ommiting to pay attention to coding style.

Subject: [PATCH] !FIX coding style warning
---
Index: src/config.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/config.c b/src/config.c
--- a/src/config.c	(revision a39c8d112f005ecf0178d1f075069a8c809c8d34)
+++ b/src/config.c	(revision c24c16f3e092f767029df54ded52d526768e13f1)
@@ -524,9 +524,8 @@
 		free(dst->pinentry);
 		dst->pinentry = src->pinentry;
 	}
-	if (src->tun != invalid_cfg.tun) {
+	if (src->tun != invalid_cfg.tun)
 		dst->tun = src->tun;
-	}
 	if (src->realm[0])
 		strcpy(dst->realm, src->realm);
 	if (src->iface_name[0])

@DimitriPapadopoulos
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the linter really complain? Don't worry, I'll fix it. Note that I have force-pushed the fix.

Please sign in to comment.