From 60066cbf8fc588355d4aac4eff9462efb612a4d4 Mon Sep 17 00:00:00 2001 From: gnosoz <60622842+gnosoz@users.noreply.github.com> Date: Tue, 23 Mar 2021 13:02:45 +0100 Subject: [PATCH] bug fix in the _lan_route procedure The procedure has an error whilst trying to pickup the subnets from the omr-admin-config.json therefore everytime the procedure starts it was creating the same route to 192.168.1.1 regardless of what data was taken from the config file. I added a sed command to clean the variable from the original value ["192.168.3.1/255.255.255.0"] -to the correct value accepted by the command ipcalc -n 92.168.3.1/255.255.255.0 --- omr-service | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/omr-service b/omr-service index 4b8e54d..858aa8c 100755 --- a/omr-service +++ b/omr-service @@ -54,7 +54,8 @@ _lan_route() { if [ -n "$vpnremoteip" ] && [ "$vpnremoteip" != "null" ]; then echo "$c" | jq -c '.lanips //empty' | while IFS=$"\n" read -r d; do - network=$(ipcalc -n $d | grep Network | awk '{print $2}') + subnet=$(sed 's/\[//g; s/\]//g; s/"//g' <<< $d) + network=$(ipcalc -n $subnet | grep Network | awk '{print $2}') [ -n "$network" ] && [ -z "$(ip r show $network via $vpnremoteip)" ] && ip r replace $network via $vpnremoteip 2>&1 >/dev/null done fi