forked from loweel/zabov
				
			- BUG FIX: preserving DNS RCode in Zabov responses (SetReply(query) resets it to RcodeSuccess)
Some DNS client (such as MS Windows) misbehave in case of always positive responsesremotes/1680050961956510080/tmp_refs/heads/master
							parent
							
								
									e5b8fbe53c
								
							
						
					
					
						commit
						7cb896ac59
					
				|  | @ -30,7 +30,9 @@ func ForwardQuery(query *dns.Msg, config string, nocache bool) *dns.Msg { | ||||||
| 	if !nocache { | 	if !nocache { | ||||||
| 		if cached := GetDomainFromCache(lfqdn); cached != nil { | 		if cached := GetDomainFromCache(lfqdn); cached != nil { | ||||||
| 			go incrementStats("CacheHit", 1) | 			go incrementStats("CacheHit", 1) | ||||||
|  | 			Rcode := cached.MsgHdr.Rcode | ||||||
| 			cached.SetReply(query) | 			cached.SetReply(query) | ||||||
|  | 			cached.MsgHdr.Rcode = Rcode | ||||||
| 			cached.Authoritative = true | 			cached.Authoritative = true | ||||||
| 			if ZabovDebug { | 			if ZabovDebug { | ||||||
| 				log.Println("ForwardQuery: CacheHit") | 				log.Println("ForwardQuery: CacheHit") | ||||||
|  | @ -65,7 +67,9 @@ func ForwardQuery(query *dns.Msg, config string, nocache bool) *dns.Msg { | ||||||
| 			continue | 			continue | ||||||
| 		} else { | 		} else { | ||||||
| 			go incrementStats(d, 1) | 			go incrementStats(d, 1) | ||||||
|  | 			Rcode := in.MsgHdr.Rcode | ||||||
| 			in.SetReply(query) | 			in.SetReply(query) | ||||||
|  | 			in.MsgHdr.Rcode = Rcode | ||||||
| 			in.Authoritative = true | 			in.Authoritative = true | ||||||
| 			in.Compress = true | 			in.Compress = true | ||||||
| 			go DomainCache(lfqdn, in) | 			go DomainCache(lfqdn, in) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue