From d0b5470b1d119b34c06ac55e807b7e492f11a1aa Mon Sep 17 00:00:00 2001 From: Darafei Praliaskouski Date: Fri, 8 May 2026 16:35:59 +0400 Subject: [PATCH] net: resolve IDN hostnames with AI_IDN --- configure.ac | 7 +++++++ ui/mtr.c | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/configure.ac b/configure.ac index 444aad6..39091fd 100644 --- a/configure.ac +++ b/configure.ac @@ -203,6 +203,13 @@ AC_CHECK_DECLS([errno], [], [], [[ #include #include ]]) +AC_CHECK_DECLS([AI_IDN], [], [], [[ +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#include + ]]) AC_CHECK_TYPE([socklen_t], [AC_DEFINE([HAVE_SOCKLEN_T], [], [Define if your system has socklen_t])], [], diff --git a/ui/mtr.c b/ui/mtr.c index 29f0432..9529735 100644 --- a/ui/mtr.c +++ b/ui/mtr.c @@ -787,6 +787,9 @@ int get_addrinfo_from_name( memset(&hints, 0, sizeof hints); hints.ai_family = ctl->af; hints.ai_socktype = SOCK_DGRAM; +#if HAVE_DECL_AI_IDN + hints.ai_flags = AI_IDN; +#endif gai_error = getaddrinfo(name, NULL, &hints, res); if (gai_error) { if (gai_error == EAI_SYSTEM) @@ -831,6 +834,9 @@ static int validate_report_targets( memset(&hints, 0, sizeof hints); hints.ai_family = lookup_ctl.af; hints.ai_socktype = SOCK_DGRAM; +#if HAVE_DECL_AI_IDN + hints.ai_flags = AI_IDN; +#endif gai_error = getaddrinfo(names->name, NULL, &hints, &res); if (gai_error) { if (gai_error == EAI_SYSTEM) { -- 2.47.3