File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,16 @@ import (
5
5
"fmt"
6
6
"net"
7
7
"strings"
8
+ "sync"
8
9
9
10
"github.com/containers/gvisor-tap-vsock/pkg/types"
10
11
"github.com/miekg/dns"
11
12
log "github.com/sirupsen/logrus"
12
13
)
13
14
14
15
type dnsHandler struct {
15
- zones []types.Zone
16
+ zones []types.Zone
17
+ zonesLock sync.RWMutex
16
18
}
17
19
18
20
func (h * dnsHandler ) handle (w dns.ResponseWriter , r * dns.Msg ) {
@@ -26,6 +28,8 @@ func (h *dnsHandler) handle(w dns.ResponseWriter, r *dns.Msg) {
26
28
}
27
29
28
30
func (h * dnsHandler ) addAnswers (m * dns.Msg ) {
31
+ h .zonesLock .RLock ()
32
+ defer h .zonesLock .RUnlock ()
29
33
for _ , q := range m .Question {
30
34
for _ , zone := range h .zones {
31
35
zoneSuffix := fmt .Sprintf (".%s" , zone .Name )
You can’t perform that action at this time.
0 commit comments