diff --git a/pkg/datapath/linux/ipsec/ipsec_linux.go b/pkg/datapath/linux/ipsec/ipsec_linux.go index d7198c83259b..dbc990827302 100644 --- a/pkg/datapath/linux/ipsec/ipsec_linux.go +++ b/pkg/datapath/linux/ipsec/ipsec_linux.go @@ -668,7 +668,7 @@ func keyfileWatcher(ctx context.Context, watcher *fswatcher.Watcher, keyfilePath for { select { case event := <-watcher.Events: - if event.Op&(fsnotify.Create|fsnotify.Write) == 0 { + if !event.Op.Has(fsnotify.Create) || !event.Op.Has(fsnotify.Write) { continue }