mirror of
https://github.com/daeuniverse/dae.git
synced 2024-12-23 01:04:40 +07:00
fix: potential overwriting deadline of DNS upstream resolution
This commit is contained in:
parent
c2e02482d0
commit
a3bf4e1ebd
@ -226,9 +226,12 @@ func (c *DnsController) UpdateDnsCache(host string, dnsTyp string, answers []dns
|
||||
c.dnsCacheMu.Lock()
|
||||
cache, ok := c.dnsCache[cacheKey]
|
||||
if ok {
|
||||
c.dnsCacheMu.Unlock()
|
||||
cache.Deadline = deadline
|
||||
// To avoid overwriting DNS upstream resolution.
|
||||
if deadline.After(cache.Deadline) {
|
||||
cache.Deadline = deadline
|
||||
}
|
||||
cache.Answers = answers
|
||||
c.dnsCacheMu.Unlock()
|
||||
} else {
|
||||
cache, err = c.newCache(fqdn, answers, deadline)
|
||||
if err != nil {
|
||||
|
@ -204,6 +204,12 @@ func (c *ControlPlane) handlePkt(lConn *net.UDPConn, data []byte, src, pktDst, r
|
||||
retry := 0
|
||||
getNew:
|
||||
if retry > MaxRetry {
|
||||
c.log.WithFields(logrus.Fields{
|
||||
"src": RefineSourceToShow(realSrc, realDst.Addr(), lanWanFlag),
|
||||
"network": networkType.String(),
|
||||
"dialer": ue.Dialer.Property().Name,
|
||||
"retry": retry,
|
||||
}).Warnln("Touch max retry limit.")
|
||||
return fmt.Errorf("touch max retry limit")
|
||||
}
|
||||
ue, isNew, err := DefaultUdpEndpointPool.GetOrCreate(realSrc, &UdpEndpointOptions{
|
||||
|
Loading…
Reference in New Issue
Block a user