Fix/ebpf free (#1057)

* Fix ebpf free call

* Add debug logs
This commit is contained in:
Zoltan Papp 2023-08-07 11:43:32 +02:00 committed by GitHub
parent 973316d194
commit 8eca83f3cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 2 deletions

View File

@ -75,7 +75,7 @@ func (l *EBPF) Load(proxyPort, wgPort int) error {
return err return err
} }
// Free free ebpf program // Free ebpf program
func (l *EBPF) Free() error { func (l *EBPF) Free() error {
if l.link != nil { if l.link != nil {
return l.link.Close() return l.link.Close()

View File

@ -14,7 +14,7 @@ func (w *Factory) GetProxy() Proxy {
func (w *Factory) Free() error { func (w *Factory) Free() error {
if w.ebpfProxy != nil { if w.ebpfProxy != nil {
return w.ebpfProxy.CloseConn() return w.ebpfProxy.Free()
} }
return nil return nil
} }

View File

@ -104,6 +104,7 @@ func (p *WGEBPFProxy) CloseConn() error {
// Free resources // Free resources
func (p *WGEBPFProxy) Free() error { func (p *WGEBPFProxy) Free() error {
log.Debugf("free up ebpf wg proxy")
var err1, err2, err3 error var err1, err2, err3 error
if p.conn != nil { if p.conn != nil {
err1 = p.conn.Close() err1 = p.conn.Close()

View File

@ -20,6 +20,7 @@ type WGUserSpaceProxy struct {
// NewWGUserSpaceProxy instantiate a user space WireGuard proxy // NewWGUserSpaceProxy instantiate a user space WireGuard proxy
func NewWGUserSpaceProxy(wgPort int) *WGUserSpaceProxy { func NewWGUserSpaceProxy(wgPort int) *WGUserSpaceProxy {
log.Debugf("instantiate new userspace proxy")
p := &WGUserSpaceProxy{ p := &WGUserSpaceProxy{
localWGListenPort: wgPort, localWGListenPort: wgPort,
} }