summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-02 12:02:04 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-02 12:02:08 +0100
commita6993fc98fa86a5e4b27194ed151bf6dda8ed6b4 (patch)
tree7ad852f7ff8812399af8e4420acd4cb890c7ee79
parentbfd31a97a604c8587963720f59b5db114058b4e1 (diff)
downloadvyos-1x-a6993fc98fa86a5e4b27194ed151bf6dda8ed6b4.tar.gz
vyos-1x-a6993fc98fa86a5e4b27194ed151bf6dda8ed6b4.zip
xml: local-ip completion helper should output address only once and sorted
When using VRFs a system can have the same IP address multiple times assigned to different VRFs. When listing all the available IP addresses on the system it makes no sense to list this address multiple times.
-rwxr-xr-xsrc/completion/list_local_ips.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/completion/list_local_ips.sh b/src/completion/list_local_ips.sh
index a506ce16e..32df8a8b1 100755
--- a/src/completion/list_local_ips.sh
+++ b/src/completion/list_local_ips.sh
@@ -14,11 +14,11 @@ while [[ "$#" -gt 0 ]]; do
done
if [ $ipv4 -eq 1 ] && [ $ipv6 -eq 1 ]; then
- ip a | grep inet | awk '{print $2}' | sed -e /^fe80::/d | awk -F/ '{print $1}'
+ ip a | grep inet | awk '{print $2}' | sed -e /^fe80::/d | awk -F/ '{print $1}' | sort -u
elif [ $ipv4 -eq 1 ] ; then
- ip a | grep 'inet ' | awk '{print $2}' | awk -F/ '{print $1}'
+ ip a | grep 'inet ' | awk '{print $2}' | awk -F/ '{print $1}' | sort -u
elif [ $ipv6 -eq 1 ] ; then
- ip a | grep 'inet6 ' | awk '{print $2}' | sed -e /^fe80::/d | awk -F/ '{print $1}'
+ ip a | grep 'inet6 ' | awk '{print $2}' | sed -e /^fe80::/d | awk -F/ '{print $1}' | sort -u
else
echo "Usage:"
echo "-4|--ipv4 list only IPv4 addresses"