Fix allow netbird traffic for nftables and userspace (#1446)

Add default allow rules for input and output chains as part of the allownetbird call for userspace mode
This commit is contained in:
Zoltan Papp
2024-01-11 12:21:58 +01:00
committed by GitHub
parent 5311ce4e4a
commit 3591795a58
6 changed files with 99 additions and 4 deletions

View File

@ -106,11 +106,19 @@ func (m *Manager) RemoveRoutingRules(pair firewall.RouterPair) error {
}
// AllowNetbird allows netbird interface traffic
// todo review this method usage
func (m *Manager) AllowNetbird() error {
if !m.wgIface.IsUserspaceBind() {
return nil
}
m.mutex.Lock()
defer m.mutex.Unlock()
err := m.aclManager.createDefaultAllowRules()
if err != nil {
return fmt.Errorf("failed to create default allow rules: %v", err)
}
chains, err := m.rConn.ListChainsOfTableFamily(nftables.TableFamilyIPv4)
if err != nil {
return fmt.Errorf("list of chains: %w", err)
@ -145,6 +153,7 @@ func (m *Manager) AllowNetbird() error {
if err != nil {
return fmt.Errorf("failed to flush allow input netbird rules: %v", err)
}
return nil
}