From 69dc22c10ffbab9182dfbd336d0159363640390c Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 6 Dec 2017 22:31:12 +0000 Subject: [PATCH 1/4] fix some codacy and intelliJ idea complaints Signed-off-by: Adam Warner --- automated install/basic-install.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 3377ca86..139627e0 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -503,15 +503,21 @@ testIPv6() { # first will contain fda2 (ULA) first="$(cut -f1 -d":" <<< "$1")" # value1 will contain 253 which is the decimal value corresponding to 0xfd - value1=$(((0x$first)/256)) + value1=$(( (0x$first)/256 )) # will contain 162 which is the decimal value corresponding to 0xa2 - value2=$(((0x$first)%256)) + value2=$(( (0x$first)%256 )) # the ULA test is testing for fc00::/7 according to RFC 4193 - (((value1&254)==252)) && echo "ULA" || true + if (( value1&254 == 252 )); then + echo "ULA" + fi # the GUA test is testing for 2000::/3 according to RFC 4291 - (((value1&112)==32)) && echo "GUA" || true + if (( value1&112 == 32 )); then + echo "GUA" + fi # the LL test is testing for fe80::/10 according to RFC 4193 - (((value1==254) && ((value2&192)==128))) && echo "Link-local" || true + if (( value1 == 254 )) && (( value2&192 == 128 )); then + echo "Link-local" + fi } # A dialog for showing the user about IPv6 blocking From 162a7b56fe9f04ce12b395760a0928026fefd082 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 6 Dec 2017 22:41:31 +0000 Subject: [PATCH 2/4] force mode is no longer referenced. Regression. Same with `domToRemoveList` Signed-off-by: Adam Warner --- advanced/Scripts/list.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh index 9ddfe8f3..72250afd 100755 --- a/advanced/Scripts/list.sh +++ b/advanced/Scripts/list.sh @@ -19,7 +19,6 @@ addmode=true verbose=true domList=() -domToRemoveList=() listMain="" listAlt="" @@ -240,7 +239,6 @@ for var in "$@"; do "-wild" | "wildcard" ) listMain="${wildcardlist}";; "-nr"| "--noreload" ) reload=false;; "-d" | "--delmode" ) addmode=false;; - "-f" | "--force" ) force=true;; "-q" | "--quiet" ) verbose=false;; "-h" | "--help" ) helpFunc;; "-l" | "--list" ) Displaylist;; From 79aada0b87d1f8b4992acedcdff03f6eff78180b Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 6 Dec 2017 22:57:05 +0000 Subject: [PATCH 3/4] travis didn't like that Signed-off-by: Adam Warner --- automated install/basic-install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 139627e0..79754872 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -507,15 +507,15 @@ testIPv6() { # will contain 162 which is the decimal value corresponding to 0xa2 value2=$(( (0x$first)%256 )) # the ULA test is testing for fc00::/7 according to RFC 4193 - if (( value1&254 == 252 )); then + if (( (value1&254)==252 )); then echo "ULA" fi # the GUA test is testing for 2000::/3 according to RFC 4291 - if (( value1&112 == 32 )); then + if (( (value1&112)==32 )); then echo "GUA" fi # the LL test is testing for fe80::/10 according to RFC 4193 - if (( value1 == 254 )) && (( value2&192 == 128 )); then + if (( (value1)==254 )) && (( (value2&192)==128 )); then echo "Link-local" fi } From a9a40ca46c7f086b2efa9464fa90026e47004f72 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 6 Dec 2017 23:27:40 +0000 Subject: [PATCH 4/4] Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead. Signed-off-by: Adam Warner --- advanced/Scripts/piholeDebug.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 43393ee9..d69c5e4d 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -499,7 +499,7 @@ does_ip_match_setup_vars() { # IP address to check for local ip_address="${2}" # See what IP is in the setupVars.conf file - local setup_vars_ip=$(cat ${PIHOLE_SETUP_VARS_FILE} | grep IPV${protocol}_ADDRESS | cut -d '=' -f2) + local setup_vars_ip=$(< ${PIHOLE_SETUP_VARS_FILE} grep IPV${protocol}_ADDRESS | cut -d '=' -f2) # If it's an IPv6 address if [[ "${protocol}" == "6" ]]; then # Strip off the / (CIDR notation)