mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
Fix Ping upstream cause ctrld crash
dohTransport returns a http.RoundTripper. When pinging upstream, we do it both for doh and doh3, and checking whether the transport is nil before performing the check. However, dohTransport returns a concrete *http.Transport. Thus dohTransport will always return a non-nil http.Roundtripper, causing invalid memory dereference when upstream is configured to use doh3. Performing ping upstream separately will fix the issue.
This commit is contained in:
committed by
Cuong Manh Le
parent
ab1d7fd796
commit
3f3c1d6d78
@@ -407,8 +407,12 @@ func (uc *UpstreamConfig) Ping() {
|
||||
}
|
||||
|
||||
for _, typ := range []uint16{dns.TypeA, dns.TypeAAAA} {
|
||||
ping(uc.dohTransport(typ))
|
||||
ping(uc.doh3Transport(typ))
|
||||
switch uc.Type {
|
||||
case ResolverTypeDOH:
|
||||
ping(uc.dohTransport(typ))
|
||||
case ResolverTypeDOH3:
|
||||
ping(uc.doh3Transport(typ))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user