From 5ff2617fcbe04c2bbfdf57ce5c0e2f3b5f1a9322 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Tue, 9 Feb 2021 14:36:32 +0100 Subject: [PATCH] omr-test-speed can now work on server side --- openmptcprouter/files/bin/omr-test-speed | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/openmptcprouter/files/bin/omr-test-speed b/openmptcprouter/files/bin/omr-test-speed index c38fcd9e4..fa95ff2cc 100755 --- a/openmptcprouter/files/bin/omr-test-speed +++ b/openmptcprouter/files/bin/omr-test-speed @@ -28,11 +28,15 @@ if [ -z "$INTERFACE" ]; then else domain=$(echo $HOST | awk -F/ '{print $3}') hostip=$(dig +nocmd +noall +answer A $domain | grep -v CNAME | awk '{print $5}' | tr '\n' ' ') - for ip in $hostip; do - ipset add ss_rules_dst_bypass_all $ip - done + if [ -n "$(ipset list 2>/dev/null | grep ss_rules)" ]; then + for ip in $hostip; do + ipset add ss_rules_dst_bypass_all $ip + done + fi curl -4 --interface $INTERFACE $HOST >/dev/null || echo - for ip in $hostip; do - ipset del ss_rules_dst_bypass_all $ip - done + if [ -n "$(ipset list 2>/dev/null | grep ss_rules)" ]; then + for ip in $hostip; do + ipset del ss_rules_dst_bypass_all $ip + done + fi fi