我正在尝试在C中订阅Android上的mlme事件,但是在userland中没有收到NL80211_CMD_FRAME事件。
我用libgenl构建了libnl-3并将它们复制到Android中的/ system / lib以便能够使用它。
这是用于创建netlink Socket的函数
int initNetlink(struct Netlink *netlink, struct nlInterface *interface) {
interface->ifIndex = if_nametoindex(interface->ifname);
//printf("[+] %s index: %d\r\n", interface->ifname, interface->ifIndex);
//Abre un socket Netlink
netlink->socket = nl_socket_alloc();
if (!netlink->socket) {
fprintf(stderr, "Failed to allocate netlink socket.\n");
return 1;
} else
printf("Socket NETLINK abierto\r\n");
nl_socket_set_buffer_size(netlink->socket, 8192, 8192);
//Conectamos con el socket
if (genl_connect(netlink->socket)) {
fprintf(stderr, "Failed to connect to netlink socket.\n");
nl_close(netlink->socket);
nl_socket_free(netlink->socket);
return 1;
} else
printf("Socket NETLINK conectado\r\n");
//Conectamos con el canal de control nl80211
netlink->id = genl_ctrl_resolve(netlink->socket, &#