netbirdio/netbird · error

add firewall rule

Error message

add firewall rule: %w

What it means

The firewall backend rejected AddPeerFiltering while addInRules was installing an inbound peer filtering rule (address, protocol, port, action, ipset). The ACL manager aborts the rule conversion for this entry with the backend's cause attached, leaving the rule uninstalled rather than half-applied.

Solutions

  1. Check firewall engine health and retry the ACL apply
  2. Verify ipset capacity if the rule uses a set
  3. Look at the wrapped error for the backend-specific cause
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at client/internal/acl/manager.go:363 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/5d665633ac20a41c. Report an issue: GitHub.

Appendix: source

Thrown at client/internal/acl/manager.go:363

	case *mgmProto.PortInfo_Range_:
		r := portInfo.GetRange()
		return r == nil || r.Start == 0 || r.End == 0
	default:
		return true
	}
}

func (d *DefaultManager) addInRules(
	id []byte,
	ip netip.Addr,
	protocol firewall.Protocol,
	port *firewall.Port,
	action firewall.Action,
	ipsetName string,
) ([]firewall.Rule, error) {
	rule, err := d.firewall.AddPeerFiltering(id, ip.AsSlice(), protocol, nil, port, action, ipsetName)
	if err != nil {
		return nil, fmt.Errorf("add firewall rule: %w", err)
	}

	return rule, nil
}

func (d *DefaultManager) addOutRules(
	id []byte,
	ip netip.Addr,
	protocol firewall.Protocol,
	port *firewall.Port,
	action firewall.Action,
	ipsetName string,
) ([]firewall.Rule, error) {
	if shouldSkipInvertedRule(protocol, port) {
		return nil, nil
	}

	rule, err := d.firewall.AddPeerFiltering(id, ip.AsSlice(), protocol, port, nil, action, ipsetName)

View on GitHub (pinned to 93e97f4bf1)