net/dns: don't send on closed channel in resolvedManager

Fixes #7686

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: Ibffb05539ab876b12407d77dcf2201d467895981
This commit is contained in:
Andrew Dunham 2023-03-24 12:43:37 -04:00
parent 6f9aed1656
commit 33b359642e

View File

@ -117,8 +117,10 @@ func newResolvedManager(logf logger.Logf, interfaceName string) (*resolvedManage
}
func (m *resolvedManager) SetDNS(config OSConfig) error {
// NOTE: don't close this channel, since it's possible that the SetDNS
// call will time out and return before the run loop answers, at which
// point it will send on the now-closed channel.
errc := make(chan error, 1)
defer close(errc)
select {
case <-m.ctx.Done():