1 /* 2 * wpa_supplicant - Internal definitions 3 * Copyright (c) 2003-2007, 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 15 #ifndef WPA_SUPPLICANT_I_H 16 #define WPA_SUPPLICANT_I_H 17 18 #include "drivers/driver.h" 19 20 extern const char *wpa_supplicant_version; 21 extern const char *wpa_supplicant_license; 22 #ifndef CONFIG_NO_STDOUT_DEBUG 23 extern const char *wpa_supplicant_full_license1; 24 extern const char *wpa_supplicant_full_license2; 25 extern const char *wpa_supplicant_full_license3; 26 extern const char *wpa_supplicant_full_license4; 27 extern const char *wpa_supplicant_full_license5; 28 #endif /* CONFIG_NO_STDOUT_DEBUG */ 29 30 extern struct wpa_driver_ops *wpa_supplicant_drivers[]; 31 32 33 struct wpa_scan_result; 34 struct wpa_sm; 35 struct wpa_supplicant; 36 37 /* 38 * Forward declarations of private structures used within the ctrl_iface 39 * backends. Other parts of wpa_supplicant do not have access to data stored in 40 * these structures. 41 */ 42 struct ctrl_iface_priv; 43 struct ctrl_iface_global_priv; 44 struct ctrl_iface_dbus_priv; 45 46 /** 47 * struct wpa_interface - Parameters for wpa_supplicant_add_iface() 48 */ 49 struct wpa_interface { 50 /** 51 * confname - Configuration name (file or profile) name 52 * 53 * This can also be %NULL when a configuration file is not used. In 54 * that case, ctrl_interface must be set to allow the interface to be 55 * configured. 56 */ 57 const char *confname; 58 59 /** 60 * ctrl_interface - Control interface parameter 61 * 62 * If a configuration file is not used, this variable can be used to 63 * set the ctrl_interface parameter that would have otherwise been read 64 * from the configuration file. If both confname and ctrl_interface are 65 * set, ctrl_interface is used to override the value from configuration 66 * file. 67 */ 68 const char *ctrl_interface; 69 70 /** 71 * driver - Driver interface name, or %NULL to use the default driver 72 */ 73 const char *driver; 74 75 /** 76 * driver_param - Driver interface parameters 77 * 78 * If a configuration file is not used, this variable can be used to 79 * set the driver_param parameters that would have otherwise been read 80 * from the configuration file. If both confname and driver_param are 81 * set, driver_param is used to override the value from configuration 82 * file. 83 */ 84 const char *driver_param; 85 86 /** 87 * ifname - Interface name 88 */ 89 const char *ifname; 90 91 /** 92 * bridge_ifname - Optional bridge interface name 93 * 94 * If the driver interface (ifname) is included in a Linux bridge 95 * device, the bridge interface may need to be used for receiving EAPOL 96 * frames. This can be enabled by setting this variable to enable 97 * receiving of EAPOL frames from an additional interface. 98 */ 99 const char *bridge_ifname; 100 }; 101 102 /** 103 * struct wpa_params - Parameters for wpa_supplicant_init() 104 */ 105 struct wpa_params { 106 /** 107 * daemonize - Run %wpa_supplicant in the background 108 */ 109 int daemonize; 110 111 /** 112 * wait_for_monitor - Wait for a monitor program before starting 113 */ 114 int wait_for_monitor; 115 116 /** 117 * pid_file - Path to a PID (process ID) file 118 * 119 * If this and daemonize are set, process ID of the background process 120 * will be written to the specified file. 121 */ 122 char *pid_file; 123 124 /** 125 * wpa_debug_level - Debugging verbosity level (e.g., MSG_INFO) 126 */ 127 int wpa_debug_level; 128 129 /** 130 * wpa_debug_show_keys - Whether keying material is included in debug 131 * 132 * This parameter can be used to allow keying material to be included 133 * in debug messages. This is a security risk and this option should 134 * not be enabled in normal configuration. If needed during 135 * development or while troubleshooting, this option can provide more 136 * details for figuring out what is happening. 137 */ 138 int wpa_debug_show_keys; 139 140 /** 141 * wpa_debug_timestamp - Whether to include timestamp in debug messages 142 */ 143 int wpa_debug_timestamp; 144 145 /** 146 * ctrl_interface - Global ctrl_iface path/parameter 147 */ 148 char *ctrl_interface; 149 150 /** 151 * dbus_ctrl_interface - Enable the DBus control interface 152 */ 153 int dbus_ctrl_interface; 154 155 /** 156 * wpa_debug_file_path - Path of debug file or %NULL to use stdout 157 */ 158 const char *wpa_debug_file_path; 159 160 /** 161 * wpa_debug_syslog - Enable log output through syslog 162 */ 163 const char *wpa_debug_syslog; 164 }; 165 166 /** 167 * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces 168 * 169 * This structure is initialized by calling wpa_supplicant_init() when starting 170 * %wpa_supplicant. 171 */ 172 struct wpa_global { 173 struct wpa_supplicant *ifaces; 174 struct wpa_params params; 175 struct ctrl_iface_global_priv *ctrl_iface; 176 struct ctrl_iface_dbus_priv *dbus_ctrl_iface; 177 void **drv_priv; 178 size_t drv_count; 179 }; 180 181 182 struct wpa_client_mlme { 183 #ifdef CONFIG_CLIENT_MLME 184 enum { 185 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE, 186 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED, 187 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED 188 } state; 189 u8 prev_bssid[ETH_ALEN]; 190 u8 ssid[32]; 191 size_t ssid_len; 192 u16 aid; 193 u16 ap_capab, capab; 194 u8 *extra_ie; /* to be added to the end of AssocReq */ 195 size_t extra_ie_len; 196 u8 *extra_probe_ie; /* to be added to the end of ProbeReq */ 197 size_t extra_probe_ie_len; 198 wpa_key_mgmt key_mgmt; 199 200 /* The last AssocReq/Resp IEs */ 201 u8 *assocreq_ies, *assocresp_ies; 202 size_t assocreq_ies_len, assocresp_ies_len; 203 204 int auth_tries, assoc_tries; 205 206 unsigned int ssid_set:1; 207 unsigned int bssid_set:1; 208 unsigned int prev_bssid_set:1; 209 unsigned int authenticated:1; 210 unsigned int associated:1; 211 unsigned int probereq_poll:1; 212 unsigned int use_protection:1; 213 unsigned int create_ibss:1; 214 unsigned int mixed_cell:1; 215 unsigned int wmm_enabled:1; 216 217 struct os_time last_probe; 218 219 #define IEEE80211_AUTH_ALG_OPEN BIT(0) 220 #define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1) 221 #define IEEE80211_AUTH_ALG_LEAP BIT(2) 222 unsigned int auth_algs; /* bitfield of allowed auth algs */ 223 int auth_alg; /* currently used IEEE 802.11 authentication algorithm */ 224 int auth_transaction; 225 226 struct os_time ibss_join_req; 227 u8 *probe_resp; /* ProbeResp template for IBSS */ 228 size_t probe_resp_len; 229 u32 supp_rates_bits; 230 231 int wmm_last_param_set; 232 233 int sta_scanning; 234 int scan_hw_mode_idx; 235 int scan_channel_idx; 236 enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state; 237 struct os_time last_scan_completed; 238 int scan_oper_channel; 239 int scan_oper_freq; 240 int scan_oper_phymode; 241 u8 scan_ssid[32]; 242 size_t scan_ssid_len; 243 int scan_skip_11b; 244 245 struct ieee80211_sta_bss *sta_bss_list; 246 #define STA_HASH_SIZE 256 247 #define STA_HASH(sta) (sta[5]) 248 struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE]; 249 250 int cts_protect_erp_frames; 251 252 int phymode; /* current mode; WPA_MODE_IEEE80211A, .. */ 253 struct wpa_hw_modes *modes; 254 size_t num_modes; 255 unsigned int hw_modes; /* bitfield of allowed hardware modes; 256 * (1 << MODE_*) */ 257 int num_curr_rates; 258 struct wpa_rate_data *curr_rates; 259 int freq; /* The current frequency in MHz */ 260 int channel; /* The current IEEE 802.11 channel number */ 261 262 #ifdef CONFIG_IEEE80211R 263 u8 current_md[6]; 264 u8 *ft_ies; 265 size_t ft_ies_len; 266 #endif /* CONFIG_IEEE80211R */ 267 268 #else /* CONFIG_CLIENT_MLME */ 269 int dummy; /* to keep MSVC happy */ 270 #endif /* CONFIG_CLIENT_MLME */ 271 }; 272 273 /** 274 * struct wpa_supplicant - Internal data for wpa_supplicant interface 275 * 276 * This structure contains the internal data for core wpa_supplicant code. This 277 * should be only used directly from the core code. However, a pointer to this 278 * data is used from other files as an arbitrary context pointer in calls to 279 * core functions. 280 */ 281 struct wpa_supplicant { 282 struct wpa_global *global; 283 struct wpa_supplicant *next; 284 struct l2_packet_data *l2; 285 struct l2_packet_data *l2_br; 286 unsigned char own_addr[ETH_ALEN]; 287 char ifname[100]; 288 #ifdef CONFIG_CTRL_IFACE_DBUS 289 char *dbus_path; 290 #endif /* CONFIG_CTRL_IFACE_DBUS */ 291 char bridge_ifname[16]; 292 293 char *confname; 294 struct wpa_config *conf; 295 int countermeasures; 296 os_time_t last_michael_mic_error; 297 u8 bssid[ETH_ALEN]; 298 u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this 299 * field contains the targer BSSID. */ 300 int reassociate; /* reassociation requested */ 301 int disconnected; /* all connections disabled; i.e., do no reassociate 302 * before this has been cleared */ 303 struct wpa_ssid *current_ssid; 304 int ap_ies_from_associnfo; 305 306 /* Selected configuration (based on Beacon/ProbeResp WPA IE) */ 307 int pairwise_cipher; 308 int group_cipher; 309 int key_mgmt; 310 int mgmt_group_cipher; 311 312 void *drv_priv; /* private data used by driver_ops */ 313 314 struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID; 315 * NULL = not yet initialized (start 316 * with broadcast SSID) 317 * BROADCAST_SSID_SCAN = broadcast 318 * SSID was used in the previous scan 319 */ 320 #define BROADCAST_SSID_SCAN ((struct wpa_ssid *) 1) 321 322 struct wpa_scan_results *scan_res; 323 324 struct wpa_driver_ops *driver; 325 int interface_removed; /* whether the network interface has been 326 * removed */ 327 struct wpa_sm *wpa; 328 struct eapol_sm *eapol; 329 330 struct ctrl_iface_priv *ctrl_iface; 331 332 wpa_states wpa_state; 333 int new_connection; 334 int reassociated_connection; 335 336 int eapol_received; /* number of EAPOL packets received after the 337 * previous association event */ 338 339 struct scard_data *scard; 340 341 unsigned char last_eapol_src[ETH_ALEN]; 342 343 int keys_cleared; 344 345 struct wpa_blacklist *blacklist; 346 347 int scan_req; /* manual scan request; this forces a scan even if there 348 * are no enabled networks in the configuration */ 349 int scan_res_tried; /* whether ap_scan=1 mode has tried to fetch scan 350 * results without a new scan request; this is used 351 * to speed up the first association if the driver 352 * has already available scan results. */ 353 int scan_runs; /* number of scan runs since WPS was started */ 354 355 struct wpa_client_mlme mlme; 356 int use_client_mlme; 357 int driver_4way_handshake; 358 359 int pending_mic_error_report; 360 int pending_mic_error_pairwise; 361 int mic_errors_seen; /* Michael MIC errors with the current PTK */ 362 363 struct wps_context *wps; 364 int wps_success; /* WPS success event received */ 365 int blacklist_cleared; 366 }; 367 368 369 /* wpa_supplicant.c */ 370 int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s); 371 372 const char * wpa_supplicant_state_txt(int state); 373 int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s); 374 int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s, 375 struct wpa_scan_res *bss, 376 struct wpa_ssid *ssid, 377 u8 *wpa_ie, size_t *wpa_ie_len); 378 void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, 379 struct wpa_scan_res *bss, 380 struct wpa_ssid *ssid); 381 void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s, 382 struct wpa_ssid *ssid); 383 void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s); 384 int wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s); 385 void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr); 386 void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s, 387 int sec, int usec); 388 void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, wpa_states state); 389 struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s); 390 void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s); 391 void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s, 392 int reason_code); 393 void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s, 394 int reason_code); 395 396 void wpa_show_license(void); 397 398 struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global, 399 struct wpa_interface *iface); 400 int wpa_supplicant_remove_iface(struct wpa_global *global, 401 struct wpa_supplicant *wpa_s); 402 struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global, 403 const char *ifname); 404 struct wpa_global * wpa_supplicant_init(struct wpa_params *params); 405 int wpa_supplicant_run(struct wpa_global *global); 406 void wpa_supplicant_deinit(struct wpa_global *global); 407 408 int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s, 409 struct wpa_ssid *ssid); 410 411 /* scan.c */ 412 void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec); 413 void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s); 414 415 /* events.c */ 416 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s); 417 418 /* driver_ops */ 419 static inline void * wpa_drv_init(struct wpa_supplicant *wpa_s, 420 const char *ifname) 421 { 422 if (wpa_s->driver->init2) 423 return wpa_s->driver->init2(wpa_s, ifname, wpa_s->global); 424 if (wpa_s->driver->init) { 425 return wpa_s->driver->init(wpa_s, ifname); 426 } 427 return NULL; 428 } 429 430 static inline void wpa_drv_deinit(struct wpa_supplicant *wpa_s) 431 { 432 if (wpa_s->driver->deinit) 433 wpa_s->driver->deinit(wpa_s->drv_priv); 434 } 435 436 static inline int wpa_drv_set_param(struct wpa_supplicant *wpa_s, 437 const char *param) 438 { 439 if (wpa_s->driver->set_param) 440 return wpa_s->driver->set_param(wpa_s->drv_priv, param); 441 return 0; 442 } 443 444 static inline int wpa_drv_set_drop_unencrypted(struct wpa_supplicant *wpa_s, 445 int enabled) 446 { 447 if (wpa_s->driver->set_drop_unencrypted) { 448 return wpa_s->driver->set_drop_unencrypted(wpa_s->drv_priv, 449 enabled); 450 } 451 return -1; 452 } 453 454 static inline int wpa_drv_set_countermeasures(struct wpa_supplicant *wpa_s, 455 int enabled) 456 { 457 if (wpa_s->driver->set_countermeasures) { 458 return wpa_s->driver->set_countermeasures(wpa_s->drv_priv, 459 enabled); 460 } 461 return -1; 462 } 463 464 static inline int wpa_drv_set_auth_alg(struct wpa_supplicant *wpa_s, 465 int auth_alg) 466 { 467 if (wpa_s->driver->set_auth_alg) { 468 return wpa_s->driver->set_auth_alg(wpa_s->drv_priv, 469 auth_alg); 470 } 471 return -1; 472 } 473 474 static inline int wpa_drv_set_wpa(struct wpa_supplicant *wpa_s, int enabled) 475 { 476 if (wpa_s->driver->set_wpa) { 477 return wpa_s->driver->set_wpa(wpa_s->drv_priv, enabled); 478 } 479 return 0; 480 } 481 482 static inline int wpa_drv_set_mode(struct wpa_supplicant *wpa_s, int mode) 483 { 484 if (wpa_s->driver->set_mode) { 485 return wpa_s->driver->set_mode(wpa_s->drv_priv, mode); 486 } 487 return 0; 488 } 489 490 static inline int wpa_drv_associate(struct wpa_supplicant *wpa_s, 491 struct wpa_driver_associate_params *params) 492 { 493 if (wpa_s->driver->associate) { 494 return wpa_s->driver->associate(wpa_s->drv_priv, params); 495 } 496 return -1; 497 } 498 499 static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s, const u8 *ssid, 500 size_t ssid_len) 501 { 502 if (wpa_s->driver->scan) { 503 return wpa_s->driver->scan(wpa_s->drv_priv, ssid, ssid_len); 504 } 505 return -1; 506 } 507 508 static inline int wpa_drv_get_scan_results(struct wpa_supplicant *wpa_s, 509 struct wpa_scan_result *results, 510 size_t max_size) 511 { 512 if (wpa_s->driver->get_scan_results) { 513 return wpa_s->driver->get_scan_results(wpa_s->drv_priv, 514 results, max_size); 515 } 516 return -1; 517 } 518 519 static inline struct wpa_scan_results * wpa_drv_get_scan_results2( 520 struct wpa_supplicant *wpa_s) 521 { 522 if (wpa_s->driver->get_scan_results2) 523 return wpa_s->driver->get_scan_results2(wpa_s->drv_priv); 524 return NULL; 525 } 526 527 static inline int wpa_drv_get_bssid(struct wpa_supplicant *wpa_s, u8 *bssid) 528 { 529 if (wpa_s->driver->get_bssid) { 530 return wpa_s->driver->get_bssid(wpa_s->drv_priv, bssid); 531 } 532 return -1; 533 } 534 535 static inline int wpa_drv_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid) 536 { 537 if (wpa_s->driver->get_ssid) { 538 return wpa_s->driver->get_ssid(wpa_s->drv_priv, ssid); 539 } 540 return -1; 541 } 542 543 static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s, wpa_alg alg, 544 const u8 *addr, int key_idx, int set_tx, 545 const u8 *seq, size_t seq_len, 546 const u8 *key, size_t key_len) 547 { 548 if (wpa_s->driver->set_key) { 549 wpa_s->keys_cleared = 0; 550 return wpa_s->driver->set_key(wpa_s->drv_priv, alg, addr, 551 key_idx, set_tx, seq, seq_len, 552 key, key_len); 553 } 554 return -1; 555 } 556 557 static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s, 558 const u8 *addr, int reason_code) 559 { 560 if (wpa_s->driver->deauthenticate) { 561 return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr, 562 reason_code); 563 } 564 return -1; 565 } 566 567 static inline int wpa_drv_disassociate(struct wpa_supplicant *wpa_s, 568 const u8 *addr, int reason_code) 569 { 570 if (wpa_s->driver->disassociate) { 571 return wpa_s->driver->disassociate(wpa_s->drv_priv, addr, 572 reason_code); 573 } 574 return -1; 575 } 576 577 static inline int wpa_drv_add_pmkid(struct wpa_supplicant *wpa_s, 578 const u8 *bssid, const u8 *pmkid) 579 { 580 if (wpa_s->driver->add_pmkid) { 581 return wpa_s->driver->add_pmkid(wpa_s->drv_priv, bssid, pmkid); 582 } 583 return -1; 584 } 585 586 static inline int wpa_drv_remove_pmkid(struct wpa_supplicant *wpa_s, 587 const u8 *bssid, const u8 *pmkid) 588 { 589 if (wpa_s->driver->remove_pmkid) { 590 return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, bssid, 591 pmkid); 592 } 593 return -1; 594 } 595 596 static inline int wpa_drv_flush_pmkid(struct wpa_supplicant *wpa_s) 597 { 598 if (wpa_s->driver->flush_pmkid) { 599 return wpa_s->driver->flush_pmkid(wpa_s->drv_priv); 600 } 601 return -1; 602 } 603 604 static inline int wpa_drv_get_capa(struct wpa_supplicant *wpa_s, 605 struct wpa_driver_capa *capa) 606 { 607 if (wpa_s->driver->get_capa) { 608 return wpa_s->driver->get_capa(wpa_s->drv_priv, capa); 609 } 610 return -1; 611 } 612 613 static inline void wpa_drv_poll(struct wpa_supplicant *wpa_s) 614 { 615 if (wpa_s->driver->poll) { 616 wpa_s->driver->poll(wpa_s->drv_priv); 617 } 618 } 619 620 static inline const char * wpa_drv_get_ifname(struct wpa_supplicant *wpa_s) 621 { 622 if (wpa_s->driver->get_ifname) { 623 return wpa_s->driver->get_ifname(wpa_s->drv_priv); 624 } 625 return NULL; 626 } 627 628 static inline const u8 * wpa_drv_get_mac_addr(struct wpa_supplicant *wpa_s) 629 { 630 if (wpa_s->driver->get_mac_addr) { 631 return wpa_s->driver->get_mac_addr(wpa_s->drv_priv); 632 } 633 return NULL; 634 } 635 636 static inline int wpa_drv_send_eapol(struct wpa_supplicant *wpa_s, 637 const u8 *dst, u16 proto, 638 const u8 *data, size_t data_len) 639 { 640 if (wpa_s->driver->send_eapol) 641 return wpa_s->driver->send_eapol(wpa_s->drv_priv, dst, proto, 642 data, data_len); 643 return -1; 644 } 645 646 static inline int wpa_drv_set_operstate(struct wpa_supplicant *wpa_s, 647 int state) 648 { 649 if (wpa_s->driver->set_operstate) 650 return wpa_s->driver->set_operstate(wpa_s->drv_priv, state); 651 return 0; 652 } 653 654 static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant *wpa_s, 655 const u8 *addr, int protect_type, 656 int key_type) 657 { 658 if (wpa_s->driver->mlme_setprotection) 659 return wpa_s->driver->mlme_setprotection(wpa_s->drv_priv, addr, 660 protect_type, 661 key_type); 662 return 0; 663 } 664 665 static inline struct wpa_hw_modes * 666 wpa_drv_get_hw_feature_data(struct wpa_supplicant *wpa_s, u16 *num_modes, 667 u16 *flags) 668 { 669 if (wpa_s->driver->get_hw_feature_data) 670 return wpa_s->driver->get_hw_feature_data(wpa_s->drv_priv, 671 num_modes, flags); 672 return NULL; 673 } 674 675 static inline int wpa_drv_set_channel(struct wpa_supplicant *wpa_s, 676 wpa_hw_mode phymode, int chan, 677 int freq) 678 { 679 if (wpa_s->driver->set_channel) 680 return wpa_s->driver->set_channel(wpa_s->drv_priv, phymode, 681 chan, freq); 682 return -1; 683 } 684 685 static inline int wpa_drv_set_ssid(struct wpa_supplicant *wpa_s, 686 const u8 *ssid, size_t ssid_len) 687 { 688 if (wpa_s->driver->set_ssid) { 689 return wpa_s->driver->set_ssid(wpa_s->drv_priv, ssid, 690 ssid_len); 691 } 692 return -1; 693 } 694 695 static inline int wpa_drv_set_bssid(struct wpa_supplicant *wpa_s, 696 const u8 *bssid) 697 { 698 if (wpa_s->driver->set_bssid) { 699 return wpa_s->driver->set_bssid(wpa_s->drv_priv, bssid); 700 } 701 return -1; 702 } 703 704 static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s, 705 const char *alpha2) 706 { 707 if (wpa_s->driver->set_country) 708 return wpa_s->driver->set_country(wpa_s->drv_priv, alpha2); 709 return 0; 710 } 711 712 static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s, 713 const u8 *data, size_t data_len) 714 { 715 if (wpa_s->driver->send_mlme) 716 return wpa_s->driver->send_mlme(wpa_s->drv_priv, 717 data, data_len); 718 return -1; 719 } 720 721 static inline int wpa_drv_mlme_add_sta(struct wpa_supplicant *wpa_s, 722 const u8 *addr, const u8 *supp_rates, 723 size_t supp_rates_len) 724 { 725 if (wpa_s->driver->mlme_add_sta) 726 return wpa_s->driver->mlme_add_sta(wpa_s->drv_priv, addr, 727 supp_rates, supp_rates_len); 728 return -1; 729 } 730 731 static inline int wpa_drv_mlme_remove_sta(struct wpa_supplicant *wpa_s, 732 const u8 *addr) 733 { 734 if (wpa_s->driver->mlme_remove_sta) 735 return wpa_s->driver->mlme_remove_sta(wpa_s->drv_priv, addr); 736 return -1; 737 } 738 739 static inline int wpa_drv_update_ft_ies(struct wpa_supplicant *wpa_s, 740 const u8 *md, 741 const u8 *ies, size_t ies_len) 742 { 743 if (wpa_s->driver->update_ft_ies) 744 return wpa_s->driver->update_ft_ies(wpa_s->drv_priv, md, 745 ies, ies_len); 746 return -1; 747 } 748 749 static inline int wpa_drv_send_ft_action(struct wpa_supplicant *wpa_s, 750 u8 action, const u8 *target_ap, 751 const u8 *ies, size_t ies_len) 752 { 753 if (wpa_s->driver->send_ft_action) 754 return wpa_s->driver->send_ft_action(wpa_s->drv_priv, action, 755 target_ap, ies, ies_len); 756 return -1; 757 } 758 759 static inline int wpa_drv_set_probe_req_ie(struct wpa_supplicant *wpa_s, 760 const u8 *ies, size_t ies_len) 761 { 762 if (wpa_s->driver->set_probe_req_ie) 763 return wpa_s->driver->set_probe_req_ie(wpa_s->drv_priv, ies, 764 ies_len); 765 return -1; 766 } 767 768 #endif /* WPA_SUPPLICANT_I_H */ 769