AFSDB lookups w/ djb's dnscache

Nickolai Zeldovich kolya at mit.edu
Sun Nov 12 23:17:19 CET 2000


Since djb's dnscache is very conservative in what it returns to
the client, arla's AFSDB support doesn't work quite right with
it, because no A records are sent in 'additional information'
at all. The patch below tries to fix this problem.

I also seem to be hitting some bug in the cache code(?), running
on FreeBSD (3.1-RELEASE) with all the configuration files just as
installed by 'make install' -- starting out with a clean cache,
this happens:

  orbit# /usr/arla/bin/arlad --version
  arlad: arla-0.34.6
  orbit# /usr/arla/bin/arlad -t
  Sat Nov 11 20:06:13 2000: arlad: getting ticket for stacken.kth.se: No ticket file (tf_util)
  arla> cd /afs/athena.mit.edu
  arla> quit
  Thank you for using arla
  orbit# /usr/arla/bin/arlad -t
  assertion "!listemptyp (lrulist)" failed: file "fcache.c", line 887
  Abort

and rm'ing the cache allows another successful test mode run.
I'm not at all familiar with the code, so I'm not sure what
additional information I could provide.

-- kolya

*** lib/ko/kocell.c	2000/11/12 00:43:02	1.1
--- lib/ko/kocell.c	2000/11/12 00:59:38	1.2
***************
*** 172,178 ****
  {
      struct dns_reply *r;
      struct resource_record *rr;
!     int dbnum = 0;
      cell_db_entry dbservers[256];
  
      r = dns_lookup(cell, "AFSDB");
--- 172,178 ----
  {
      struct dns_reply *r;
      struct resource_record *rr;
!     int idx, dbnum = 0;
      cell_db_entry dbservers[256];
  
      r = dns_lookup(cell, "AFSDB");
***************
*** 210,218 ****
  	    }
  	}
      }
      if (c)
  	recordcell (c, dbnum, dbservers);
-     dns_free_data(r);
  }
  
  /*
--- 210,236 ----
  	    }
  	}
      }
+     dns_free_data(r);
+ 
+     /*
+      * Look up servers which were not provided in the
+      * 'additional information'.
+      */
+     for(idx = 0; idx<dbnum; ++idx){
+ 	if (dbservers[idx].addr.s_addr == 0) {
+ 	    r = dns_lookup(dbservers[idx].name, "A");
+ 	    if (r) {
+ 		for(rr = r->head; rr; rr=rr->next){
+ 		    if (rr->type == T_A &&
+ 			strcmp(dbservers[idx].name, rr->domain) == 0)
+ 			dbservers[idx].addr = *(rr->u.a);
+ 		}
+ 		dns_free_data(r);
+ 	    }
+ 	}
+     }
      if (c)
  	recordcell (c, dbnum, dbservers);
  }
  
  /*






More information about the Arla-drinkers mailing list