netbirdio/netbird · error

add route rule

Error message

add route rule: %v

What it means

The generated route rule could not be inserted (DROP, at position 2) or appended (ACCEPT) to the FORWARD chain. The spec was valid; the iptables call itself failed — locks, privileges, or a table in a bad state.

Solutions

  1. Check daemon capabilities and xtables lock contention
  2. Inspect the inner iptables error for the exact failure
  3. Restart the daemon to retry route programming
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at client/firewall/iptables/router_linux.go:184 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/d2d9bd28848c048a. Report an issue: GitHub.

Appendix: source

Thrown at client/firewall/iptables/router_linux.go:184

		DPort:       dPort,
		Action:      action,
	}

	rule, err := r.genRouteRuleSpec(params, sources)
	if err != nil {
		return nil, fmt.Errorf("generate route rule spec: %w", err)
	}

	// Insert DROP rules at the beginning, append ACCEPT rules at the end
	if action == firewall.ActionDrop {
		// after the established rule
		err = r.iptablesClient.Insert(tableFilter, chainRTFWDIN, 2, rule...)
	} else {
		err = r.iptablesClient.Append(tableFilter, chainRTFWDIN, rule...)
	}

	if err != nil {
		return nil, fmt.Errorf("add route rule: %v", err)
	}

	r.rules[string(ruleKey)] = rule

	r.updateState()

	return ruleKey, nil
}

func (r *router) hasRule(id string) bool {
	_, ok := r.rules[id]
	return ok
}

func (r *router) DeleteRouteRule(rule firewall.Rule) error {
	ruleKey := rule.ID()

	if rule, exists := r.rules[ruleKey]; exists {

View on GitHub (pinned to 93e97f4bf1)