mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-30 08:19:09 +01:00
Feat linux firewall support (#805)
Update the client's engine to apply firewall rules received from the manager (results of ACL policy).
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package iface
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -118,3 +119,17 @@ func (w *WGIface) Close() error {
|
||||
defer w.mu.Unlock()
|
||||
return w.tun.Close()
|
||||
}
|
||||
|
||||
// SetFiltering sets packet filters for the userspace impelemntation
|
||||
func (w *WGIface) SetFiltering(filter PacketFilter) error {
|
||||
w.mu.Lock()
|
||||
defer w.mu.Unlock()
|
||||
|
||||
if w.tun.wrapper == nil {
|
||||
return fmt.Errorf("userspace packet filtering not handled on this device")
|
||||
}
|
||||
|
||||
filter.SetNetwork(w.tun.address.Network)
|
||||
w.tun.wrapper.SetFiltering(filter)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user