{"record":{"id":"06cfcd45b9941cff","repo":"netbirdio/netbird","slug":"assign-addr-w-06cfcd","errorCode":null,"errorMessage":"assign addr: %w","messagePattern":"assign addr: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/iface/device/wg_link_freebsd.go","lineNumber":74,"sourceCode":"\t}\n\n\treturn nil\n}\n\nfunc (l *wgLink) assignAddr(address *wgaddr.Address) error {\n\tlink, err := freebsd.LinkByName(l.name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"link by name: %w\", err)\n\t}\n\n\tprefixLen := address.Network.Bits()\n\tmaskBits := uint32(0xffffffff) << (32 - prefixLen)\n\tmask := fmt.Sprintf(\"0x%08x\", maskBits)\n\n\tlog.Infof(\"assign addr %s mask %s to %s interface\", address.IP, mask, l.name)\n\n\tif err := link.AssignAddr(address.IP.String(), mask); err != nil {\n\t\treturn fmt.Errorf(\"assign addr: %w\", err)\n\t}\n\n\tif address.HasIPv6() {\n\t\tlog.Infof(\"assign IPv6 addr %s to %s interface\", address.IPv6String(), l.name)\n\t\tcmd := exec.Command(\"ifconfig\", l.name, \"inet6\", address.IPv6String())\n\t\tif out, err := cmd.CombinedOutput(); err != nil {\n\t\t\tlog.Warnf(\"failed to assign IPv6 address %s to %s, continuing v4-only: %s: %v\", address.IPv6String(), l.name, string(out), err)\n\t\t\taddress.ClearIPv6()\n\t\t}\n\t}\n\n\tif err := link.Up(); err != nil {\n\t\treturn fmt.Errorf(\"up: %w\", err)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/iface/device/wg_link_freebsd.go#L56-L92","documentation":"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.","triggerScenarios":"Invalid IP or netmask string passed to ifconfig, interface missing at assignment time, insufficient privileges to set an address.","commonSituations":"Misformed address/netmask received from management, interface churn between creation and configuration, restricted jails.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// validate address and mask before handing them to ifconfig\nif !ip.IsValid() || bits < 0 || bits > 32 {\n    return fmt.Errorf(\"invalid IPv4 assignment %s/%d\", ip, bits)\n}","typeGuard":null,"tryCatchPattern":"if err := link.AssignAddr(ip, mask); err != nil {\n    log.Debugf(\"ifconfig stderr: %v\", err)\n    // invalid pair, missing interface, or privilege issue: fix cause, then retry\n    return err\n}","preventionTips":["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"],"tags":["freebsd","ifconfig","ip-address","netmask","go"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}