aboutsummaryrefslogtreecommitdiff
path: root/net/tinc/files
diff options
context:
space:
mode:
authorErwan MAS <erwan@mas.nom.fr>2021-05-17 20:16:34 -0400
committerErwan MAS <erwan@mas.nom.fr>2021-05-17 20:16:34 -0400
commitbf292a2cd9c6d5008a11169d4c223aec8191ad1b (patch)
tree06b7e97afd53fa407307d668ee43be7707277e71 /net/tinc/files
parent0250239caf322ba7dc80d13b3629372b0786ba48 (diff)
tinc: Add possibility to populate more config variables via uci
Signed-off-by: Erwan MAS <erwan@mas.nom.fr>
Diffstat (limited to 'net/tinc/files')
-rw-r--r--net/tinc/files/tinc.init31
1 files changed, 23 insertions, 8 deletions
diff --git a/net/tinc/files/tinc.init b/net/tinc/files/tinc.init
index 640071f11..af2c3bcac 100644
--- a/net/tinc/files/tinc.init
+++ b/net/tinc/files/tinc.init
@@ -88,26 +88,41 @@ prepare_host() {
[ "$2" != "$n" ] && return 1
fi
+ HOST_CONF_FILE="$TMP_TINC/$n/hosts/$s"
+ MANDATORY_PARAM_IN_UCI=0
+ [ ! -f "/etc/tinc/$n/hosts/$s" ] && {
+ config_get pk "$s" "PublicKey"
+ config_get na "$s" "Name"
+ if [ -n "$pk" -a -n "$na" ] ; then
+ HOST_CONF_FILE="$TMP_TINC/$n/hosts/$na"
+ MANDATORY_PARAM_IN_UCI=1
+ fi
+ }
+
# host disabled?
section_enabled "$s" || {
- [ -f "$TMP_TINC/$n/hosts/$s" ] && rm "$TMP_TINC/$n/hosts/$s"
+ [ -f "$HOST_CONF_FILE" ] && rm "$HOST_CONF_FILE"
return 1
}
[ ! -f "/etc/tinc/$n/hosts/$s" ] && {
- echo -n "tinc: Warning, public key for $s for network $n "
- echo -n "missing in /etc/tinc/$n/hosts/$s, "
- echo "skipping configuration of $s"
- return 1
+ if [ "$MANDATORY_PARAM_IN_UCI" -eq 1 ] ; then
+ touch "$HOST_CONF_FILE" ;
+ else
+ echo -n "tinc: Warning, public key for $s for network $n "
+ echo -n "missing in /etc/tinc/$n/hosts/$s, "
+ echo "skipping configuration of $s"
+ return 1
+ fi
}
# append flags
- append_conf_bools "$s" "$TMP_TINC/$n/hosts/$s" \
+ append_conf_bools "$s" "$HOST_CONF_FILE" \
ClampMSS IndirectData PMTUDiscovery TCPOnly
# append params
- append_conf_params "$s" "$TMP_TINC/$n/hosts/$s" \
- Address Cipher Compression Digest MACLength PMTU \
+ append_conf_params "$s" "$HOST_CONF_FILE" \
+ Address Cipher Compression Digest Ed25519PublicKey MACLength Name PMTU \
Port PublicKey PublicKeyFile Subnet
}