{"record":{"id":"fd6ddd17b0e84d2c","repo":"netbirdio/netbird","slug":"up-s-interface-w","errorCode":null,"errorMessage":"up %s interface: %w","messagePattern":"up (.+?) interface: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/iface/freebsd/link.go","lineNumber":224,"sourceCode":"\tcmd = exec.Command(\"ifconfig\", l.name, \"inet6\", \"fe80::/64\")\n\tif out, err := cmd.CombinedOutput(); err != nil {\n\t\tlog.Debugf(\"adding address command '%v' failed with output: %s\", cmd.String(), out)\n\t}\n\n\treturn nil\n}\n\nfunc (l *Link) up(name string) error {\n\tvar stderr bytes.Buffer\n\n\tcmd := exec.Command(\"ifconfig\", name, \"up\")\n\tcmd.Stderr = &stderr\n\n\terr := cmd.Run()\n\tif err != nil {\n\t\tlog.Debugf(\"ifconfig out: %s\", stderr.String())\n\n\t\treturn fmt.Errorf(\"up %s interface: %w\", name, err)\n\t}\n\n\treturn nil\n}\n\nfunc (l *Link) down(name string) error {\n\tvar stderr bytes.Buffer\n\n\tcmd := exec.Command(\"ifconfig\", name, \"down\")\n\tcmd.Stderr = &stderr\n\n\terr := cmd.Run()\n\tif err != nil {\n\t\tlog.Debugf(\"ifconfig out: %s\", stderr.String())\n\n\t\treturn fmt.Errorf(\"down %s interface: %w\", name, err)\n\t}\n","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/iface/freebsd/link.go#L206-L242","documentation":"up() brings the interface up with `ifconfig <name> up` and wraps a non-zero exit. It fails when the interface no longer exists (destroyed concurrently or never created under that name), on privilege denial, or when the kernel refuses to set IFF_UP for the device.","triggerScenarios":"Calling Link.Up() after the interface was destroyed by another path, or when an earlier failed rename left the actual name different from l.name; unprivileged runs.","commonSituations":"Race between teardown and setup paths; interface name mismatch after a partially failed Add(); jails without interface admin rights.","solutions":["Confirm the interface exists first with `ifconfig <name>`","Re-run setup cleanly: netbird down then netbird up","Run the agent as root","Check dmesg and the debug log for driver-level errors on the device"],"exampleFix":"// before\nif err := link.Up(); err != nil {\n    return err\n}\n\n// after\nif _, err := net.InterfaceByName(name); err != nil {\n    return fmt.Errorf(\"cannot bring up missing interface %s\", name)\n}\nif err := link.Up(); err != nil {\n    return err\n}","handlingStrategy":"retry","validationCode":"if _, err := net.InterfaceByName(name); err != nil {\n    return fmt.Errorf(\"interface %s missing before Up()\", name)\n}","typeGuard":null,"tryCatchPattern":"if err := link.Up(); err != nil {\n    if _, lerr := net.InterfaceByName(name); lerr != nil {\n        // vanished mid-flight: recreate then retry once\n        return recreateAndUp(name)\n    }\n    return err\n}","preventionTips":["Verify interface existence before admin operations","Serialize create/up/down transitions behind one state machine","Investigate name mismatches from partially failed Add() sequences"],"tags":["go","freebsd","ifconfig","interface","startup"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}