From bfd0ee2418b1ceb1f38821a08537f378b3b73add Mon Sep 17 00:00:00 2001 From: Damiano Renfer Date: Sun, 21 May 2017 19:55:18 +0200 Subject: [PATCH] net/dnscrypt-proxy: ignore parameters requiring plugins support if not available Signed-off-by: Damiano Renfer --- net/dnscrypt-proxy/Makefile | 2 +- net/dnscrypt-proxy/files/dnscrypt-proxy.init | 24 +++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/net/dnscrypt-proxy/Makefile b/net/dnscrypt-proxy/Makefile index 4c36b1145..0e14223cb 100644 --- a/net/dnscrypt-proxy/Makefile +++ b/net/dnscrypt-proxy/Makefile @@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnscrypt-proxy PKG_VERSION:=1.9.5 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://download.dnscrypt.org/dnscrypt-proxy \ diff --git a/net/dnscrypt-proxy/files/dnscrypt-proxy.init b/net/dnscrypt-proxy/files/dnscrypt-proxy.init index 35083d0c2..6dca527da 100644 --- a/net/dnscrypt-proxy/files/dnscrypt-proxy.init +++ b/net/dnscrypt-proxy/files/dnscrypt-proxy.init @@ -18,6 +18,7 @@ dnscrypt_instance() { create_config_file() { local address port resolver resolvers_list ephemeral_keys client_key syslog syslog_prefix local_cache query_log_file block_ipv6 provider_name provider_key resolver_address local config_path="$2" + local plugins_support_enabled=$(dnscrypt-proxy --version | grep 'Support for plugins: present' | wc -l) [ ! -d "$CONFIG_DIR" ] && mkdir -p "$CONFIG_DIR" [ -f "$config_path" ] && rm "$config_path" @@ -36,7 +37,7 @@ create_config_file() { config_get_bool ephemeral_keys $1 'ephemeral_keys' '0' config_get_bool local_cache $1 'local_cache' '0' config_get_bool block_ipv6 $1 'block_ipv6' '0' - + append_param_not_empty "ResolverName" "$resolver" $config_path append_param "ResolversList" "$resolvers_list" $config_path append_param_not_empty "ProviderName" "$provider_name" $config_path @@ -50,11 +51,28 @@ create_config_file() { append_param "SyslogPrefix" "$syslog_prefix" $config_path append_on_off "LocalCache" $local_cache $config_path append_param_not_empty "QueryLogFile" "$query_log_file" $config_path - append_yes_no "BlockIPv6" $block_ipv6 $config_path + if [ $plugins_support_enabled -ne 0 ] + then + append_yes_no "block_ipv6" $block_ipv6 $config_path + else + log_ignored_param "BlockIPv6" + fi + + if [ $plugins_support_enabled -ne 0 ] + then + config_list_foreach $1 'blacklist' append_blacklists $config_path + else + log_ignored_param "blacklist" + fi - config_list_foreach $1 'blacklist' append_blacklists $config_path } +log_ignored_param() { + local param_name=$1 + logger -t dnscrypt-proxy -p user.warn dnscrypt-proxy plugins support not present, ignoring $param_name parameter... +} + + append_on_off() { local param_name=$1 local param_value=$2