Skip to content
Snippets Groups Projects
Commit 6e15f791 authored by Bob Mottram's avatar Bob Mottram
Browse files

Different way of trapping ipv6 address error

parent 88d45d0b
No related branches found
No related tags found
No related merge requests found
...@@ -522,9 +522,7 @@ function show_ip_addresses { ...@@ -522,9 +522,7 @@ function show_ip_addresses {
echo -n "IPv4: $(get_ipv4_address)/$(get_external_ipv4_address)" echo -n "IPv4: $(get_ipv4_address)/$(get_external_ipv4_address)"
ipv6_address="$(get_ipv6_address)" ipv6_address="$(get_ipv6_address)"
if [ ${#ipv6_address} -gt 0 ]; then if [ ${#ipv6_address} -gt 0 ]; then
if [[ "$ipv6_address" != *'unreachable'* ]]; then echo " IPv6: ${ipv6_address}"
echo " IPv6: ${ipv6_address}"
fi
fi fi
echo '' echo ''
echo '' echo ''
......
...@@ -81,7 +81,8 @@ function get_ipv4_address { ...@@ -81,7 +81,8 @@ function get_ipv4_address {
} }
function get_ipv6_address { function get_ipv6_address {
echo $(ip -6 route get $IPV6_ADDRESS_TEST_DESTINATION | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }') retval=$(ip -6 route get $IPV6_ADDRESS_TEST_DESTINATION 2> /dev/null)
echo $(echo "$retval" | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
} }
# NOTE: deliberately no exit 0 # NOTE: deliberately no exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment