/* Establishes the control and monitor socket connections on the interface */ int wifi_connect_to_supplicant(const char *ifname) { char path[256]; if (is_primary_interface(ifname)) { if (access(IFACE_DIR, F_OK) == 0) { snprintf(path, sizeof(path), "%s/%s", IFACE_DIR, primary_iface); } else { strlcpy(path, primary_iface, sizeof(path)); } return wifi_connect_on_socket_path(PRIMARY, path); } else { sprintf(path, "%s/%s", CONTROL_IFACE_PATH, ifname); return wifi_connect_on_socket_path(SECONDARY, path); } }
/* Establishes the control and monitor socket connections on the interface */ int wifi_connect_to_supplicant() { static char path[PATH_MAX]; if (access(IFACE_DIR, F_OK) == 0) { snprintf(path, sizeof(path), "%s/%s", IFACE_DIR, primary_iface); } else { snprintf(path, sizeof(path), "@android:wpa_%s", primary_iface); } return wifi_connect_on_socket_path(path); }