From owner-freebsd-questions Mon Feb 19 17:26:12 2001 Delivered-To: freebsd-questions@freebsd.org Received: from xena.gsicomp.on.ca (cr677933-a.ktchnr1.on.wave.home.com [24.43.230.149]) by hub.freebsd.org (Postfix) with ESMTP id 4C0F637B491 for ; Mon, 19 Feb 2001 17:26:00 -0800 (PST) Received: from hermes (hermes.gsicomp.on.ca [192.168.0.18]) by xena.gsicomp.on.ca (8.11.1/8.9.3) with SMTP id f1K1Nxi88682; Mon, 19 Feb 2001 20:24:00 -0500 (EST) (envelope-from matt@gsicomp.on.ca) Message-ID: <003501c09adb$d1839230$1200a8c0@gsicomp.on.ca> From: "Matthew Emmerton" To: "The Hermit Hacker" , "Stephen Hovey" Cc: References: Subject: Re: bind 9.1.1b2 ... "out of range" error ... Date: Mon, 19 Feb 2001 20:24:05 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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 #include #include #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