From owner-freebsd-questions Wed Feb 27 5: 4: 2 2002 Delivered-To: freebsd-questions@freebsd.org Received: from dev.nethouse.com (what.ifelse.org [208.171.40.202]) by hub.freebsd.org (Postfix) with ESMTP id 2AEEE37B400 for ; Wed, 27 Feb 2002 05:03:56 -0800 (PST) Received: from fourier.mat (242829hfc118.tampabay.rr.com [24.28.29.118]) by dev.nethouse.com (8.11.6/8.11.6) with ESMTP id g1RD3tO20341 for ; Wed, 27 Feb 2002 08:03:55 -0500 (EST) (envelope-from btt@nethouse.com) Received: from localhost.localdomain (localhost.mat [127.0.0.1]) by fourier.mat (8.12.1/8.12.1/Debian -5) with ESMTP id g1RD1wjp001834 for ; Wed, 27 Feb 2002 08:01:59 -0500 Subject: Re: Illegal Characters in Hostname From: Bill Triplett To: freebsd-questions@freebsd.org In-Reply-To: <1014747407.93220.41.camel@dev.nethouse.com> References: <1014747407.93220.41.camel@dev.nethouse.com> Content-Type: multipart/mixed; boundary="=-/qRuIGf8gzGwTcNsdjtE" X-Mailer: Evolution/1.0.2 Date: 27 Feb 2002 08:01:58 -0500 Message-Id: <1014814919.1768.31.camel@fourier> Mime-Version: 1.0 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --=-/qRuIGf8gzGwTcNsdjtE Content-Type: text/plain Content-Transfer-Encoding: 7bit As a kind fellow pointed out to me off list, the strict enforcement of the no underscores is happening in libc, in: /usr/src/lib/libc/net/res_comp.c The same gentleman offered me a work-around in case I may want to add underscores to the list of OK characters in hostnames. I know that this is not FreeBSD's fault and that the RFC's are clear about what is and is not allowed (except this[1] one?). The patch to the above mentioned file is attached. I tried ping after recompiling libc w/patch + ping, and the pings went out fine. Whether or not the patch breaks anything else, I don't know... probably not going to use it myself... just including it for follow-up reasons... YMMV, etc... Cheers, Bill [1] http://www.faqs.org/rfcs/rfc1033.html (Under the NAMES heading) Other info found: http://www.netsys.com/openbsd-misc/1998/11/msg00368.html Thread on openbsd mailing list regarding the '_' in hostnames http://www.acmebw.com/askmrdns/archive.php?category=81&question=604 Contains link to other relavent RFCs On Tue, 2002-02-26 at 13:16, Bill Triplett wrote: > Greetings, > > Sendmail is bouncing mail because an MX record contains a _ in the > hostname. I realize this is illegal and will notify the domain > administrator. > > Just playing around, I noticed that I can resolve the address with host > and dig, but can't ping it if I use the hostname as the argument to > ping: > > [btt$] ping dist_internet..com > ping: cannot resolve dist_internet..com: Unknown server > > ---- > > So my questions are: > > Is this strict enforcement of hostnames configurable? Not that I would > want to leave loose enforcement on; just wondering. I noticed that linux > doesn't seem to have a problem with _'s > > Out of curiosity, what is causing the exception? Something in libc > maybe? If I turn on debug in /etc/resolv.conf, it sure looks like the > lookup succeeds (all responses NOERROR), then ping just basically says > forget it. > > ---- > > The system's uname: > > FreeBSD elvis.g-d.com 4.5-STABLE FreeBSD 4.5-STABLE #0: Sat Feb 23 > 12:53:56 EST 2002 root@elvis.g-d.com:/usr/obj/usr/src/sys/ELVIS > i386 --=-/qRuIGf8gzGwTcNsdjtE Content-Disposition: attachment; filename=res_comp.c_patch.txt Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1 --- res_comp.c Fri Aug 27 20:00:16 1999 +++ res_comp.c_uscore Tue Feb 26 22:37:31 2002 @@ -141,6 +141,7 @@ * is not careful about this, but for some reason, we're doing it right he= re. */ #define PERIOD 0x2e +#define uscorechar(c) ((c) =3D=3D 0x5f) #define hyphenchar(c) ((c) =3D=3D 0x2d) #define bslashchar(c) ((c) =3D=3D 0x5c) #define periodchar(c) ((c) =3D=3D PERIOD) @@ -150,7 +151,7 @@ #define digitchar(c) ((c) >=3D 0x30 && (c) <=3D 0x39) =20 #define borderchar(c) (alphachar(c) || digitchar(c)) -#define middlechar(c) (borderchar(c) || hyphenchar(c)) +#define middlechar(c) (borderchar(c) || uscorechar(c) || hyphenchar(c)) #define domainchar(c) ((c) > 0x20 && (c) < 0x7f) =20 int --=-/qRuIGf8gzGwTcNsdjtE-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message