Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Nov 1999 20:06:51 -0600 (CST)
From:      Mike Spengler <mks@networkcs.com>
To:        asmodai@wxs.nl (Jeroen Ruigrok/Asmodai)
Cc:        current@FreeBSD.ORG
Subject:   Re: named.conf oddity
Message-ID:  <199911030206.UAA39981@us.networkcs.com>
In-Reply-To: <19991103001355.A281@daemon.ninth-circle.org> from Jeroen Ruigrok/Asmodai at "Nov 3, 99 00:13:55 am"

next in thread | previous in thread | raw e-mail | index | archive | help
Jeroen Ruigrok/Asmodai said:
> 
> Nov  3 00:07:44 daemon named[481]: /etc/dns/named.conf:4: syntax error
> near '195.121.1.34'
> Nov  3 00:07:44 daemon named[481]: /etc/dns/named.conf:7: syntax error
> near '}'
> 
> I start named with -b /etc/dns/named.conf
> 
> And this is my, working for the last half year named.conf:
> 
> options {
> 	directory "/etc/dns";
> 	forwarders {
> 		195.121.1.34;
> 		195.121.1.66;
> 		};
> };

It seems a recent update to lib/libc/net/inet_addr.c is the culprit here.
Any IP address with a component of 34 will fail in inet_aton().  Here's a 
patch that should fix it up:


Index: inet_addr.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/net/inet_addr.c,v
retrieving revision 1.9
diff -u -r1.9 inet_addr.c
--- inet_addr.c	1999/10/31 04:43:55	1.9
+++ inet_addr.c	1999/11/03 02:01:52
@@ -65,6 +65,8 @@
 
 #include <ctype.h>
 #include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
 #include <string.h>
 
 /*
@@ -98,7 +100,7 @@
 	u_long val;
 	char *c;
 	char *endptr;
-	int base, gotend, n;
+	int gotend, n;
 
 	c = (char *)cp;
 	n = 0;
@@ -111,8 +113,10 @@
 		errno = 0;
 		val = strtoul(c, &endptr, 0);
 
-		if (val == ERANGE)	/* Fail completely if it overflowed. */
+		if ((val == ULONG_MAX) && (errno == ERANGE)) {
+			/* Fail completely if it overflowed. */
 			return (0);
+		}
 		
 		/* 
 		 * If the whole string is invalid, endptr will equal

-- 
Mike Spengler				Network Computing Services, Inc.
Email: mks@networkcs.com		1200 Washington Ave. So.
Phone: +1 612 337 3557			Minneapolis MN 55415
FAX:   +1 612 337 3400			(aka Minnesota Supercomputer Center)


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911030206.UAA39981>