msg = nlmsg_alloc();
if (!msg)
return -ENOMEM;
- if (!genlmsg_put(msg, 0, 0, genl_ctrl_resolve(global->nl, "nlctrl"),
+ if (!genlmsg_put(msg, 0, 0, global->nlctrl_id,
0, 0, CTRL_CMD_GETFAMILY, 0) ||
nla_put_string(msg, CTRL_ATTR_FAMILY_NAME, family)) {
nlmsg_free(msg);
goto err;
}
+ global->nlctrl_id = genl_ctrl_resolve(global->nl, "nlctrl");
+ if (global->nlctrl_id < 0) {
+ wpa_printf(MSG_ERROR,
+ "nl80211: 'nlctrl' generic netlink not found");
+ goto err;
+ }
+
global->nl_event = nl_create_handle(global->nl_cb, "event");
if (global->nl_event == NULL)
goto err;