2 * hostapd / UNIX domain socket -based control interface
3 * Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
15 #include "utils/includes.h"
17 #ifndef CONFIG_NATIVE_WINDOWS
23 #include "utils/common.h"
24 #include "utils/eloop.h"
25 #include "common/ieee802_11_defs.h"
26 #include "drivers/driver.h"
27 #include "radius/radius_client.h"
28 #include "ap/hostapd.h"
29 #include "ap/ap_config.h"
30 #include "ap/ieee802_1x.h"
31 #include "ap/wpa_auth.h"
32 #include "ap/ieee802_11.h"
33 #include "ap/sta_info.h"
34 #include "ap/accounting.h"
35 #include "ap/wps_hostapd.h"
36 #include "ap/ctrl_iface_ap.h"
37 #include "wps/wps_defs.h"
39 #include "ctrl_iface.h"
43 struct wpa_ctrl_dst *next;
44 struct sockaddr_un addr;
51 static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
52 const char *buf, size_t len);
55 static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd,
56 struct sockaddr_un *from,
59 struct wpa_ctrl_dst *dst;
61 dst = os_zalloc(sizeof(*dst));
64 os_memcpy(&dst->addr, from, sizeof(struct sockaddr_un));
65 dst->addrlen = fromlen;
66 dst->debug_level = MSG_INFO;
67 dst->next = hapd->ctrl_dst;
69 wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor attached",
70 (u8 *) from->sun_path,
71 fromlen - offsetof(struct sockaddr_un, sun_path));
76 static int hostapd_ctrl_iface_detach(struct hostapd_data *hapd,
77 struct sockaddr_un *from,
80 struct wpa_ctrl_dst *dst, *prev = NULL;
84 if (fromlen == dst->addrlen &&
85 os_memcmp(from->sun_path, dst->addr.sun_path,
86 fromlen - offsetof(struct sockaddr_un, sun_path))
89 hapd->ctrl_dst = dst->next;
91 prev->next = dst->next;
93 wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor detached",
94 (u8 *) from->sun_path,
96 offsetof(struct sockaddr_un, sun_path));
106 static int hostapd_ctrl_iface_level(struct hostapd_data *hapd,
107 struct sockaddr_un *from,
111 struct wpa_ctrl_dst *dst;
113 wpa_printf(MSG_DEBUG, "CTRL_IFACE LEVEL %s", level);
115 dst = hapd->ctrl_dst;
117 if (fromlen == dst->addrlen &&
118 os_memcmp(from->sun_path, dst->addr.sun_path,
119 fromlen - offsetof(struct sockaddr_un, sun_path))
121 wpa_hexdump(MSG_DEBUG, "CTRL_IFACE changed monitor "
122 "level", (u8 *) from->sun_path, fromlen -
123 offsetof(struct sockaddr_un, sun_path));
124 dst->debug_level = atoi(level);
134 static int hostapd_ctrl_iface_new_sta(struct hostapd_data *hapd,
138 struct sta_info *sta;
140 wpa_printf(MSG_DEBUG, "CTRL_IFACE NEW_STA %s", txtaddr);
142 if (hwaddr_aton(txtaddr, addr))
145 sta = ap_get_sta(hapd, addr);
149 wpa_printf(MSG_DEBUG, "Add new STA " MACSTR " based on ctrl_iface "
150 "notification", MAC2STR(addr));
151 sta = ap_sta_add(hapd, addr);
155 hostapd_new_assoc_sta(hapd, sta, 0);
160 #ifdef CONFIG_P2P_MANAGER
161 static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
162 u8 minor_reason_code, const u8 *addr)
164 struct ieee80211_mgmt *mgmt;
168 if (hapd->driver->send_frame == NULL)
171 mgmt = os_zalloc(sizeof(*mgmt) + 100);
175 wpa_printf(MSG_DEBUG, "P2P: Disconnect STA " MACSTR " with minor "
176 "reason code %u (stype=%u)",
177 MAC2STR(addr), minor_reason_code, stype);
179 mgmt->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, stype);
180 os_memcpy(mgmt->da, addr, ETH_ALEN);
181 os_memcpy(mgmt->sa, hapd->own_addr, ETH_ALEN);
182 os_memcpy(mgmt->bssid, hapd->own_addr, ETH_ALEN);
183 if (stype == WLAN_FC_STYPE_DEAUTH) {
184 mgmt->u.deauth.reason_code =
185 host_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID);
186 pos = (u8 *) (&mgmt->u.deauth.reason_code + 1);
188 mgmt->u.disassoc.reason_code =
189 host_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID);
190 pos = (u8 *) (&mgmt->u.disassoc.reason_code + 1);
193 *pos++ = WLAN_EID_VENDOR_SPECIFIC;
195 WPA_PUT_BE24(pos, OUI_WFA);
197 *pos++ = P2P_OUI_TYPE;
199 *pos++ = P2P_ATTR_MINOR_REASON_CODE;
200 WPA_PUT_LE16(pos, 1);
202 *pos++ = minor_reason_code;
204 ret = hapd->driver->send_frame(hapd->drv_priv, (u8 *) mgmt,
205 pos - (u8 *) mgmt, 1);
208 return ret < 0 ? -1 : 0;
210 #endif /* CONFIG_P2P_MANAGER */
213 static int hostapd_ctrl_iface_deauthenticate(struct hostapd_data *hapd,
217 struct sta_info *sta;
220 wpa_printf(MSG_DEBUG, "CTRL_IFACE DEAUTHENTICATE %s", txtaddr);
222 if (hwaddr_aton(txtaddr, addr))
225 pos = os_strstr(txtaddr, " test=");
227 struct ieee80211_mgmt mgmt;
229 if (hapd->driver->send_frame == NULL)
233 os_memset(&mgmt, 0, sizeof(mgmt));
234 mgmt.frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
235 WLAN_FC_STYPE_DEAUTH);
236 os_memcpy(mgmt.da, addr, ETH_ALEN);
237 os_memcpy(mgmt.sa, hapd->own_addr, ETH_ALEN);
238 os_memcpy(mgmt.bssid, hapd->own_addr, ETH_ALEN);
239 mgmt.u.deauth.reason_code =
240 host_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID);
241 if (hapd->driver->send_frame(hapd->drv_priv, (u8 *) &mgmt,
243 sizeof(mgmt.u.deauth),
249 #ifdef CONFIG_P2P_MANAGER
250 pos = os_strstr(txtaddr, " p2p=");
252 return p2p_manager_disconnect(hapd, WLAN_FC_STYPE_DEAUTH,
253 atoi(pos + 5), addr);
255 #endif /* CONFIG_P2P_MANAGER */
257 hapd->drv.sta_deauth(hapd, addr, WLAN_REASON_PREV_AUTH_NOT_VALID);
258 sta = ap_get_sta(hapd, addr);
260 ap_sta_deauthenticate(hapd, sta,
261 WLAN_REASON_PREV_AUTH_NOT_VALID);
267 static int hostapd_ctrl_iface_disassociate(struct hostapd_data *hapd,
271 struct sta_info *sta;
274 wpa_printf(MSG_DEBUG, "CTRL_IFACE DISASSOCIATE %s", txtaddr);
276 if (hwaddr_aton(txtaddr, addr))
279 pos = os_strstr(txtaddr, " test=");
281 struct ieee80211_mgmt mgmt;
283 if (hapd->driver->send_frame == NULL)
287 os_memset(&mgmt, 0, sizeof(mgmt));
288 mgmt.frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
289 WLAN_FC_STYPE_DISASSOC);
290 os_memcpy(mgmt.da, addr, ETH_ALEN);
291 os_memcpy(mgmt.sa, hapd->own_addr, ETH_ALEN);
292 os_memcpy(mgmt.bssid, hapd->own_addr, ETH_ALEN);
293 mgmt.u.disassoc.reason_code =
294 host_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID);
295 if (hapd->driver->send_frame(hapd->drv_priv, (u8 *) &mgmt,
297 sizeof(mgmt.u.deauth),
303 #ifdef CONFIG_P2P_MANAGER
304 pos = os_strstr(txtaddr, " p2p=");
306 return p2p_manager_disconnect(hapd, WLAN_FC_STYPE_DISASSOC,
307 atoi(pos + 5), addr);
309 #endif /* CONFIG_P2P_MANAGER */
311 hapd->drv.sta_disassoc(hapd, addr, WLAN_REASON_PREV_AUTH_NOT_VALID);
312 sta = ap_get_sta(hapd, addr);
314 ap_sta_disassociate(hapd, sta,
315 WLAN_REASON_PREV_AUTH_NOT_VALID);
321 #ifdef CONFIG_IEEE80211W
323 static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd,
327 u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
329 wpa_printf(MSG_DEBUG, "CTRL_IFACE SA_QUERY %s", txtaddr);
331 if (hwaddr_aton(txtaddr, addr) ||
332 os_get_random(trans_id, WLAN_SA_QUERY_TR_ID_LEN) < 0)
335 ieee802_11_send_sa_query_req(hapd, addr, trans_id);
339 #endif /* NEED_AP_MLME */
340 #endif /* CONFIG_IEEE80211W */
344 static int hostapd_ctrl_iface_wps_pin(struct hostapd_data *hapd, char *txt)
346 char *pin = os_strchr(txt, ' ');
349 u8 addr_buf[ETH_ALEN], *addr = NULL;
356 timeout_txt = os_strchr(pin, ' ');
358 *timeout_txt++ = '\0';
359 timeout = atoi(timeout_txt);
360 pos = os_strchr(timeout_txt, ' ');
363 if (hwaddr_aton(pos, addr_buf) == 0)
369 return hostapd_wps_add_pin(hapd, addr, txt, pin, timeout);
373 static int hostapd_ctrl_iface_wps_check_pin(
374 struct hostapd_data *hapd, char *cmd, char *buf, size_t buflen)
381 wpa_hexdump_ascii_key(MSG_DEBUG, "WPS_CHECK_PIN",
382 (u8 *) cmd, os_strlen(cmd));
383 for (pos = cmd, len = 0; *pos != '\0'; pos++) {
384 if (*pos < '0' || *pos > '9')
388 wpa_printf(MSG_DEBUG, "WPS: Too long PIN");
392 if (len != 4 && len != 8) {
393 wpa_printf(MSG_DEBUG, "WPS: Invalid PIN length %d", (int) len);
399 unsigned int pin_val;
401 if (!wps_pin_valid(pin_val)) {
402 wpa_printf(MSG_DEBUG, "WPS: Invalid checksum digit");
403 ret = os_snprintf(buf, buflen, "FAIL-CHECKSUM\n");
404 if (ret < 0 || (size_t) ret >= buflen)
410 ret = os_snprintf(buf, buflen, "%s", pin);
411 if (ret < 0 || (size_t) ret >= buflen)
418 #ifdef CONFIG_WPS_OOB
419 static int hostapd_ctrl_iface_wps_oob(struct hostapd_data *hapd, char *txt)
421 char *path, *method, *name;
423 path = os_strchr(txt, ' ');
428 method = os_strchr(path, ' ');
433 name = os_strchr(method, ' ');
437 return hostapd_wps_start_oob(hapd, txt, path, method, name);
439 #endif /* CONFIG_WPS_OOB */
442 static int hostapd_ctrl_iface_wps_ap_pin(struct hostapd_data *hapd, char *txt,
443 char *buf, size_t buflen)
449 pos = os_strchr(txt, ' ');
453 if (os_strcmp(txt, "disable") == 0) {
454 hostapd_wps_ap_pin_disable(hapd);
455 return os_snprintf(buf, buflen, "OK\n");
458 if (os_strcmp(txt, "random") == 0) {
461 pin_txt = hostapd_wps_ap_pin_random(hapd, timeout);
464 return os_snprintf(buf, buflen, "%s", pin_txt);
467 if (os_strcmp(txt, "get") == 0) {
468 pin_txt = hostapd_wps_ap_pin_get(hapd);
471 return os_snprintf(buf, buflen, "%s", pin_txt);
474 if (os_strcmp(txt, "set") == 0) {
479 pos = os_strchr(pos, ' ');
484 if (os_strlen(pin) > buflen)
486 if (hostapd_wps_ap_pin_set(hapd, pin, timeout) < 0)
488 return os_snprintf(buf, buflen, "%s", pin);
493 #endif /* CONFIG_WPS */
496 static int hostapd_ctrl_iface_set(struct hostapd_data *wpa_s, char *cmd)
501 value = os_strchr(cmd, ' ');
506 wpa_printf(MSG_DEBUG, "CTRL_IFACE SET '%s'='%s'", cmd, value);
508 #ifdef CONFIG_WPS_TESTING
509 } else if (os_strcasecmp(cmd, "wps_version_number") == 0) {
511 val = strtol(value, NULL, 0);
512 if (val < 0 || val > 0xff) {
514 wpa_printf(MSG_DEBUG, "WPS: Invalid "
515 "wps_version_number %ld", val);
517 wps_version_number = val;
518 wpa_printf(MSG_DEBUG, "WPS: Testing - force WPS "
520 (wps_version_number & 0xf0) >> 4,
521 wps_version_number & 0x0f);
523 } else if (os_strcasecmp(cmd, "wps_testing_dummy_cred") == 0) {
524 wps_testing_dummy_cred = atoi(value);
525 wpa_printf(MSG_DEBUG, "WPS: Testing - dummy_cred=%d",
526 wps_testing_dummy_cred);
527 #endif /* CONFIG_WPS_TESTING */
536 static void hostapd_ctrl_iface_receive(int sock, void *eloop_ctx,
539 struct hostapd_data *hapd = eloop_ctx;
542 struct sockaddr_un from;
543 socklen_t fromlen = sizeof(from);
545 const int reply_size = 4096;
548 res = recvfrom(sock, buf, sizeof(buf) - 1, 0,
549 (struct sockaddr *) &from, &fromlen);
551 perror("recvfrom(ctrl_iface)");
555 wpa_hexdump_ascii(MSG_DEBUG, "RX ctrl_iface", (u8 *) buf, res);
557 reply = os_malloc(reply_size);
559 sendto(sock, "FAIL\n", 5, 0, (struct sockaddr *) &from,
564 os_memcpy(reply, "OK\n", 3);
567 if (os_strcmp(buf, "PING") == 0) {
568 os_memcpy(reply, "PONG\n", 5);
570 } else if (os_strcmp(buf, "MIB") == 0) {
571 reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
572 if (reply_len >= 0) {
573 res = wpa_get_mib(hapd->wpa_auth, reply + reply_len,
574 reply_size - reply_len);
580 if (reply_len >= 0) {
581 res = ieee802_1x_get_mib(hapd, reply + reply_len,
582 reply_size - reply_len);
588 #ifndef CONFIG_NO_RADIUS
589 if (reply_len >= 0) {
590 res = radius_client_get_mib(hapd->radius,
592 reply_size - reply_len);
598 #endif /* CONFIG_NO_RADIUS */
599 } else if (os_strcmp(buf, "STA-FIRST") == 0) {
600 reply_len = hostapd_ctrl_iface_sta_first(hapd, reply,
602 } else if (os_strncmp(buf, "STA ", 4) == 0) {
603 reply_len = hostapd_ctrl_iface_sta(hapd, buf + 4, reply,
605 } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
606 reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
608 } else if (os_strcmp(buf, "ATTACH") == 0) {
609 if (hostapd_ctrl_iface_attach(hapd, &from, fromlen))
611 } else if (os_strcmp(buf, "DETACH") == 0) {
612 if (hostapd_ctrl_iface_detach(hapd, &from, fromlen))
614 } else if (os_strncmp(buf, "LEVEL ", 6) == 0) {
615 if (hostapd_ctrl_iface_level(hapd, &from, fromlen,
618 } else if (os_strncmp(buf, "NEW_STA ", 8) == 0) {
619 if (hostapd_ctrl_iface_new_sta(hapd, buf + 8))
621 } else if (os_strncmp(buf, "DEAUTHENTICATE ", 15) == 0) {
622 if (hostapd_ctrl_iface_deauthenticate(hapd, buf + 15))
624 } else if (os_strncmp(buf, "DISASSOCIATE ", 13) == 0) {
625 if (hostapd_ctrl_iface_disassociate(hapd, buf + 13))
627 #ifdef CONFIG_IEEE80211W
629 } else if (os_strncmp(buf, "SA_QUERY ", 9) == 0) {
630 if (hostapd_ctrl_iface_sa_query(hapd, buf + 9))
632 #endif /* NEED_AP_MLME */
633 #endif /* CONFIG_IEEE80211W */
635 } else if (os_strncmp(buf, "WPS_PIN ", 8) == 0) {
636 if (hostapd_ctrl_iface_wps_pin(hapd, buf + 8))
638 } else if (os_strncmp(buf, "WPS_CHECK_PIN ", 14) == 0) {
639 reply_len = hostapd_ctrl_iface_wps_check_pin(
640 hapd, buf + 14, reply, reply_size);
641 } else if (os_strcmp(buf, "WPS_PBC") == 0) {
642 if (hostapd_wps_button_pushed(hapd))
644 #ifdef CONFIG_WPS_OOB
645 } else if (os_strncmp(buf, "WPS_OOB ", 8) == 0) {
646 if (hostapd_ctrl_iface_wps_oob(hapd, buf + 8))
648 #endif /* CONFIG_WPS_OOB */
649 } else if (os_strncmp(buf, "WPS_AP_PIN ", 11) == 0) {
650 reply_len = hostapd_ctrl_iface_wps_ap_pin(hapd, buf + 11,
652 #endif /* CONFIG_WPS */
653 } else if (os_strncmp(buf, "SET ", 4) == 0) {
654 if (hostapd_ctrl_iface_set(hapd, buf + 4))
657 os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
662 os_memcpy(reply, "FAIL\n", 5);
665 sendto(sock, reply, reply_len, 0, (struct sockaddr *) &from, fromlen);
670 static char * hostapd_ctrl_iface_path(struct hostapd_data *hapd)
675 if (hapd->conf->ctrl_interface == NULL)
678 len = os_strlen(hapd->conf->ctrl_interface) +
679 os_strlen(hapd->conf->iface) + 2;
680 buf = os_malloc(len);
684 os_snprintf(buf, len, "%s/%s",
685 hapd->conf->ctrl_interface, hapd->conf->iface);
691 static void hostapd_ctrl_iface_msg_cb(void *ctx, int level,
692 const char *txt, size_t len)
694 struct hostapd_data *hapd = ctx;
697 hostapd_ctrl_iface_send(hapd, level, txt, len);
701 int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
703 struct sockaddr_un addr;
707 hapd->ctrl_sock = -1;
709 if (hapd->conf->ctrl_interface == NULL)
712 if (mkdir(hapd->conf->ctrl_interface, S_IRWXU | S_IRWXG) < 0) {
713 if (errno == EEXIST) {
714 wpa_printf(MSG_DEBUG, "Using existing control "
715 "interface directory.");
717 perror("mkdir[ctrl_interface]");
722 if (hapd->conf->ctrl_interface_gid_set &&
723 chown(hapd->conf->ctrl_interface, 0,
724 hapd->conf->ctrl_interface_gid) < 0) {
725 perror("chown[ctrl_interface]");
729 if (os_strlen(hapd->conf->ctrl_interface) + 1 +
730 os_strlen(hapd->conf->iface) >= sizeof(addr.sun_path))
733 s = socket(PF_UNIX, SOCK_DGRAM, 0);
735 perror("socket(PF_UNIX)");
739 os_memset(&addr, 0, sizeof(addr));
741 addr.sun_len = sizeof(addr);
742 #endif /* __FreeBSD__ */
743 addr.sun_family = AF_UNIX;
744 fname = hostapd_ctrl_iface_path(hapd);
747 os_strlcpy(addr.sun_path, fname, sizeof(addr.sun_path));
748 if (bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
749 wpa_printf(MSG_DEBUG, "ctrl_iface bind(PF_UNIX) failed: %s",
751 if (connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
752 wpa_printf(MSG_DEBUG, "ctrl_iface exists, but does not"
753 " allow connections - assuming it was left"
754 "over from forced program termination");
755 if (unlink(fname) < 0) {
756 perror("unlink[ctrl_iface]");
757 wpa_printf(MSG_ERROR, "Could not unlink "
758 "existing ctrl_iface socket '%s'",
762 if (bind(s, (struct sockaddr *) &addr, sizeof(addr)) <
764 perror("bind(PF_UNIX)");
767 wpa_printf(MSG_DEBUG, "Successfully replaced leftover "
768 "ctrl_iface socket '%s'", fname);
770 wpa_printf(MSG_INFO, "ctrl_iface exists and seems to "
771 "be in use - cannot override it");
772 wpa_printf(MSG_INFO, "Delete '%s' manually if it is "
773 "not used anymore", fname);
780 if (hapd->conf->ctrl_interface_gid_set &&
781 chown(fname, 0, hapd->conf->ctrl_interface_gid) < 0) {
782 perror("chown[ctrl_interface/ifname]");
786 if (chmod(fname, S_IRWXU | S_IRWXG) < 0) {
787 perror("chmod[ctrl_interface/ifname]");
793 eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd,
795 hapd->msg_ctx = hapd;
796 wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb);
811 void hostapd_ctrl_iface_deinit(struct hostapd_data *hapd)
813 struct wpa_ctrl_dst *dst, *prev;
815 if (hapd->ctrl_sock > -1) {
817 eloop_unregister_read_sock(hapd->ctrl_sock);
818 close(hapd->ctrl_sock);
819 hapd->ctrl_sock = -1;
820 fname = hostapd_ctrl_iface_path(hapd);
825 if (hapd->conf->ctrl_interface &&
826 rmdir(hapd->conf->ctrl_interface) < 0) {
827 if (errno == ENOTEMPTY) {
828 wpa_printf(MSG_DEBUG, "Control interface "
829 "directory not empty - leaving it "
832 perror("rmdir[ctrl_interface]");
837 dst = hapd->ctrl_dst;
846 static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
847 const char *buf, size_t len)
849 struct wpa_ctrl_dst *dst, *next;
855 dst = hapd->ctrl_dst;
856 if (hapd->ctrl_sock < 0 || dst == NULL)
859 os_snprintf(levelstr, sizeof(levelstr), "<%d>", level);
860 io[0].iov_base = levelstr;
861 io[0].iov_len = os_strlen(levelstr);
862 io[1].iov_base = (char *) buf;
864 os_memset(&msg, 0, sizeof(msg));
871 if (level >= dst->debug_level) {
872 wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor send",
873 (u8 *) dst->addr.sun_path, dst->addrlen -
874 offsetof(struct sockaddr_un, sun_path));
875 msg.msg_name = &dst->addr;
876 msg.msg_namelen = dst->addrlen;
877 if (sendmsg(hapd->ctrl_sock, &msg, 0) < 0) {
879 wpa_printf(MSG_INFO, "CTRL_IFACE monitor[%d]: "
881 idx, errno, strerror(errno));
883 if (dst->errors > 10 || _errno == ENOENT) {
884 hostapd_ctrl_iface_detach(
896 #endif /* CONFIG_NATIVE_WINDOWS */