{
int *err = user_data;
*err = 0;
+ DBG("");
return NL_STOP;
}
nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, &err);
nl_cb_set(cb, NL_CB_ACK, NL_CB_CUSTOM, ack_handler, &err);
nl_cb_set(cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL);
+ ret = nl_socket_set_nonblocking(socket);
+ DBG("Set the non-blocking mode [%d]", ret);
/** Send NL80211_CMD_TRIGGER_SCAN to start the scan. */
ret = nl_send_auto_complete(socket, msg);
+
if (ret < 0) {
DBG("nl_send_auto_complete() error: (%s)", nl_geterror(-ret));
goto out;
DBG("Sent %d bytes to the kernel", ret);
ssid_found = FALSE;
- while (err > 0)
+ while (err > 0) {
ret = nl_recvmsgs(socket, cb);
-
- if (ret < 0) {
- DBG("nl_recvmsgs() ret: %d (%s)", ret, nl_geterror(-ret));
- goto out;
+ if (ret < 0) {
+ DBG("nl_recvmsgs() ret: %d (%s)", ret, nl_geterror(-ret));
+ goto out;
+ }
}
- while (!results.done)
- nl_recvmsgs(socket, cb);
+ while (!results.done) {
+ ret = nl_recvmsgs(socket, cb);
+ if (ret < 0 || err < 0) {
+ DBG("scan failed");
+ ret = -1;
+ goto out;
+ }
+ }
if (results.aborted) {
DBG("scan aborted");
+ ret = -1;
goto out;
}
int ret = __netconfig_initialize_nl80211(&global);
if (ret < 0) {
DBG("__netconfig_initialize_nl80211() failed, error %d", ret);
+ netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "AccessDenied");
wifi_complete_netlink_scan(wifi, context);
return TRUE;
}
ret = __netconfig_request_netlink_scan(global.socket, global.if_index, global.id, params);
if (ret < 0) {
DBG("__netconfig_request_netlink_scan() failed, error %d", ret);
+ netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "AccessDenied");
wifi_complete_netlink_scan(wifi, context);
return TRUE;
}
ret = __netconfig_initialize_nl_msg(&global);
if (ret < 0) {
DBG("__netconfig_initialize_nl_msg() failed, error %d", ret);
+ netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "AccessDenied");
wifi_complete_netlink_scan(wifi, context);
return TRUE;
}
nlmsg_free(global.msg);
if (ret < 0) {
DBG("nl_recvmsgs_default() failed. ret: %d (error: %s)", ret, nl_geterror(-ret));
+ netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "AccessDenied");
wifi_complete_netlink_scan(wifi, context);
return TRUE;
}