1602e4c08045c15fc69d7d32b374f9b3bc60b105
[packages.git] / net / djbdns / patches / 210-dnscache-strict-forwardonly.patch
1 --- djbdns-1.05.original/log.h  2001-02-11 21:11:45.000000000 +0000
2 +++ djbdns-1.05/log.h   2003-07-29 17:12:44.000000000 +0100
3 @@ -23,6 +23,7 @@
4  extern void log_nodata(const char *,const char *,const char *,unsigned int);
5  extern void log_servfail(const char *);
6  extern void log_lame(const char *,const char *,const char *);
7 +extern void log_ignore_referral(const char *,const char *,const char *);
8  
9  extern void log_rr(const char *,const char *,const char *,const char *,unsigned int,unsigned int);
10  extern void log_rrns(const char *,const char *,const char *,unsigned int);
11 --- djbdns-1.05.original/log.c  2001-02-11 21:11:45.000000000 +0000
12 +++ djbdns-1.05/log.c   2003-07-29 17:12:33.000000000 +0100
13 @@ -196,6 +196,13 @@
14    line();
15  }
16  
17 +void log_ignore_referral(const char server[4],const char * control, const char *referral)
18 +{
19 +  string("ignored referral "); ip(server); space();
20 +  name(control); space(); name(referral);
21 +  line();
22 +}
23 +
24  void log_servfail(const char *dn)
25  {
26    const char *x = error_str(errno);
27 --- djbdns-1.05.original/query.c        2001-02-11 21:11:45.000000000 +0000
28 +++ djbdns-1.05/query.c 2003-07-29 17:13:13.000000000 +0100
29 @@ -781,6 +781,18 @@
30  
31  
32    if (!dns_domain_suffix(d,referral)) goto DIE;
33 +
34 +  /* In strict "forwardonly" mode, we don't, as the manual states,
35 +  ** contact a chain of servers according to "NS" resource records.
36 +  ** We don't obey any referral responses, therefore.  Instead, we
37 +  ** eliminate the server from the list and try the next one.
38 +  */
39 +  if (flagforwardonly) {
40 +      log_ignore_referral(whichserver,control,referral);
41 +      byte_zero(whichserver,4);
42 +      goto HAVENS;
43 +  }
44 +
45    control = d + dns_domain_suffixpos(d,referral);
46    z->control[z->level] = control;
47    byte_zero(z->servers[z->level],64);