Commit 0d13a4a8 authored by Vitaly Lipatov's avatar Vitaly Lipatov

functions: fix resolve_gw treating IPv6 addresses as hostnames

IPv6 addresses like 2a03:5a00:c:20::122 contain hex letters (a-f), matching the *[a-zA-Z]* hostname pattern. Check for colon first to handle IPv6 as literal addresses. Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 4f62bb79
......@@ -31,6 +31,7 @@ resolve_gw()
local ipcmd="${2:-ip}"
case "$val" in
default) resolve_default_gw "$ipcmd" ;;
*:*) echo "$val" ;;
*[a-zA-Z]*)
if [ "$ipcmd" = "ip -6" ] ; then
dig +short AAAA "$val" | grep -m1 ':'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment