我正在尝试使用 C 代码wpa_supplicant在运行 linux 的 ARM 嵌入式系统中进行访问。搜索后,我意识到我可以使用wpa_supplicant控制界面。我尝试打开一个connection using wpa_ctrl_open(),并导致“连接被拒绝”错误:
无法连接到 wpa_supplicant 全局接口:/var/run/wpa_supplicant 错误:连接被拒绝
我用来测试的代码:
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/sockios.h>
#include <netinet/if_ether.h>
#include <net/if.h>
#include <sys/socket.h>
#include <sys/un.h>
#include "includes.h"
#ifdef CONFIG_CTRL_IFACE_UNIX
#include <dirent.h>
#endif /* CONFIG_CTRL_IFACE_UNIX */
#include "wpa_ctrl.h"
#include "common.h"
struct wpa_ctrl {
int s;
#ifdef CONFIG_CTRL_IFACE_UDP
struct sockaddr_in local;
struct sockaddr_in dest;
#else // CONFIG_CTRL_IFACE_UDP
struct sockaddr_un local;
struct sockaddr_un dest;
#endif // CONFIG_CTRL_IFACE_UDP
};
static struct …Run Code Online (Sandbox Code Playgroud)