From: Darafei Praliaskouski Date: Fri, 8 May 2026 12:35:59 +0000 (+0400) Subject: net: resolve IDN hostnames with AI_IDN X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=refs%2Fpull%2F620%2Fhead;p=thirdparty%2Fmtr.git net: resolve IDN hostnames with AI_IDN --- 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) {