Skip to content

Commit

Permalink
fix(network): check if ip command fails
Browse files Browse the repository at this point in the history
  • Loading branch information
LaszloGombos committed Dec 17, 2022
1 parent 1d6f42c commit 52d1460
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules.d/40network/net-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ get_netroot_ip() {
}

ip_is_local() {
strstr "$(ip route get "$@" 2> /dev/null)" " via " || return 0
li=$(ip route get "$@" 2> /dev/null)
if [ -n "$li" ]; then
strstr "$li" " via " || return 0
fi
return 1
}

Expand Down

0 comments on commit 52d1460

Please sign in to comment.