Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Feb 2001 20:24:05 -0500
From:      "Matthew Emmerton" <matt@gsicomp.on.ca>
To:        "The Hermit Hacker" <scrappy@hub.org>, "Stephen Hovey" <shovey@buffnet.net>
Cc:        <freebsd-questions@FreeBSD.ORG>
Subject:   Re: bind 9.1.1b2 ... "out of range" error ...
Message-ID:  <003501c09adb$d1839230$1200a8c0@gsicomp.on.ca>
References:  <Pine.BSF.4.33.0102192110310.1999-100000@mobile.hub.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> On Mon, 19 Feb 2001, Stephen Hovey wrote:
>
> > Yeah - its not the 10800 thats puking - its the 'serial' number higher
up
> > - it wont take a number greater than 9999999999 in width. so yyyymmdd99
is
> > it for a pattern you can use
>
> okay, now my stupid question ... if I reduce the serial number 20010219nn,
> the serial number is now less then it was before ... won't this cause a
> problem?  I thought a change to serial had to be higher then what it was
> set to previously? :(

Yes, but there is a way around it.  Thanks to some properties of 2s
complement arithmetic, it is possible to construct a sequence of serial
numbers that will allow you to reduce the serial number.  What follows is a
C program that will provide an appropriate sequence of serial numbers that
will do the trick.  I used this program to fix up some DNS records that
accidentally got an extra 0 entered in the serial (for example,
20000010101 - try not to get cross-eyed counting the 0s!)

My apologies to the original author - I don't have the web site where I
found this code, as well as the very nice explanation of how and why it
works.

#include <stdlib.h>
#include <limits.h>
#include <stdio.h>

#define SEQ_GT(a,b)   ((long)((a)-(b)) > 0)
#define STEP 0x7fffffffUL

main(argc,argv)
int argc;
char **argv;
{
unsigned long t2;
unsigned long start, end;
char *e;

if (argc < 3)
exit(1);
start= strtoul(argv[1], &e, 10);
if (*e != '\0')
printf("bad start \"%s\"\n", argv[1]);
end = strtoul(argv[2], &e, 10);
if (*e != '\0')
printf("bad end \"%s\"\n", argv[1]);

t2 = start + STEP;

printf("%lu %lu", start, t2);
t2 += STEP;
while (SEQ_GT(end, t2)) {
printf(" %lu", t2);
t2 += STEP;
}
printf(" %lu\n", end);
exit(0);
}

--
Matt Emmerton



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?003501c09adb$d1839230$1200a8c0>