fix: apply comment from PR review

This commit is contained in:
RouxAntoine 2022-05-17 19:34:39 +02:00
parent 8e14ae553b
commit aca5c8dd24
No known key found for this signature in database
GPG Key ID: 098FB66FC0475E70

View File

@ -19,8 +19,9 @@ import (
"net" "net"
"sync" "sync"
"github.com/squat/kilo/pkg/iptables"
"github.com/vishvananda/netlink" "github.com/vishvananda/netlink"
"github.com/squat/kilo/pkg/iptables"
) )
const ciliumDeviceName = "cilium_host" const ciliumDeviceName = "cilium_host"
@ -43,7 +44,7 @@ func NewCilium(strategy Strategy) Encapsulator {
} }
} }
// CleanUp is a no-op. // CleanUp close done channel
func (f *cilium) CleanUp() error { func (f *cilium) CleanUp() error {
close(f.done) close(f.done)
return nil return nil
@ -56,6 +57,8 @@ func (f *cilium) Gw(_, _ net.IP, subnet *net.IPNet) net.IP {
// Index returns the index of the Cilium interface. // Index returns the index of the Cilium interface.
func (f *cilium) Index() int { func (f *cilium) Index() int {
f.mu.Lock()
defer f.mu.Unlock()
return f.iface return f.iface
} }