{"record":{"id":"a0a68c3c74ccce7c","repo":"ruvnet/RuView","slug":"veil-genl-ctrl-resolve-nl80211-failed-d-n","errorCode":null,"errorMessage":"veil: genl_ctrl_resolve(nl80211) failed: %d\\n","messagePattern":"veil: genl_ctrl_resolve\\(nl80211\\) failed: (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"firmware/privshield/openwrt/veil_shieldd.c","lineNumber":80,"sourceCode":"\nstatic void on_signal(int sig) { (void)sig; g_ctx.running = 0; }\n\n/* ---------------------------------------------------------------------- */\n/* nl80211 bring-up — all REAL libnl-genl-3 API names.                     */\n/* ---------------------------------------------------------------------- */\nstatic int veil_nl_connect(struct veil_ctx *c) {\n    c->sock = nl_socket_alloc();\n    if (!c->sock) {\n        fprintf(stderr, \"veil: nl_socket_alloc failed\\n\");\n        return -ENOMEM;\n    }\n    if (genl_connect(c->sock)) {\n        fprintf(stderr, \"veil: genl_connect failed\\n\");\n        return -EIO;\n    }\n    c->family = genl_ctrl_resolve(c->sock, \"nl80211\");\n    if (c->family < 0) {\n        fprintf(stderr, \"veil: genl_ctrl_resolve(nl80211) failed: %d\\n\",\n                c->family);\n        return c->family;\n    }\n    /* Observe MLME events (auth/assoc, and — where the driver forwards them —\n     * action-frame notifications). Real multicast group name is \"mlme\". */\n    int grp = genl_ctrl_resolve_grp(c->sock, \"nl80211\", \"mlme\");\n    if (grp >= 0) {\n        (void)nl_socket_add_membership(c->sock, grp);\n    }\n    return 0;\n}\n\n/* ---------------------------------------------------------------------- */\n/* CONTROL 1 (FEASIBLE): TX antenna-map perturbation.                      */\n/* Rotating the allowed TX antenna bitmap changes the static spatial       */\n/* mapping the PHY uses, coarsely perturbing the CSI a sensor observes.    */\n/* This is a genuinely userspace-reachable, compliant knob.                */\n/*   NL80211_CMD_SET_WIPHY + NL80211_ATTR_WIPHY_ANTENNA_TX / _RX           */","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/firmware/privshield/openwrt/veil_shieldd.c#L62-L98","documentation":"`genl_ctrl_resolve` queries the generic netlink controller for the numeric family id of \"nl80211\". A negative return (printed as `%d`) means the family is not registered: almost always no cfg80211-based wifi driver is loaded, or the kernel lacks nl80211. Without the family id the daemon can neither listen for MLME events nor send commands, so bring-up aborts.","triggerScenarios":"Running on a host with no wifi driver loaded (`lsmod | grep cfg80211` empty); radio failed to probe at boot (wrong DTS/board data); VM or container without wifi passthrough; custom kernel missing CONFIG_CFG80211/CONFIG_NL80211.","commonSituations":"Developing/testing the daemon on a laptop or VM with no wireless card; driver crash unloading cfg80211; firmware packages (mt76-*) missing or kernel-mismatched on the router.","solutions":["Load/enable the wifi driver and verify: `iw dev` should list an interface and `genl-ctrl-list | grep nl80211` should resolve.","In a VM, pass through a USB dongle backed by a cfg80211 driver, or run directly on the router.","For custom kernels, enable CONFIG_CFG80211, CONFIG_NL80211, and the radio's mac80211/mt76/ath driver, then rebuild."],"exampleFix":"# before\nveil_shieldd -i 2                     # veil: genl_ctrl_resolve(nl80211) failed: -24\n# after\nopkg install kmod-mt76-core kmod-mt76-usb   # driver for the actual radio\niw dev && veil_shieldd -i 2","handlingStrategy":"validation","validationCode":"#!/bin/sh\n# pre-flight: nl80211 family must be registered\niw list >/dev/null 2>&1 || { echo \"no cfg80211/nl80211 driver loaded\"; exit 1; }\nIFIDX=$(cat /sys/class/net/wlan0/ifindex)\nexec veil_shieldd -i \"$IFIDX\"","typeGuard":null,"tryCatchPattern":"if (g_ctx.family < 0) {\n    /* nl80211 not registered: load the radio driver or fix the kernel */\n    fprintf(stderr, \"veil: load a cfg80211 driver (kmod-mt76/ath) before starting\\n\");\n    return g_ctx.family;\n}","preventionTips":["Gate the init script on `iw dev` / `genl-ctrl-list | grep nl80211` succeeding.","Keep kmod packages matched to the installed kernel after sysupgrades.","Don't expect the daemon to work in VMs/containers without a real passed-through radio."],"tags":["c","openwrt","nl80211","driver","kernel-config","bring-up"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}