+ return 1;
+}
+
+int handle_netlink_specific_scan(Wifi *wifi, GDBusMethodInvocation *context, gchar *ssid)
+{
+ DBG("ssid: %s", ssid);
+ netconfig_nl_global global = {
+ .id = -1,
+ .if_index = -1,
+ .socket = NULL,
+ .msg = NULL,
+ };
+
+ /** Initialize netlink socket */
+ int ret = __netconfig_initialize_nl80211(&global);
+ if (ret < 0) {
+ DBG("__netconfig_initialize_nl80211() failed, error %d", ret);
+ wifi_complete_netlink_specific_scan(wifi, context);
+ return ret;
+ }
+
+ /** Request NL80211_CMD_TRIGGER_SCAN to the kernel. */
+ ret = __netconfig_request_netlink_scan(global.socket, global.if_index, global.id, ssid);
+ if (ret != 0) {
+ DBG("__netconfig_request_netlink_scan() failed, error %d", ret);
+ wifi_complete_netlink_specific_scan(wifi, context);
+ return ret;
+ }
+
+ ret = __netconfig_initialize_nl_msg(&global);
+ if (ret < 0) {
+ DBG("__netconfig_initialize_nl_msg() failed, error %d", ret);
+ wifi_complete_netlink_specific_scan(wifi, context);
+ return ret;
+ }
+
+ ret = nl_send_auto_complete(global.socket, global.msg);
+ DBG("NL80211_CMD_GET_SCAN sent %d bytes to the kernel", ret);
+
+ /** Receive the kernel message. */
+ ret = nl_recvmsgs_default(global.socket);
+ nlmsg_free(global.msg);
+ if (ret < 0) {
+ DBG("nl_recvmsgs_default() failed. ret: %d (error: %s)", ret, nl_geterror(-ret));
+ wifi_complete_netlink_specific_scan(wifi, context);
+ return ret;
+ }
+
+ wifi_complete_netlink_specific_scan(wifi, context);
+ return 1;