Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Use ip command for VPN segment - fix #1125 #1126

Merged
merged 16 commits into from
Feb 25, 2019
Prev Previous commit
Next Next commit
Interface States can be unsorted
  • Loading branch information
dritter committed Feb 21, 2019
commit 1ab6a32c4b4871e4161cd75e485c203d0c2111e7
10 changes: 7 additions & 3 deletions functions/utilities.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,13 @@ function p9k::parseIp() {
continue
fi
# Check if interface is UP.
if [[ "${interface/${newline}/}" =~ "<UP(,)?[^>]*>(.*)inet[ ]+([^ ]*)" ]]; then
echo "${match[3]}"
return 0
if [[ "${interface/${newline}/}" =~ "<([^>]*)>(.*?)inet[ ]+([^ ]*)" ]]; then
local ipFound="${match[3]}"
local -a interfaceStates=(${(s:,:)match[1]})
if [[ "${interfaceStates[(r)UP]}" == "UP" ]]; then
echo "${ipFound}"
return 0
fi
fi
done
else
Expand Down