ap_drv_ops.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. /*
  2. * hostapd - Driver operations
  3. * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
  4. *
  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.
  8. *
  9. * Alternatively, this software may be distributed under the terms of BSD
  10. * license.
  11. *
  12. * See README and COPYING for more details.
  13. */
  14. #include "utils/includes.h"
  15. #include "utils/common.h"
  16. #include "drivers/driver.h"
  17. #include "hostapd.h"
  18. #include "ieee802_11.h"
  19. #include "sta_info.h"
  20. #include "ap_config.h"
  21. #include "ap_drv_ops.h"
  22. static int hostapd_sta_flags_to_drv(int flags)
  23. {
  24. int res = 0;
  25. if (flags & WLAN_STA_AUTHORIZED)
  26. res |= WPA_STA_AUTHORIZED;
  27. if (flags & WLAN_STA_WMM)
  28. res |= WPA_STA_WMM;
  29. if (flags & WLAN_STA_SHORT_PREAMBLE)
  30. res |= WPA_STA_SHORT_PREAMBLE;
  31. if (flags & WLAN_STA_MFP)
  32. res |= WPA_STA_MFP;
  33. return res;
  34. }
  35. static int hostapd_set_ap_wps_ie(struct hostapd_data *hapd,
  36. const struct wpabuf *beacon,
  37. const struct wpabuf *proberesp)
  38. {
  39. if (hapd->driver == NULL || hapd->driver->set_ap_wps_ie == NULL)
  40. return 0;
  41. return hapd->driver->set_ap_wps_ie(hapd->drv_priv, beacon, proberesp);
  42. }
  43. static int hostapd_send_mgmt_frame(struct hostapd_data *hapd, const void *msg,
  44. size_t len)
  45. {
  46. if (hapd->driver == NULL || hapd->driver->send_mlme == NULL)
  47. return 0;
  48. return hapd->driver->send_mlme(hapd->drv_priv, msg, len);
  49. }
  50. static int hostapd_send_eapol(struct hostapd_data *hapd, const u8 *addr,
  51. const u8 *data, size_t data_len, int encrypt)
  52. {
  53. if (hapd->driver == NULL || hapd->driver->hapd_send_eapol == NULL)
  54. return 0;
  55. return hapd->driver->hapd_send_eapol(hapd->drv_priv, addr, data,
  56. data_len, encrypt,
  57. hapd->own_addr);
  58. }
  59. static int hostapd_set_authorized(struct hostapd_data *hapd,
  60. struct sta_info *sta, int authorized)
  61. {
  62. if (authorized) {
  63. return hostapd_sta_set_flags(hapd, sta->addr,
  64. hostapd_sta_flags_to_drv(
  65. sta->flags),
  66. WPA_STA_AUTHORIZED, ~0);
  67. }
  68. return hostapd_sta_set_flags(hapd, sta->addr,
  69. hostapd_sta_flags_to_drv(sta->flags),
  70. 0, ~WPA_STA_AUTHORIZED);
  71. }
  72. static int hostapd_set_key(const char *ifname, struct hostapd_data *hapd,
  73. enum wpa_alg alg, const u8 *addr, int key_idx,
  74. int set_tx, const u8 *seq, size_t seq_len,
  75. const u8 *key, size_t key_len)
  76. {
  77. if (hapd->driver == NULL || hapd->driver->set_key == NULL)
  78. return 0;
  79. return hapd->driver->set_key(ifname, hapd->drv_priv, alg, addr,
  80. key_idx, set_tx, seq, seq_len, key,
  81. key_len);
  82. }
  83. static int hostapd_read_sta_data(struct hostapd_data *hapd,
  84. struct hostap_sta_driver_data *data,
  85. const u8 *addr)
  86. {
  87. if (hapd->driver == NULL || hapd->driver->read_sta_data == NULL)
  88. return -1;
  89. return hapd->driver->read_sta_data(hapd->drv_priv, data, addr);
  90. }
  91. static int hostapd_sta_clear_stats(struct hostapd_data *hapd, const u8 *addr)
  92. {
  93. if (hapd->driver == NULL || hapd->driver->sta_clear_stats == NULL)
  94. return 0;
  95. return hapd->driver->sta_clear_stats(hapd->drv_priv, addr);
  96. }
  97. static int hostapd_set_sta_flags(struct hostapd_data *hapd,
  98. struct sta_info *sta)
  99. {
  100. int set_flags, total_flags, flags_and, flags_or;
  101. total_flags = hostapd_sta_flags_to_drv(sta->flags);
  102. set_flags = WPA_STA_SHORT_PREAMBLE | WPA_STA_WMM | WPA_STA_MFP;
  103. if (!hapd->conf->ieee802_1x && !hapd->conf->wpa &&
  104. sta->flags & WLAN_STA_AUTHORIZED)
  105. set_flags |= WPA_STA_AUTHORIZED;
  106. flags_or = total_flags & set_flags;
  107. flags_and = total_flags | ~set_flags;
  108. return hostapd_sta_set_flags(hapd, sta->addr, total_flags,
  109. flags_or, flags_and);
  110. }
  111. static int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd,
  112. const char *ifname, int enabled)
  113. {
  114. struct wpa_bss_params params;
  115. os_memset(&params, 0, sizeof(params));
  116. params.ifname = ifname;
  117. params.enabled = enabled;
  118. if (enabled) {
  119. params.wpa = hapd->conf->wpa;
  120. params.ieee802_1x = hapd->conf->ieee802_1x;
  121. params.wpa_group = hapd->conf->wpa_group;
  122. params.wpa_pairwise = hapd->conf->wpa_pairwise;
  123. params.wpa_key_mgmt = hapd->conf->wpa_key_mgmt;
  124. params.rsn_preauth = hapd->conf->rsn_preauth;
  125. }
  126. return hostapd_set_ieee8021x(hapd, &params);
  127. }
  128. static int hostapd_set_radius_acl_auth(struct hostapd_data *hapd,
  129. const u8 *mac, int accepted,
  130. u32 session_timeout)
  131. {
  132. if (hapd->driver == NULL || hapd->driver->set_radius_acl_auth == NULL)
  133. return 0;
  134. return hapd->driver->set_radius_acl_auth(hapd->drv_priv, mac, accepted,
  135. session_timeout);
  136. }
  137. static int hostapd_set_radius_acl_expire(struct hostapd_data *hapd,
  138. const u8 *mac)
  139. {
  140. if (hapd->driver == NULL ||
  141. hapd->driver->set_radius_acl_expire == NULL)
  142. return 0;
  143. return hapd->driver->set_radius_acl_expire(hapd->drv_priv, mac);
  144. }
  145. static int hostapd_set_bss_params(struct hostapd_data *hapd,
  146. int use_protection)
  147. {
  148. int ret = 0;
  149. int preamble;
  150. #ifdef CONFIG_IEEE80211N
  151. u8 buf[60], *ht_capab, *ht_oper, *pos;
  152. pos = buf;
  153. ht_capab = pos;
  154. pos = hostapd_eid_ht_capabilities(hapd, pos);
  155. ht_oper = pos;
  156. pos = hostapd_eid_ht_operation(hapd, pos);
  157. if (pos > ht_oper && ht_oper > ht_capab &&
  158. hostapd_set_ht_params(hapd, ht_capab + 2, ht_capab[1],
  159. ht_oper + 2, ht_oper[1])) {
  160. wpa_printf(MSG_ERROR, "Could not set HT capabilities "
  161. "for kernel driver");
  162. ret = -1;
  163. }
  164. #endif /* CONFIG_IEEE80211N */
  165. if (hostapd_set_cts_protect(hapd, use_protection)) {
  166. wpa_printf(MSG_ERROR, "Failed to set CTS protect in kernel "
  167. "driver");
  168. ret = -1;
  169. }
  170. if (hapd->iface->current_mode &&
  171. hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G &&
  172. hostapd_set_short_slot_time(hapd,
  173. hapd->iface->num_sta_no_short_slot_time
  174. > 0 ? 0 : 1)) {
  175. wpa_printf(MSG_ERROR, "Failed to set Short Slot Time option "
  176. "in kernel driver");
  177. ret = -1;
  178. }
  179. if (hapd->iface->num_sta_no_short_preamble == 0 &&
  180. hapd->iconf->preamble == SHORT_PREAMBLE)
  181. preamble = SHORT_PREAMBLE;
  182. else
  183. preamble = LONG_PREAMBLE;
  184. if (hostapd_set_preamble(hapd, preamble)) {
  185. wpa_printf(MSG_ERROR, "Could not set preamble for kernel "
  186. "driver");
  187. ret = -1;
  188. }
  189. return ret;
  190. }
  191. static int hostapd_set_beacon(struct hostapd_data *hapd,
  192. const u8 *head, size_t head_len,
  193. const u8 *tail, size_t tail_len, int dtim_period,
  194. int beacon_int)
  195. {
  196. if (hapd->driver == NULL || hapd->driver->set_beacon == NULL)
  197. return 0;
  198. return hapd->driver->set_beacon(hapd->drv_priv,
  199. head, head_len, tail, tail_len,
  200. dtim_period, beacon_int);
  201. }
  202. static int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname)
  203. {
  204. return hostapd_if_add(hapd, WPA_IF_AP_VLAN, ifname, NULL, NULL, NULL);
  205. }
  206. static int hostapd_vlan_if_remove(struct hostapd_data *hapd,
  207. const char *ifname)
  208. {
  209. return hostapd_if_remove(hapd, WPA_IF_AP_VLAN, ifname);
  210. }
  211. static int hostapd_set_wds_sta(struct hostapd_data *hapd, const u8 *addr,
  212. int aid, int val)
  213. {
  214. if (hapd->driver == NULL || hapd->driver->set_wds_sta == NULL)
  215. return 0;
  216. return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val);
  217. }
  218. static int hostapd_set_sta_vlan(const char *ifname, struct hostapd_data *hapd,
  219. const u8 *addr, int vlan_id)
  220. {
  221. if (hapd->driver == NULL || hapd->driver->set_sta_vlan == NULL)
  222. return 0;
  223. return hapd->driver->set_sta_vlan(hapd->drv_priv, addr, ifname,
  224. vlan_id);
  225. }
  226. static int hostapd_get_inact_sec(struct hostapd_data *hapd, const u8 *addr)
  227. {
  228. if (hapd->driver == NULL || hapd->driver->get_inact_sec == NULL)
  229. return 0;
  230. return hapd->driver->get_inact_sec(hapd->drv_priv, addr);
  231. }
  232. static int hostapd_sta_deauth(struct hostapd_data *hapd, const u8 *addr,
  233. int reason)
  234. {
  235. if (hapd->driver == NULL || hapd->driver->sta_deauth == NULL)
  236. return 0;
  237. return hapd->driver->sta_deauth(hapd->drv_priv, hapd->own_addr, addr,
  238. reason);
  239. }
  240. static int hostapd_sta_disassoc(struct hostapd_data *hapd, const u8 *addr,
  241. int reason)
  242. {
  243. if (hapd->driver == NULL || hapd->driver->sta_disassoc == NULL)
  244. return 0;
  245. return hapd->driver->sta_disassoc(hapd->drv_priv, hapd->own_addr, addr,
  246. reason);
  247. }
  248. static int hostapd_sta_add(struct hostapd_data *hapd,
  249. const u8 *addr, u16 aid, u16 capability,
  250. const u8 *supp_rates, size_t supp_rates_len,
  251. u16 listen_interval,
  252. const struct ieee80211_ht_capabilities *ht_capab)
  253. {
  254. struct hostapd_sta_add_params params;
  255. if (hapd->driver == NULL)
  256. return 0;
  257. if (hapd->driver->sta_add == NULL)
  258. return 0;
  259. os_memset(&params, 0, sizeof(params));
  260. params.addr = addr;
  261. params.aid = aid;
  262. params.capability = capability;
  263. params.supp_rates = supp_rates;
  264. params.supp_rates_len = supp_rates_len;
  265. params.listen_interval = listen_interval;
  266. params.ht_capabilities = ht_capab;
  267. return hapd->driver->sta_add(hapd->drv_priv, &params);
  268. }
  269. static int hostapd_sta_remove(struct hostapd_data *hapd, const u8 *addr)
  270. {
  271. if (hapd->driver == NULL || hapd->driver->sta_remove == NULL)
  272. return 0;
  273. return hapd->driver->sta_remove(hapd->drv_priv, addr);
  274. }
  275. static int hostapd_set_countermeasures(struct hostapd_data *hapd, int enabled)
  276. {
  277. if (hapd->driver == NULL ||
  278. hapd->driver->hapd_set_countermeasures == NULL)
  279. return 0;
  280. return hapd->driver->hapd_set_countermeasures(hapd->drv_priv, enabled);
  281. }
  282. void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
  283. {
  284. ops->set_ap_wps_ie = hostapd_set_ap_wps_ie;
  285. ops->send_mgmt_frame = hostapd_send_mgmt_frame;
  286. ops->send_eapol = hostapd_send_eapol;
  287. ops->set_authorized = hostapd_set_authorized;
  288. ops->set_key = hostapd_set_key;
  289. ops->read_sta_data = hostapd_read_sta_data;
  290. ops->sta_clear_stats = hostapd_sta_clear_stats;
  291. ops->set_sta_flags = hostapd_set_sta_flags;
  292. ops->set_drv_ieee8021x = hostapd_set_drv_ieee8021x;
  293. ops->set_radius_acl_auth = hostapd_set_radius_acl_auth;
  294. ops->set_radius_acl_expire = hostapd_set_radius_acl_expire;
  295. ops->set_bss_params = hostapd_set_bss_params;
  296. ops->set_beacon = hostapd_set_beacon;
  297. ops->vlan_if_add = hostapd_vlan_if_add;
  298. ops->vlan_if_remove = hostapd_vlan_if_remove;
  299. ops->set_wds_sta = hostapd_set_wds_sta;
  300. ops->set_sta_vlan = hostapd_set_sta_vlan;
  301. ops->get_inact_sec = hostapd_get_inact_sec;
  302. ops->sta_deauth = hostapd_sta_deauth;
  303. ops->sta_disassoc = hostapd_sta_disassoc;
  304. ops->sta_add = hostapd_sta_add;
  305. ops->sta_remove = hostapd_sta_remove;
  306. ops->set_countermeasures = hostapd_set_countermeasures;
  307. }
  308. int hostapd_set_privacy(struct hostapd_data *hapd, int enabled)
  309. {
  310. if (hapd->driver == NULL || hapd->driver->set_privacy == NULL)
  311. return 0;
  312. return hapd->driver->set_privacy(hapd->drv_priv, enabled);
  313. }
  314. int hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
  315. size_t elem_len)
  316. {
  317. if (hapd->driver == NULL || hapd->driver->set_generic_elem == NULL)
  318. return 0;
  319. return hapd->driver->set_generic_elem(hapd->drv_priv, elem, elem_len);
  320. }
  321. int hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len)
  322. {
  323. if (hapd->driver == NULL || hapd->driver->hapd_get_ssid == NULL)
  324. return 0;
  325. return hapd->driver->hapd_get_ssid(hapd->drv_priv, buf, len);
  326. }
  327. int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len)
  328. {
  329. if (hapd->driver == NULL || hapd->driver->hapd_set_ssid == NULL)
  330. return 0;
  331. return hapd->driver->hapd_set_ssid(hapd->drv_priv, buf, len);
  332. }
  333. int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
  334. const char *ifname, const u8 *addr, void *bss_ctx,
  335. void **drv_priv)
  336. {
  337. if (hapd->driver == NULL || hapd->driver->if_add == NULL)
  338. return -1;
  339. return hapd->driver->if_add(hapd->drv_priv, type, ifname, addr,
  340. bss_ctx, drv_priv);
  341. }
  342. int hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type,
  343. const char *ifname)
  344. {
  345. if (hapd->driver == NULL || hapd->driver->if_remove == NULL)
  346. return -1;
  347. return hapd->driver->if_remove(hapd->drv_priv, type, ifname);
  348. }
  349. int hostapd_set_ieee8021x(struct hostapd_data *hapd,
  350. struct wpa_bss_params *params)
  351. {
  352. if (hapd->driver == NULL || hapd->driver->set_ieee8021x == NULL)
  353. return 0;
  354. return hapd->driver->set_ieee8021x(hapd->drv_priv, params);
  355. }
  356. int hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
  357. const u8 *addr, int idx, u8 *seq)
  358. {
  359. if (hapd->driver == NULL || hapd->driver->get_seqnum == NULL)
  360. return 0;
  361. return hapd->driver->get_seqnum(ifname, hapd->drv_priv, addr, idx,
  362. seq);
  363. }
  364. int hostapd_flush(struct hostapd_data *hapd)
  365. {
  366. if (hapd->driver == NULL || hapd->driver->flush == NULL)
  367. return 0;
  368. return hapd->driver->flush(hapd->drv_priv);
  369. }
  370. int hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq,
  371. int channel, int ht_enabled, int sec_channel_offset)
  372. {
  373. struct hostapd_freq_params data;
  374. if (hapd->driver == NULL)
  375. return 0;
  376. if (hapd->driver->set_freq == NULL)
  377. return 0;
  378. os_memset(&data, 0, sizeof(data));
  379. data.mode = mode;
  380. data.freq = freq;
  381. data.channel = channel;
  382. data.ht_enabled = ht_enabled;
  383. data.sec_channel_offset = sec_channel_offset;
  384. return hapd->driver->set_freq(hapd->drv_priv, &data);
  385. }
  386. int hostapd_set_rts(struct hostapd_data *hapd, int rts)
  387. {
  388. if (hapd->driver == NULL || hapd->driver->set_rts == NULL)
  389. return 0;
  390. return hapd->driver->set_rts(hapd->drv_priv, rts);
  391. }
  392. int hostapd_set_frag(struct hostapd_data *hapd, int frag)
  393. {
  394. if (hapd->driver == NULL || hapd->driver->set_frag == NULL)
  395. return 0;
  396. return hapd->driver->set_frag(hapd->drv_priv, frag);
  397. }
  398. int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
  399. int total_flags, int flags_or, int flags_and)
  400. {
  401. if (hapd->driver == NULL || hapd->driver->sta_set_flags == NULL)
  402. return 0;
  403. return hapd->driver->sta_set_flags(hapd->drv_priv, addr, total_flags,
  404. flags_or, flags_and);
  405. }
  406. int hostapd_set_rate_sets(struct hostapd_data *hapd, int *supp_rates,
  407. int *basic_rates, int mode)
  408. {
  409. if (hapd->driver == NULL || hapd->driver->set_rate_sets == NULL)
  410. return 0;
  411. return hapd->driver->set_rate_sets(hapd->drv_priv, supp_rates,
  412. basic_rates, mode);
  413. }
  414. int hostapd_set_country(struct hostapd_data *hapd, const char *country)
  415. {
  416. if (hapd->driver == NULL ||
  417. hapd->driver->set_country == NULL)
  418. return 0;
  419. return hapd->driver->set_country(hapd->drv_priv, country);
  420. }
  421. int hostapd_set_cts_protect(struct hostapd_data *hapd, int value)
  422. {
  423. if (hapd->driver == NULL || hapd->driver->set_cts_protect == NULL)
  424. return 0;
  425. return hapd->driver->set_cts_protect(hapd->drv_priv, value);
  426. }
  427. int hostapd_set_preamble(struct hostapd_data *hapd, int value)
  428. {
  429. if (hapd->driver == NULL || hapd->driver->set_preamble == NULL)
  430. return 0;
  431. return hapd->driver->set_preamble(hapd->drv_priv, value);
  432. }
  433. int hostapd_set_short_slot_time(struct hostapd_data *hapd, int value)
  434. {
  435. if (hapd->driver == NULL || hapd->driver->set_short_slot_time == NULL)
  436. return 0;
  437. return hapd->driver->set_short_slot_time(hapd->drv_priv, value);
  438. }
  439. int hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
  440. int cw_min, int cw_max, int burst_time)
  441. {
  442. if (hapd->driver == NULL || hapd->driver->set_tx_queue_params == NULL)
  443. return 0;
  444. return hapd->driver->set_tx_queue_params(hapd->drv_priv, queue, aifs,
  445. cw_min, cw_max, burst_time);
  446. }
  447. int hostapd_valid_bss_mask(struct hostapd_data *hapd, const u8 *addr,
  448. const u8 *mask)
  449. {
  450. if (hapd->driver == NULL || hapd->driver->valid_bss_mask == NULL)
  451. return 1;
  452. return hapd->driver->valid_bss_mask(hapd->drv_priv, addr, mask);
  453. }
  454. struct hostapd_hw_modes *
  455. hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
  456. u16 *flags)
  457. {
  458. if (hapd->driver == NULL ||
  459. hapd->driver->get_hw_feature_data == NULL)
  460. return NULL;
  461. return hapd->driver->get_hw_feature_data(hapd->drv_priv, num_modes,
  462. flags);
  463. }
  464. int hostapd_driver_commit(struct hostapd_data *hapd)
  465. {
  466. if (hapd->driver == NULL || hapd->driver->commit == NULL)
  467. return 0;
  468. return hapd->driver->commit(hapd->drv_priv);
  469. }
  470. int hostapd_set_ht_params(struct hostapd_data *hapd,
  471. const u8 *ht_capab, size_t ht_capab_len,
  472. const u8 *ht_oper, size_t ht_oper_len)
  473. {
  474. if (hapd->driver == NULL || hapd->driver->set_ht_params == NULL ||
  475. ht_capab == NULL || ht_oper == NULL)
  476. return 0;
  477. return hapd->driver->set_ht_params(hapd->drv_priv,
  478. ht_capab, ht_capab_len,
  479. ht_oper, ht_oper_len);
  480. }
  481. int hostapd_drv_none(struct hostapd_data *hapd)
  482. {
  483. return hapd->driver && os_strcmp(hapd->driver->name, "none") == 0;
  484. }
  485. int hostapd_driver_scan(struct hostapd_data *hapd,
  486. struct wpa_driver_scan_params *params)
  487. {
  488. if (hapd->driver && hapd->driver->scan2)
  489. return hapd->driver->scan2(hapd->drv_priv, params);
  490. return -1;
  491. }
  492. struct wpa_scan_results * hostapd_driver_get_scan_results(
  493. struct hostapd_data *hapd)
  494. {
  495. if (hapd->driver && hapd->driver->get_scan_results2)
  496. return hapd->driver->get_scan_results2(hapd->drv_priv);
  497. return NULL;
  498. }