mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-08-10 13:20:33 +02: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:
@@ -407,8 +407,12 @@ func (uc *UpstreamConfig) Ping() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, typ := range []uint16{dns.TypeA, dns.TypeAAAA} {
|
for _, typ := range []uint16{dns.TypeA, dns.TypeAAAA} {
|
||||||
ping(uc.dohTransport(typ))
|
switch uc.Type {
|
||||||
ping(uc.doh3Transport(typ))
|
case ResolverTypeDOH:
|
||||||
|
ping(uc.dohTransport(typ))
|
||||||
|
case ResolverTypeDOH3:
|
||||||
|
ping(uc.doh3Transport(typ))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user