{"record":{"id":"cc02b787318b067f","repo":"ruvnet/RuView","slug":"veil-genl-ctrl-resolve-nl80211-failed-d","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":"wifi-veil/firmware/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/wifi-veil/firmware/openwrt/veil_shieldd.c#L62-L98","documentation":"Identical code in the wifi-veil vendored copy. `genl_ctrl_resolve(sock, \"nl80211\")` returns the nl80211 family id; a negative value (printed via `%d`) means the family is not registered with the kernel — almost always no cfg80211 driver is loaded or the kernel lacks nl80211. Bring-up aborts because neither MLME events nor commands can proceed without the family id.","triggerScenarios":"No wifi driver loaded (`lsmod | grep cfg80211` empty); radio not probed at boot; VM/container without wifi; custom kernel without CONFIG_NL80211; driver crashed and unloaded.","commonSituations":"Running the wifi-veil build on dev machines or VMs; routers with missing/mismatched kmod packages after a kernel upgrade.","solutions":["Load the driver and verify resolution: `iw dev` and `genl-ctrl-list | grep nl80211`.","Install matching kmods for the radio (e.g. kmod-mt76-*) and reboot.","On custom kernels enable CONFIG_CFG80211 + CONFIG_NL80211 + the radio's mac80211 driver."],"exampleFix":"# before\nveil_shieldd -i 2                     # veil: genl_ctrl_resolve(nl80211) failed: -24\n# after\nopkg install kmod-mt76; iw dev >/dev/null && veil_shieldd -i 2","handlingStrategy":"validation","validationCode":"#!/bin/sh\niw list >/dev/null 2>&1 || { echo \"nl80211 not registered: load radio driver first\"; exit 1; }\nexec veil_shieldd -i \"$(cat /sys/class/net/wlan0/ifindex)\"","typeGuard":null,"tryCatchPattern":"if (g_ctx.family < 0) {\n    fprintf(stderr, \"veil: nl80211 family missing — install matching kmods and reboot\\n\");\n    return g_ctx.family;\n}","preventionTips":["Gate init scripts on `iw dev` succeeding.","Keep kmod-mt76/ath packages synchronized with kernel versions after upgrades.","Test on hardware with a real radio; VMs without passthrough will always fail here."],"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"}