From dns-return-8084-dnscache=fefe.de@list.cr.yp.to Sat Feb 10 20:16:30 2001 Return-Path: Delivered-To: leitner-fefe-dnscache@fefe.de Received: (qmail 21868 invoked from network); 10 Feb 2001 19:16:30 -0000 Received: from muncher.math.uic.edu (131.193.178.181) by fefe.de with SMTP; 10 Feb 2001 19:16:30 -0000 Received: (qmail 31944 invoked by uid 1002); 10 Feb 2001 19:16:01 -0000 Mailing-List: contact dns-help@list.cr.yp.to; run by ezmlm Delivered-To: mailing list dns@list.cr.yp.to Received: (qmail 21533 invoked from network); 10 Feb 2001 19:16:01 -0000 Received: from cs16770-173.austin.rr.com (HELO nsx.internal.hewgill.net) (24.167.70.173) by muncher.math.uic.edu with SMTP; 10 Feb 2001 19:16:01 -0000 Received: (qmail 19994 invoked by uid 500); 10 Feb 2001 19:14:16 -0000 Date: Sat, 10 Feb 2001 13:14:16 -0600 From: Greg Hewgill To: dns@list.cr.yp.to Subject: axfrdns serial number patch Message-ID: <20010210131416.A19031@nsx.internal.hewgill.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-PGP-Fingerprint: 862C 894D 4908 0240 FEEE 6D1F FA34 8460 74E0 2115 Status: RO Content-Length: 1946 I was having a problem with a secondary nameserver doing an AXFR update from axfrdns. I diagnosed the problem and fixed it locally, and only then thought to check the mailing list archives to see if anybody else had run into this. Sure enough, I see others had this problem with BIND 9. Below is a simple patch for version 1.04 that returns the sequence number of the query in the AXFR response. Greg Hewgill --- axfrdns.c.orig Sun Jan 21 20:51:44 2001 +++ axfrdns.c Tue Feb 6 15:06:41 2001 @@ -144,7 +144,7 @@ if (!stralloc_catb(sa,d,dns_domain_length(d))) nomem(); } -int build(stralloc *sa,char *q,int flagsoa) +int build(stralloc *sa,char *q,int flagsoa,const char id[2]) { unsigned int rdatapos; char misc[20]; @@ -160,6 +160,7 @@ if (!flagsoa) if (byte_equal(type,2,DNS_T_SOA)) return 0; if (!stralloc_copyb(sa,"\0\0\200\200\0\0\0\1\0\0\0\0",12)) nomem(); + sa->s[0] = id[0]; sa->s[1] = id[1]; copy(misc,1); if ((misc[0] == '=' + 1) || (misc[0] == '*' + 1)) { --misc[0]; @@ -217,7 +218,7 @@ static stralloc soa; static stralloc message; -void doaxfr(void) +void doaxfr(const char id[2]) { char key[512]; uint32 klen; @@ -252,7 +253,7 @@ dlen = cdb_datalen(&c); if (dlen > sizeof data) die_cdbformat(); if (cdb_read(&c,data,dlen,cdb_datapos(&c)) == -1) die_cdbformat(); - if (build(&soa,zone,1)) break; + if (build(&soa,zone,1,id)) break; } cdb_free(&c); @@ -286,7 +287,7 @@ if (klen < 1) die_cdbformat(); if (dns_packet_getname(key,klen,0,&q) != klen) die_cdbformat(); if (!dns_domain_suffix(q,zone)) continue; - if (!build(&message,q,0)) continue; + if (!build(&message,q,0,id)) continue; print(message.s,message.len); } @@ -353,7 +354,7 @@ case_lowerb(zone,zonelen); fdcdb = open_read("data.cdb"); if (fdcdb == -1) die_cdbread(); - doaxfr(); + doaxfr(header); close(fdcdb); } else {