netbirdio/netbird · error
assign addr: %w
Error message
assign addr: %w
What it means
freebsd link.AssignAddr executes `ifconfig <name> inet <ip> netmask <mask>` (mask pre-formatted as 0x%08x in wg_link_freebsd.go) and wraps a non-zero exit as 'assign addr'. The companion IPv6 assignment (an explicit `ifconfig <name> inet6 <addr>` plus the link-local add inside setAddr) is deliberately soft: failures are logged and IPv6 cleared, continuing v4-only. The IPv4 assignment wrapped here is fatal.
Source
Thrown at client/iface/device/wg_link_freebsd.go:74
}
return nil
}
func (l *wgLink) assignAddr(address *wgaddr.Address) error {
link, err := freebsd.LinkByName(l.name)
if err != nil {
return fmt.Errorf("link by name: %w", err)
}
prefixLen := address.Network.Bits()
maskBits := uint32(0xffffffff) << (32 - prefixLen)
mask := fmt.Sprintf("0x%08x", maskBits)
log.Infof("assign addr %s mask %s to %s interface", address.IP, mask, l.name)
if err := link.AssignAddr(address.IP.String(), mask); err != nil {
return fmt.Errorf("assign addr: %w", err)
}
if address.HasIPv6() {
log.Infof("assign IPv6 addr %s to %s interface", address.IPv6String(), l.name)
cmd := exec.Command("ifconfig", l.name, "inet6", address.IPv6String())
if out, err := cmd.CombinedOutput(); err != nil {
log.Warnf("failed to assign IPv6 address %s to %s, continuing v4-only: %s: %v", address.IPv6String(), l.name, string(out), err)
address.ClearIPv6()
}
}
if err := link.Up(); err != nil {
return fmt.Errorf("up: %w", err)
}
return nil
}
View on GitHub (pinned to 93e97f4bf1)
Solutions
- Check debug logs for the ifconfig stderr line captured with this error
- Validate the IP and computed netmask before starting the agent
- Confirm privileges and that the interface exists
- Retry after cleaning any partial configuration from earlier attempts
Defensive patterns
Strategy: try-catch
Validate before calling
// validate address and mask before handing them to ifconfig
if !ip.IsValid() || bits < 0 || bits > 32 {
return fmt.Errorf("invalid IPv4 assignment %s/%d", ip, bits)
} Try / catch
if err := link.AssignAddr(ip, mask); err != nil {
log.Debugf("ifconfig stderr: %v", err)
// invalid pair, missing interface, or privilege issue: fix cause, then retry
return err
} Prevention
- Validate prefixes at the management/config boundary
- Remember IPv6 failure is soft (v4-only fallback) but IPv4 is fatal
- Capture ifconfig stderr in debug logs during setup
When it happens
Trigger: Invalid IP or netmask string passed to ifconfig, interface missing at assignment time, insufficient privileges to set an address.
Common situations: Misformed address/netmask received from management, interface churn between creation and configuration, restricted jails.
Related errors
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/06cfcd45b9941cff.
Report an issue: GitHub.