NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/50367: libc resolver library does not resolve host names with underscores ("_")

>Number:         50367
>Category:       lib
>Synopsis:       libc resolver library does not resolve host names with underscores ("_")
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 25 02:25:00 +0000 2015
>Originator:     Stefan Schaeckeler
>Release:        NetBSD 7.0
NetBSD t60p 7.0 NetBSD 7.0 (GENERIC) #0: Sat Sep 26 20:21:41 PDT 2015  root@t60p:/usr/obj/sys/arch/i386/compile/GENERIC i386
Several internet radio stations use host names with underscores, e.g.

Such host names are not resolved:

$ mpg123 -yC
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
        version 1.21.0; written and copyright by Michael Hipp and others
        free software (LGPL) without any warranty but with best wishes

[resolver.c:289] error: Resolving Non-recoverable failure in name resolution

[httpget.c:592] error: Unable to establish connection to

[mpg123.c:611] error: Access to http resource failed.

Other libcs such as Linux' and FreeBSD's libc resolve such host names. Apparently, NetBSD's resolver library filters out underscores. Provided patch fixes the too restrictive filtering.
mpg123 -yC


$ getaddrinfo         
getaddrinfo: Non-recoverable failure in name resolution

--- lib/libc/resolv/res_comp.c  2015-10-24 19:05:43.000000000 -0700
+++ lib/libc/resolv/      2015-10-24 18:13:24.000000000 -0700
@@ -163,6 +163,7 @@
 #define PERIOD 0x2e
 #define hyphenchar(c) ((c) == 0x2d)
+#define underschar(c) ((c) == 0x5f)
 #define bslashchar(c) ((c) == 0x5c)
 #define periodchar(c) ((c) == PERIOD)
 #define asterchar(c) ((c) == 0x2a)
@@ -171,7 +172,7 @@
 #define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
 #define borderchar(c) (alphachar(c) || digitchar(c))
-#define middlechar(c) (borderchar(c) || hyphenchar(c))
+#define middlechar(c) (borderchar(c) || hyphenchar(c) || underschar(c))
 #define        domainchar(c) ((c) > 0x20 && (c) < 0x7f)

Home | Main Index | Thread Index | Old Index