aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-05-10 16:47:51 +0200
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-07-11 12:52:01 +0200
commitb837216345d4f36beea9550821ee653b060864b1 (patch)
tree632c39c04a92268d9cc46a9c5f126ac16b081293 /package
parentd7d6e055e9d9d9554f59e919f37e0b6cd46b12a1 (diff)
downloadupstream-b837216345d4f36beea9550821ee653b060864b1.tar.gz
upstream-b837216345d4f36beea9550821ee653b060864b1.tar.bz2
upstream-b837216345d4f36beea9550821ee653b060864b1.zip
wireguard-tools: replace backticks by $(...)
This replaces deprecated backticks by more versatile $(...) syntax. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Diffstat (limited to 'package')
-rw-r--r--package/network/utils/wireguard-tools/files/wireguard_watchdog8
1 files changed, 4 insertions, 4 deletions
diff --git a/package/network/utils/wireguard-tools/files/wireguard_watchdog b/package/network/utils/wireguard-tools/files/wireguard_watchdog
index 5fbbeafec1..c0a5a0aa33 100644
--- a/package/network/utils/wireguard-tools/files/wireguard_watchdog
+++ b/package/network/utils/wireguard-tools/files/wireguard_watchdog
@@ -27,7 +27,7 @@ check_peer_activity() {
config_get public_key "${cfg}" "public_key"
config_get endpoint_host "${cfg}" "endpoint_host"
config_get endpoint_port "${cfg}" "endpoint_port"
- persistent_keepalive=`wg show ${iface} persistent-keepalive | grep ${public_key} | awk '{print $2}'`
+ persistent_keepalive=$(wg show ${iface} persistent-keepalive | grep ${public_key} | awk '{print $2}')
# only process peers with endpoints and keepalive set
[ -z ${endpoint_host} ] && return 0;
@@ -42,16 +42,16 @@ check_peer_activity() {
[ -n "${IPV4}" -o -n "${IPV6}" ] && return 0;
# re-resolve endpoint hostname if not responding for too long
- last_handshake=`wg show ${iface} latest-handshakes | grep ${public_key} | awk '{print $2}'`
+ last_handshake=$(wg show ${iface} latest-handshakes | grep ${public_key} | awk '{print $2}')
[ -z ${last_handshake} ] && return 0;
- idle_seconds=$((`date +%s`-${last_handshake}))
+ idle_seconds=$(($(date +%s)-${last_handshake}))
[ ${idle_seconds} -lt 150 ] && return 0;
logger -t "wireguard_monitor" "${iface} endpoint ${endpoint_host}:${endpoint_port} is not responding for ${idle_seconds} seconds, trying to re-resolve hostname"
wg set ${iface} peer ${public_key} endpoint "${endpoint_host}:${endpoint_port}"
}
# query ubus for all active wireguard interfaces
-wg_ifaces=`ubus -S call network.interface dump | jsonfilter -e '@.interface[@.up=true]' | jsonfilter -a -e '@[@.proto="wireguard"].interface' | tr "\n" " "`
+wg_ifaces=$(ubus -S call network.interface dump | jsonfilter -e '@.interface[@.up=true]' | jsonfilter -a -e '@[@.proto="wireguard"].interface' | tr "\n" " ")
# check every peer in every active wireguard interface
config_load network