work around.

the real problem is the fact we insist on an "a" record when there's
only a cname listed.  normally dns gets away with this bug
because restarting the query looking for a cname works.
unfortunately, in this case, the ttl is 20s, so that expires before
we timeout the first query.  there is no way to get a successful
query.

it's not immediately apparent why a cname answer isn't okay,
or why dns doesn't recognize the query failed instead of timing
out, but we can at least try to hack dns to keep answers around
long enough to survive the timeout via this vicious hack:

/n/dump/2010/0606/sys/src/cmd/ndb/dn.c:741,748 - dn.c:741,757
        assert(new->magic == RRmagic && !new->cached);
  
  //    dnslog("rrattach1: %s", new->owner->name);
-       if(!new->db)
+       if(!new->db){
                new->expire = new->ttl;         /* ? */
+ 
+               /*
+                * evil hack to work around other hacks.
+                * try not to let responses expire before we
+                * can use them to complete this query.
+                */
+               if(new->expire <= now - 60)
+                       new->expire = now + 600;
+       }
        else
                new->expire = now + Year;
        dp = new->owner;

oh, also, these queries log this in /sys/log/dns

ladd Jun  6 15:54:01 46055: qp->type 1 instead of 5: 94.23.222.114
ladd Jun  6 15:54:03 46055: qp->type 1 instead of 5: 92.243.20.135
ladd Jun  6 15:54:03 46055: qp->type 1 instead of 5: 94.23.222.114

- erik

Reply via email to