Skip to content

Commit

Permalink
add removal of down network interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaosCypher committed Jun 15, 2021
1 parent 5b3c515 commit f0de509
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions bidir-traffic-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function getInterfaces () {
fi
}

# removes network interfaces that are in the ignore array
# removes network interfaces that are in the ignore array from the interfaces array
function ignoreInterfaces() {
if (( ${#IGNORE_INTERFACES[@]} >= 1 )); then
for iface in "${IGNORE_INTERFACES[@]}"; do
Expand All @@ -41,7 +41,16 @@ function ignoreInterfaces() {
fi
}

# function removeDownInterfaces () {}
# finds interfaces marked as down and removes them from the interfaces array
function removeDownInterfaces () {
for iface in "${INTERFACES[@]}"; do
if [[ -n "${iface}" ]]; then
if grep -q down "$iface/operstate"; then
INTERFACES=( "${INTERFACES[@]/*$iface/}" )
fi
fi
done
}

# function checkTraffic () {
# }
Expand All @@ -55,3 +64,4 @@ function ignoreInterfaces() {
checkSudo
getInterfaces
ignoreInterfaces
removeDownInterfaces

0 comments on commit f0de509

Please sign in to comment.