Skip to content

Commit f35c49d

Browse files
committed
net/dns: update to illarion/gonotify/v3 to fix a panic
Fixes tailscale#14699 Signed-off-by: Anton <anton@tailscale.com>
1 parent c498463 commit f35c49d

File tree

5 files changed

+18
-28
lines changed

5 files changed

+18
-28
lines changed

cmd/k8s-operator/depaware.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ tailscale.com/cmd/k8s-operator dependencies: (generated by github.com/tailscale/
142142
github.com/gorilla/csrf from tailscale.com/client/web
143143
github.com/gorilla/securecookie from github.com/gorilla/csrf
144144
github.com/hdevalence/ed25519consensus from tailscale.com/clientupdate/distsign+
145-
L 💣 github.com/illarion/gonotify/v2 from tailscale.com/net/dns
145+
L 💣 github.com/illarion/gonotify/v3 from tailscale.com/net/dns
146+
L github.com/illarion/gonotify/v3/syscallf from github.com/illarion/gonotify/v3
146147
L github.com/insomniacslk/dhcp/dhcpv4 from tailscale.com/feature/tap
147148
L github.com/insomniacslk/dhcp/iana from github.com/insomniacslk/dhcp/dhcpv4
148149
L github.com/insomniacslk/dhcp/interfaces from github.com/insomniacslk/dhcp/dhcpv4

cmd/tailscaled/depaware.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
114114
github.com/gorilla/csrf from tailscale.com/client/web
115115
github.com/gorilla/securecookie from github.com/gorilla/csrf
116116
github.com/hdevalence/ed25519consensus from tailscale.com/clientupdate/distsign+
117-
L 💣 github.com/illarion/gonotify/v2 from tailscale.com/net/dns
117+
L 💣 github.com/illarion/gonotify/v3 from tailscale.com/net/dns
118+
L github.com/illarion/gonotify/v3/syscallf from github.com/illarion/gonotify/v3
118119
L github.com/insomniacslk/dhcp/dhcpv4 from tailscale.com/feature/tap
119120
L github.com/insomniacslk/dhcp/iana from github.com/insomniacslk/dhcp/dhcpv4
120121
L github.com/insomniacslk/dhcp/interfaces from github.com/insomniacslk/dhcp/dhcpv4

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ require (
4848
github.com/google/uuid v1.6.0
4949
github.com/goreleaser/nfpm/v2 v2.33.1
5050
github.com/hdevalence/ed25519consensus v0.2.0
51-
github.com/illarion/gonotify/v2 v2.0.3
51+
github.com/illarion/gonotify/v3 v3.0.2
5252
github.com/inetaf/tcpproxy v0.0.0-20250203165043-ded522cbd03f
5353
github.com/insomniacslk/dhcp v0.0.0-20231206064809-8c70d406f6d2
5454
github.com/jellydator/ttlcache/v3 v3.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,8 @@ github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq
554554
github.com/hugelgupf/vmtest v0.0.0-20240102225328-693afabdd27f h1:ov45/OzrJG8EKbGjn7jJZQJTN7Z1t73sFYNIRd64YlI=
555555
github.com/hugelgupf/vmtest v0.0.0-20240102225328-693afabdd27f/go.mod h1:JoDrYMZpDPYo6uH9/f6Peqms3zNNWT2XiGgioMOIGuI=
556556
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
557-
github.com/illarion/gonotify/v2 v2.0.3 h1:B6+SKPo/0Sw8cRJh1aLzNEeNVFfzE3c6N+o+vyxM+9A=
558-
github.com/illarion/gonotify/v2 v2.0.3/go.mod h1:38oIJTgFqupkEydkkClkbL6i5lXV/bxdH9do5TALPEE=
557+
github.com/illarion/gonotify/v3 v3.0.2 h1:O7S6vcopHexutmpObkeWsnzMJt/r1hONIEogeVNmJMk=
558+
github.com/illarion/gonotify/v3 v3.0.2/go.mod h1:HWGPdPe817GfvY3w7cx6zkbzNZfi3QjcBm/wgVvEL1U=
559559
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
560560
github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
561561
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=

net/dns/direct_linux.go

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"context"
99
"fmt"
1010

11-
"github.com/illarion/gonotify/v2"
11+
"github.com/illarion/gonotify/v3"
1212
"tailscale.com/health"
1313
)
1414

@@ -25,10 +25,6 @@ func (m *directManager) runFileWatcher() {
2525
func watchFile(ctx context.Context, dir, filename string, cb func()) error {
2626
ctx, cancel := context.WithCancel(ctx)
2727
defer cancel()
28-
in, err := gonotify.NewInotify(ctx)
29-
if err != nil {
30-
return fmt.Errorf("NewInotify: %w", err)
31-
}
3228

3329
const events = gonotify.IN_ATTRIB |
3430
gonotify.IN_CLOSE_WRITE |
@@ -37,28 +33,20 @@ func watchFile(ctx context.Context, dir, filename string, cb func()) error {
3733
gonotify.IN_MODIFY |
3834
gonotify.IN_MOVE
3935

40-
if err := in.AddWatch(dir, events); err != nil {
41-
return fmt.Errorf("AddWatch: %w", err)
36+
watcher, err := gonotify.NewDirWatcher(ctx, events, dir)
37+
if err != nil {
38+
return fmt.Errorf("NewDirWatcher: %w", err)
4239
}
40+
4341
for {
44-
events, err := in.Read()
45-
if ctx.Err() != nil {
46-
return ctx.Err()
47-
}
48-
if err != nil {
49-
return fmt.Errorf("Read: %w", err)
50-
}
51-
var match bool
52-
for _, ev := range events {
53-
if ev.Name == filename {
54-
match = true
55-
break
42+
select {
43+
case event := <-watcher.C:
44+
if event.Name == filename {
45+
cb()
5646
}
47+
case <-ctx.Done():
48+
return ctx.Err()
5749
}
58-
if !match {
59-
continue
60-
}
61-
cb()
6250
}
6351
}
6452

0 commit comments

Comments
 (0)