Branch oldpackages for 14.07
[14.07/packages.git] / net / djbdns / patches / 210-dnscache-strict-forwardonly.patch
1 --- a/log.h
2 +++ b/log.h
3 @@ -25,6 +25,7 @@ extern void log_nxdomain(const char *,co
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 --- a/log.c
12 +++ b/log.c
13 @@ -197,6 +197,13 @@ void log_lame(const char server[4],const
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 --- a/query.c
28 +++ b/query.c
29 @@ -828,6 +828,18 @@ static int doit(struct query *z,int stat
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);