driver.h 119 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944
  1. /*
  2. * Driver interface definition
  3. * Copyright (c) 2003-2014, Jouni Malinen <j@w1.fi>
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. *
  8. * This file defines a driver interface used by both %wpa_supplicant and
  9. * hostapd. The first part of the file defines data structures used in various
  10. * driver operations. This is followed by the struct wpa_driver_ops that each
  11. * driver wrapper will beed to define with callback functions for requesting
  12. * driver operations. After this, there are definitions for driver event
  13. * reporting with wpa_supplicant_event() and some convenience helper functions
  14. * that can be used to report events.
  15. */
  16. #ifndef DRIVER_H
  17. #define DRIVER_H
  18. #define WPA_SUPPLICANT_DRIVER_VERSION 4
  19. #include "common/defs.h"
  20. #include "utils/list.h"
  21. #define HOSTAPD_CHAN_DISABLED 0x00000001
  22. #define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002
  23. #define HOSTAPD_CHAN_NO_IBSS 0x00000004
  24. #define HOSTAPD_CHAN_RADAR 0x00000008
  25. #define HOSTAPD_CHAN_HT40PLUS 0x00000010
  26. #define HOSTAPD_CHAN_HT40MINUS 0x00000020
  27. #define HOSTAPD_CHAN_HT40 0x00000040
  28. #define HOSTAPD_CHAN_SURVEY_LIST_INITIALIZED 0x00000080
  29. #define HOSTAPD_CHAN_DFS_UNKNOWN 0x00000000
  30. #define HOSTAPD_CHAN_DFS_USABLE 0x00000100
  31. #define HOSTAPD_CHAN_DFS_UNAVAILABLE 0x00000200
  32. #define HOSTAPD_CHAN_DFS_AVAILABLE 0x00000300
  33. #define HOSTAPD_CHAN_DFS_MASK 0x00000300
  34. #define HOSTAPD_CHAN_VHT_10_70 0x00000800
  35. #define HOSTAPD_CHAN_VHT_30_50 0x00001000
  36. #define HOSTAPD_CHAN_VHT_50_30 0x00002000
  37. #define HOSTAPD_CHAN_VHT_70_10 0x00004000
  38. enum reg_change_initiator {
  39. REGDOM_SET_BY_CORE,
  40. REGDOM_SET_BY_USER,
  41. REGDOM_SET_BY_DRIVER,
  42. REGDOM_SET_BY_COUNTRY_IE,
  43. REGDOM_BEACON_HINT,
  44. };
  45. enum reg_type {
  46. REGDOM_TYPE_UNKNOWN,
  47. REGDOM_TYPE_COUNTRY,
  48. REGDOM_TYPE_WORLD,
  49. REGDOM_TYPE_CUSTOM_WORLD,
  50. REGDOM_TYPE_INTERSECTION,
  51. };
  52. /**
  53. * struct hostapd_channel_data - Channel information
  54. */
  55. struct hostapd_channel_data {
  56. /**
  57. * chan - Channel number (IEEE 802.11)
  58. */
  59. short chan;
  60. /**
  61. * freq - Frequency in MHz
  62. */
  63. int freq;
  64. /**
  65. * flag - Channel flags (HOSTAPD_CHAN_*)
  66. */
  67. int flag;
  68. /**
  69. * max_tx_power - Regulatory transmit power limit in dBm
  70. */
  71. u8 max_tx_power;
  72. /*
  73. * survey_list - Linked list of surveys
  74. */
  75. struct dl_list survey_list;
  76. /**
  77. * min_nf - Minimum observed noise floor, in dBm, based on all
  78. * surveyed channel data
  79. */
  80. s8 min_nf;
  81. #ifdef CONFIG_ACS
  82. /**
  83. * interference_factor - Computed interference factor on this
  84. * channel (used internally in src/ap/acs.c; driver wrappers do not
  85. * need to set this)
  86. */
  87. long double interference_factor;
  88. #endif /* CONFIG_ACS */
  89. /* DFS CAC time in milliseconds */
  90. unsigned int dfs_cac_ms;
  91. };
  92. #define HOSTAPD_MODE_FLAG_HT_INFO_KNOWN BIT(0)
  93. #define HOSTAPD_MODE_FLAG_VHT_INFO_KNOWN BIT(1)
  94. /**
  95. * struct hostapd_hw_modes - Supported hardware mode information
  96. */
  97. struct hostapd_hw_modes {
  98. /**
  99. * mode - Hardware mode
  100. */
  101. enum hostapd_hw_mode mode;
  102. /**
  103. * num_channels - Number of entries in the channels array
  104. */
  105. int num_channels;
  106. /**
  107. * channels - Array of supported channels
  108. */
  109. struct hostapd_channel_data *channels;
  110. /**
  111. * num_rates - Number of entries in the rates array
  112. */
  113. int num_rates;
  114. /**
  115. * rates - Array of supported rates in 100 kbps units
  116. */
  117. int *rates;
  118. /**
  119. * ht_capab - HT (IEEE 802.11n) capabilities
  120. */
  121. u16 ht_capab;
  122. /**
  123. * mcs_set - MCS (IEEE 802.11n) rate parameters
  124. */
  125. u8 mcs_set[16];
  126. /**
  127. * a_mpdu_params - A-MPDU (IEEE 802.11n) parameters
  128. */
  129. u8 a_mpdu_params;
  130. /**
  131. * vht_capab - VHT (IEEE 802.11ac) capabilities
  132. */
  133. u32 vht_capab;
  134. /**
  135. * vht_mcs_set - VHT MCS (IEEE 802.11ac) rate parameters
  136. */
  137. u8 vht_mcs_set[8];
  138. unsigned int flags; /* HOSTAPD_MODE_FLAG_* */
  139. };
  140. #define IEEE80211_MODE_INFRA 0
  141. #define IEEE80211_MODE_IBSS 1
  142. #define IEEE80211_MODE_AP 2
  143. #define IEEE80211_CAP_ESS 0x0001
  144. #define IEEE80211_CAP_IBSS 0x0002
  145. #define IEEE80211_CAP_PRIVACY 0x0010
  146. /* DMG (60 GHz) IEEE 802.11ad */
  147. /* type - bits 0..1 */
  148. #define IEEE80211_CAP_DMG_MASK 0x0003
  149. #define IEEE80211_CAP_DMG_IBSS 0x0001 /* Tx by: STA */
  150. #define IEEE80211_CAP_DMG_PBSS 0x0002 /* Tx by: PCP */
  151. #define IEEE80211_CAP_DMG_AP 0x0003 /* Tx by: AP */
  152. #define WPA_SCAN_QUAL_INVALID BIT(0)
  153. #define WPA_SCAN_NOISE_INVALID BIT(1)
  154. #define WPA_SCAN_LEVEL_INVALID BIT(2)
  155. #define WPA_SCAN_LEVEL_DBM BIT(3)
  156. #define WPA_SCAN_AUTHENTICATED BIT(4)
  157. #define WPA_SCAN_ASSOCIATED BIT(5)
  158. /**
  159. * struct wpa_scan_res - Scan result for an BSS/IBSS
  160. * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
  161. * @bssid: BSSID
  162. * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
  163. * @beacon_int: beacon interval in TUs (host byte order)
  164. * @caps: capability information field in host byte order
  165. * @qual: signal quality
  166. * @noise: noise level
  167. * @level: signal level
  168. * @tsf: Timestamp
  169. * @age: Age of the information in milliseconds (i.e., how many milliseconds
  170. * ago the last Beacon or Probe Response frame was received)
  171. * @ie_len: length of the following IE field in octets
  172. * @beacon_ie_len: length of the following Beacon IE field in octets
  173. *
  174. * This structure is used as a generic format for scan results from the
  175. * driver. Each driver interface implementation is responsible for converting
  176. * the driver or OS specific scan results into this format.
  177. *
  178. * If the driver does not support reporting all IEs, the IE data structure is
  179. * constructed of the IEs that are available. This field will also need to
  180. * include SSID in IE format. All drivers are encouraged to be extended to
  181. * report all IEs to make it easier to support future additions.
  182. */
  183. struct wpa_scan_res {
  184. unsigned int flags;
  185. u8 bssid[ETH_ALEN];
  186. int freq;
  187. u16 beacon_int;
  188. u16 caps;
  189. int qual;
  190. int noise;
  191. int level;
  192. u64 tsf;
  193. unsigned int age;
  194. size_t ie_len;
  195. size_t beacon_ie_len;
  196. /*
  197. * Followed by ie_len octets of IEs from Probe Response frame (or if
  198. * the driver does not indicate source of IEs, these may also be from
  199. * Beacon frame). After the first set of IEs, another set of IEs may
  200. * follow (with beacon_ie_len octets of data) if the driver provides
  201. * both IE sets.
  202. */
  203. };
  204. /**
  205. * struct wpa_scan_results - Scan results
  206. * @res: Array of pointers to allocated variable length scan result entries
  207. * @num: Number of entries in the scan result array
  208. * @fetch_time: Time when the results were fetched from the driver
  209. */
  210. struct wpa_scan_results {
  211. struct wpa_scan_res **res;
  212. size_t num;
  213. struct os_reltime fetch_time;
  214. };
  215. /**
  216. * struct wpa_interface_info - Network interface information
  217. * @next: Pointer to the next interface or NULL if this is the last one
  218. * @ifname: Interface name that can be used with init() or init2()
  219. * @desc: Human readable adapter description (e.g., vendor/model) or NULL if
  220. * not available
  221. * @drv_name: struct wpa_driver_ops::name (note: unlike other strings, this one
  222. * is not an allocated copy, i.e., get_interfaces() caller will not free
  223. * this)
  224. */
  225. struct wpa_interface_info {
  226. struct wpa_interface_info *next;
  227. char *ifname;
  228. char *desc;
  229. const char *drv_name;
  230. };
  231. #define WPAS_MAX_SCAN_SSIDS 16
  232. /**
  233. * struct wpa_driver_scan_params - Scan parameters
  234. * Data for struct wpa_driver_ops::scan2().
  235. */
  236. struct wpa_driver_scan_params {
  237. /**
  238. * ssids - SSIDs to scan for
  239. */
  240. struct wpa_driver_scan_ssid {
  241. /**
  242. * ssid - specific SSID to scan for (ProbeReq)
  243. * %NULL or zero-length SSID is used to indicate active scan
  244. * with wildcard SSID.
  245. */
  246. const u8 *ssid;
  247. /**
  248. * ssid_len: Length of the SSID in octets
  249. */
  250. size_t ssid_len;
  251. } ssids[WPAS_MAX_SCAN_SSIDS];
  252. /**
  253. * num_ssids - Number of entries in ssids array
  254. * Zero indicates a request for a passive scan.
  255. */
  256. size_t num_ssids;
  257. /**
  258. * extra_ies - Extra IE(s) to add into Probe Request or %NULL
  259. */
  260. const u8 *extra_ies;
  261. /**
  262. * extra_ies_len - Length of extra_ies in octets
  263. */
  264. size_t extra_ies_len;
  265. /**
  266. * freqs - Array of frequencies to scan or %NULL for all frequencies
  267. *
  268. * The frequency is set in MHz. The array is zero-terminated.
  269. */
  270. int *freqs;
  271. /**
  272. * filter_ssids - Filter for reporting SSIDs
  273. *
  274. * This optional parameter can be used to request the driver wrapper to
  275. * filter scan results to include only the specified SSIDs. %NULL
  276. * indicates that no filtering is to be done. This can be used to
  277. * reduce memory needs for scan results in environments that have large
  278. * number of APs with different SSIDs.
  279. *
  280. * The driver wrapper is allowed to take this allocated buffer into its
  281. * own use by setting the pointer to %NULL. In that case, the driver
  282. * wrapper is responsible for freeing the buffer with os_free() once it
  283. * is not needed anymore.
  284. */
  285. struct wpa_driver_scan_filter {
  286. u8 ssid[32];
  287. size_t ssid_len;
  288. } *filter_ssids;
  289. /**
  290. * num_filter_ssids - Number of entries in filter_ssids array
  291. */
  292. size_t num_filter_ssids;
  293. /**
  294. * filter_rssi - Filter by RSSI
  295. *
  296. * The driver may filter scan results in firmware to reduce host
  297. * wakeups and thereby save power. Specify the RSSI threshold in s32
  298. * dBm.
  299. */
  300. s32 filter_rssi;
  301. /**
  302. * p2p_probe - Used to disable CCK (802.11b) rates for P2P probes
  303. *
  304. * When set, the driver is expected to remove rates 1, 2, 5.5, and 11
  305. * Mbps from the support rates element(s) in the Probe Request frames
  306. * and not to transmit the frames at any of those rates.
  307. */
  308. u8 p2p_probe;
  309. /**
  310. * only_new_results - Request driver to report only new results
  311. *
  312. * This is used to request the driver to report only BSSes that have
  313. * been detected after this scan request has been started, i.e., to
  314. * flush old cached BSS entries.
  315. */
  316. int only_new_results;
  317. /*
  318. * NOTE: Whenever adding new parameters here, please make sure
  319. * wpa_scan_clone_params() and wpa_scan_free_params() get updated with
  320. * matching changes.
  321. */
  322. };
  323. /**
  324. * struct wpa_driver_auth_params - Authentication parameters
  325. * Data for struct wpa_driver_ops::authenticate().
  326. */
  327. struct wpa_driver_auth_params {
  328. int freq;
  329. const u8 *bssid;
  330. const u8 *ssid;
  331. size_t ssid_len;
  332. int auth_alg;
  333. const u8 *ie;
  334. size_t ie_len;
  335. const u8 *wep_key[4];
  336. size_t wep_key_len[4];
  337. int wep_tx_keyidx;
  338. int local_state_change;
  339. /**
  340. * p2p - Whether this connection is a P2P group
  341. */
  342. int p2p;
  343. const u8 *sae_data;
  344. size_t sae_data_len;
  345. };
  346. enum wps_mode {
  347. WPS_MODE_NONE /* no WPS provisioning being used */,
  348. WPS_MODE_OPEN /* WPS provisioning with AP that is in open mode */,
  349. WPS_MODE_PRIVACY /* WPS provisioning with AP that is using protection
  350. */
  351. };
  352. /**
  353. * struct wpa_driver_associate_params - Association parameters
  354. * Data for struct wpa_driver_ops::associate().
  355. */
  356. struct wpa_driver_associate_params {
  357. /**
  358. * bssid - BSSID of the selected AP
  359. * This can be %NULL, if ap_scan=2 mode is used and the driver is
  360. * responsible for selecting with which BSS to associate. */
  361. const u8 *bssid;
  362. /**
  363. * bssid_hint - BSSID of a proposed AP
  364. *
  365. * This indicates which BSS has been found a suitable candidate for
  366. * initial association for drivers that use driver/firmwate-based BSS
  367. * selection. Unlike the @bssid parameter, @bssid_hint does not limit
  368. * the driver from selecting other BSSes in the ESS.
  369. */
  370. const u8 *bssid_hint;
  371. /**
  372. * ssid - The selected SSID
  373. */
  374. const u8 *ssid;
  375. /**
  376. * ssid_len - Length of the SSID (1..32)
  377. */
  378. size_t ssid_len;
  379. /**
  380. * freq - Frequency of the channel the selected AP is using
  381. * Frequency that the selected AP is using (in MHz as
  382. * reported in the scan results)
  383. */
  384. int freq;
  385. /**
  386. * freq_hint - Frequency of the channel the proposed AP is using
  387. *
  388. * This provides a channel on which a suitable BSS has been found as a
  389. * hint for the driver. Unlike the @freq parameter, @freq_hint does not
  390. * limit the driver from selecting other channels for
  391. * driver/firmware-based BSS selection.
  392. */
  393. int freq_hint;
  394. /**
  395. * bg_scan_period - Background scan period in seconds, 0 to disable
  396. * background scan, or -1 to indicate no change to default driver
  397. * configuration
  398. */
  399. int bg_scan_period;
  400. /**
  401. * beacon_int - Beacon interval for IBSS or 0 to use driver default
  402. */
  403. int beacon_int;
  404. /**
  405. * wpa_ie - WPA information element for (Re)Association Request
  406. * WPA information element to be included in (Re)Association
  407. * Request (including information element id and length). Use
  408. * of this WPA IE is optional. If the driver generates the WPA
  409. * IE, it can use pairwise_suite, group_suite, and
  410. * key_mgmt_suite to select proper algorithms. In this case,
  411. * the driver has to notify wpa_supplicant about the used WPA
  412. * IE by generating an event that the interface code will
  413. * convert into EVENT_ASSOCINFO data (see below).
  414. *
  415. * When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE
  416. * instead. The driver can determine which version is used by
  417. * looking at the first byte of the IE (0xdd for WPA, 0x30 for
  418. * WPA2/RSN).
  419. *
  420. * When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE.
  421. */
  422. const u8 *wpa_ie;
  423. /**
  424. * wpa_ie_len - length of the wpa_ie
  425. */
  426. size_t wpa_ie_len;
  427. /**
  428. * wpa_proto - Bitfield of WPA_PROTO_* values to indicate WPA/WPA2
  429. */
  430. unsigned int wpa_proto;
  431. /**
  432. * pairwise_suite - Selected pairwise cipher suite (WPA_CIPHER_*)
  433. *
  434. * This is usually ignored if @wpa_ie is used.
  435. */
  436. unsigned int pairwise_suite;
  437. /**
  438. * group_suite - Selected group cipher suite (WPA_CIPHER_*)
  439. *
  440. * This is usually ignored if @wpa_ie is used.
  441. */
  442. unsigned int group_suite;
  443. /**
  444. * key_mgmt_suite - Selected key management suite (WPA_KEY_MGMT_*)
  445. *
  446. * This is usually ignored if @wpa_ie is used.
  447. */
  448. unsigned int key_mgmt_suite;
  449. /**
  450. * auth_alg - Allowed authentication algorithms
  451. * Bit field of WPA_AUTH_ALG_*
  452. */
  453. int auth_alg;
  454. /**
  455. * mode - Operation mode (infra/ibss) IEEE80211_MODE_*
  456. */
  457. int mode;
  458. /**
  459. * wep_key - WEP keys for static WEP configuration
  460. */
  461. const u8 *wep_key[4];
  462. /**
  463. * wep_key_len - WEP key length for static WEP configuration
  464. */
  465. size_t wep_key_len[4];
  466. /**
  467. * wep_tx_keyidx - WEP TX key index for static WEP configuration
  468. */
  469. int wep_tx_keyidx;
  470. /**
  471. * mgmt_frame_protection - IEEE 802.11w management frame protection
  472. */
  473. enum mfp_options mgmt_frame_protection;
  474. /**
  475. * ft_ies - IEEE 802.11r / FT information elements
  476. * If the supplicant is using IEEE 802.11r (FT) and has the needed keys
  477. * for fast transition, this parameter is set to include the IEs that
  478. * are to be sent in the next FT Authentication Request message.
  479. * update_ft_ies() handler is called to update the IEs for further
  480. * FT messages in the sequence.
  481. *
  482. * The driver should use these IEs only if the target AP is advertising
  483. * the same mobility domain as the one included in the MDIE here.
  484. *
  485. * In ap_scan=2 mode, the driver can use these IEs when moving to a new
  486. * AP after the initial association. These IEs can only be used if the
  487. * target AP is advertising support for FT and is using the same MDIE
  488. * and SSID as the current AP.
  489. *
  490. * The driver is responsible for reporting the FT IEs received from the
  491. * AP's response using wpa_supplicant_event() with EVENT_FT_RESPONSE
  492. * type. update_ft_ies() handler will then be called with the FT IEs to
  493. * include in the next frame in the authentication sequence.
  494. */
  495. const u8 *ft_ies;
  496. /**
  497. * ft_ies_len - Length of ft_ies in bytes
  498. */
  499. size_t ft_ies_len;
  500. /**
  501. * ft_md - FT Mobility domain (6 octets) (also included inside ft_ies)
  502. *
  503. * This value is provided to allow the driver interface easier access
  504. * to the current mobility domain. This value is set to %NULL if no
  505. * mobility domain is currently active.
  506. */
  507. const u8 *ft_md;
  508. /**
  509. * passphrase - RSN passphrase for PSK
  510. *
  511. * This value is made available only for WPA/WPA2-Personal (PSK) and
  512. * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
  513. * the 8..63 character ASCII passphrase, if available. Please note that
  514. * this can be %NULL if passphrase was not used to generate the PSK. In
  515. * that case, the psk field must be used to fetch the PSK.
  516. */
  517. const char *passphrase;
  518. /**
  519. * psk - RSN PSK (alternative for passphrase for PSK)
  520. *
  521. * This value is made available only for WPA/WPA2-Personal (PSK) and
  522. * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
  523. * the 32-octet (256-bit) PSK, if available. The driver wrapper should
  524. * be prepared to handle %NULL value as an error.
  525. */
  526. const u8 *psk;
  527. /**
  528. * drop_unencrypted - Enable/disable unencrypted frame filtering
  529. *
  530. * Configure the driver to drop all non-EAPOL frames (both receive and
  531. * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
  532. * still be allowed for key negotiation.
  533. */
  534. int drop_unencrypted;
  535. /**
  536. * prev_bssid - Previously used BSSID in this ESS
  537. *
  538. * When not %NULL, this is a request to use reassociation instead of
  539. * association.
  540. */
  541. const u8 *prev_bssid;
  542. /**
  543. * wps - WPS mode
  544. *
  545. * If the driver needs to do special configuration for WPS association,
  546. * this variable provides more information on what type of association
  547. * is being requested. Most drivers should not need ot use this.
  548. */
  549. enum wps_mode wps;
  550. /**
  551. * p2p - Whether this connection is a P2P group
  552. */
  553. int p2p;
  554. /**
  555. * uapsd - UAPSD parameters for the network
  556. * -1 = do not change defaults
  557. * AP mode: 1 = enabled, 0 = disabled
  558. * STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE
  559. */
  560. int uapsd;
  561. /**
  562. * fixed_bssid - Whether to force this BSSID in IBSS mode
  563. * 1 = Fix this BSSID and prevent merges.
  564. * 0 = Do not fix BSSID.
  565. */
  566. int fixed_bssid;
  567. /**
  568. * disable_ht - Disable HT (IEEE 802.11n) for this connection
  569. */
  570. int disable_ht;
  571. /**
  572. * HT Capabilities over-rides. Only bits set in the mask will be used,
  573. * and not all values are used by the kernel anyway. Currently, MCS,
  574. * MPDU and MSDU fields are used.
  575. */
  576. const u8 *htcaps; /* struct ieee80211_ht_capabilities * */
  577. const u8 *htcaps_mask; /* struct ieee80211_ht_capabilities * */
  578. #ifdef CONFIG_VHT_OVERRIDES
  579. /**
  580. * disable_vht - Disable VHT for this connection
  581. */
  582. int disable_vht;
  583. /**
  584. * VHT capability overrides.
  585. */
  586. const struct ieee80211_vht_capabilities *vhtcaps;
  587. const struct ieee80211_vht_capabilities *vhtcaps_mask;
  588. #endif /* CONFIG_VHT_OVERRIDES */
  589. };
  590. enum hide_ssid {
  591. NO_SSID_HIDING,
  592. HIDDEN_SSID_ZERO_LEN,
  593. HIDDEN_SSID_ZERO_CONTENTS
  594. };
  595. struct wpa_driver_ap_params {
  596. /**
  597. * head - Beacon head from IEEE 802.11 header to IEs before TIM IE
  598. */
  599. u8 *head;
  600. /**
  601. * head_len - Length of the head buffer in octets
  602. */
  603. size_t head_len;
  604. /**
  605. * tail - Beacon tail following TIM IE
  606. */
  607. u8 *tail;
  608. /**
  609. * tail_len - Length of the tail buffer in octets
  610. */
  611. size_t tail_len;
  612. /**
  613. * dtim_period - DTIM period
  614. */
  615. int dtim_period;
  616. /**
  617. * beacon_int - Beacon interval
  618. */
  619. int beacon_int;
  620. /**
  621. * basic_rates: -1 terminated array of basic rates in 100 kbps
  622. *
  623. * This parameter can be used to set a specific basic rate set for the
  624. * BSS. If %NULL, default basic rate set is used.
  625. */
  626. int *basic_rates;
  627. /**
  628. * proberesp - Probe Response template
  629. *
  630. * This is used by drivers that reply to Probe Requests internally in
  631. * AP mode and require the full Probe Response template.
  632. */
  633. u8 *proberesp;
  634. /**
  635. * proberesp_len - Length of the proberesp buffer in octets
  636. */
  637. size_t proberesp_len;
  638. /**
  639. * ssid - The SSID to use in Beacon/Probe Response frames
  640. */
  641. const u8 *ssid;
  642. /**
  643. * ssid_len - Length of the SSID (1..32)
  644. */
  645. size_t ssid_len;
  646. /**
  647. * hide_ssid - Whether to hide the SSID
  648. */
  649. enum hide_ssid hide_ssid;
  650. /**
  651. * pairwise_ciphers - WPA_CIPHER_* bitfield
  652. */
  653. unsigned int pairwise_ciphers;
  654. /**
  655. * group_cipher - WPA_CIPHER_*
  656. */
  657. unsigned int group_cipher;
  658. /**
  659. * key_mgmt_suites - WPA_KEY_MGMT_* bitfield
  660. */
  661. unsigned int key_mgmt_suites;
  662. /**
  663. * auth_algs - WPA_AUTH_ALG_* bitfield
  664. */
  665. unsigned int auth_algs;
  666. /**
  667. * wpa_version - WPA_PROTO_* bitfield
  668. */
  669. unsigned int wpa_version;
  670. /**
  671. * privacy - Whether privacy is used in the BSS
  672. */
  673. int privacy;
  674. /**
  675. * beacon_ies - WPS/P2P IE(s) for Beacon frames
  676. *
  677. * This is used to add IEs like WPS IE and P2P IE by drivers that do
  678. * not use the full Beacon template.
  679. */
  680. const struct wpabuf *beacon_ies;
  681. /**
  682. * proberesp_ies - P2P/WPS IE(s) for Probe Response frames
  683. *
  684. * This is used to add IEs like WPS IE and P2P IE by drivers that
  685. * reply to Probe Request frames internally.
  686. */
  687. const struct wpabuf *proberesp_ies;
  688. /**
  689. * assocresp_ies - WPS IE(s) for (Re)Association Response frames
  690. *
  691. * This is used to add IEs like WPS IE by drivers that reply to
  692. * (Re)Association Request frames internally.
  693. */
  694. const struct wpabuf *assocresp_ies;
  695. /**
  696. * isolate - Whether to isolate frames between associated stations
  697. *
  698. * If this is non-zero, the AP is requested to disable forwarding of
  699. * frames between associated stations.
  700. */
  701. int isolate;
  702. /**
  703. * cts_protect - Whether CTS protection is enabled
  704. */
  705. int cts_protect;
  706. /**
  707. * preamble - Whether short preamble is enabled
  708. */
  709. int preamble;
  710. /**
  711. * short_slot_time - Whether short slot time is enabled
  712. *
  713. * 0 = short slot time disable, 1 = short slot time enabled, -1 = do
  714. * not set (e.g., when 802.11g mode is not in use)
  715. */
  716. int short_slot_time;
  717. /**
  718. * ht_opmode - HT operation mode or -1 if HT not in use
  719. */
  720. int ht_opmode;
  721. /**
  722. * interworking - Whether Interworking is enabled
  723. */
  724. int interworking;
  725. /**
  726. * hessid - Homogeneous ESS identifier or %NULL if not set
  727. */
  728. const u8 *hessid;
  729. /**
  730. * access_network_type - Access Network Type (0..15)
  731. *
  732. * This is used for filtering Probe Request frames when Interworking is
  733. * enabled.
  734. */
  735. u8 access_network_type;
  736. /**
  737. * ap_max_inactivity - Timeout in seconds to detect STA's inactivity
  738. *
  739. * This is used by driver which advertises this capability.
  740. */
  741. int ap_max_inactivity;
  742. /**
  743. * disable_dgaf - Whether group-addressed frames are disabled
  744. */
  745. int disable_dgaf;
  746. /**
  747. * osen - Whether OSEN security is enabled
  748. */
  749. int osen;
  750. /**
  751. * freq - Channel parameters for dynamic bandwidth changes
  752. */
  753. struct hostapd_freq_params *freq;
  754. };
  755. /**
  756. * struct wpa_driver_capa - Driver capability information
  757. */
  758. struct wpa_driver_capa {
  759. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001
  760. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002
  761. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004
  762. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008
  763. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010
  764. #define WPA_DRIVER_CAPA_KEY_MGMT_FT 0x00000020
  765. #define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK 0x00000040
  766. #define WPA_DRIVER_CAPA_KEY_MGMT_WAPI_PSK 0x00000080
  767. unsigned int key_mgmt;
  768. #define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001
  769. #define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002
  770. #define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004
  771. #define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008
  772. #define WPA_DRIVER_CAPA_ENC_WEP128 0x00000010
  773. #define WPA_DRIVER_CAPA_ENC_GCMP 0x00000020
  774. #define WPA_DRIVER_CAPA_ENC_GCMP_256 0x00000040
  775. #define WPA_DRIVER_CAPA_ENC_CCMP_256 0x00000080
  776. #define WPA_DRIVER_CAPA_ENC_BIP 0x00000100
  777. #define WPA_DRIVER_CAPA_ENC_BIP_GMAC_128 0x00000200
  778. #define WPA_DRIVER_CAPA_ENC_BIP_GMAC_256 0x00000400
  779. #define WPA_DRIVER_CAPA_ENC_BIP_CMAC_256 0x00000800
  780. #define WPA_DRIVER_CAPA_ENC_GTK_NOT_USED 0x00001000
  781. unsigned int enc;
  782. #define WPA_DRIVER_AUTH_OPEN 0x00000001
  783. #define WPA_DRIVER_AUTH_SHARED 0x00000002
  784. #define WPA_DRIVER_AUTH_LEAP 0x00000004
  785. unsigned int auth;
  786. /* Driver generated WPA/RSN IE */
  787. #define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001
  788. /* Driver needs static WEP key setup after association command */
  789. #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
  790. /* Driver takes care of all DFS operations */
  791. #define WPA_DRIVER_FLAGS_DFS_OFFLOAD 0x00000004
  792. /* Driver takes care of RSN 4-way handshake internally; PMK is configured with
  793. * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
  794. #define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008
  795. #define WPA_DRIVER_FLAGS_WIRED 0x00000010
  796. /* Driver provides separate commands for authentication and association (SME in
  797. * wpa_supplicant). */
  798. #define WPA_DRIVER_FLAGS_SME 0x00000020
  799. /* Driver supports AP mode */
  800. #define WPA_DRIVER_FLAGS_AP 0x00000040
  801. /* Driver needs static WEP key setup after association has been completed */
  802. #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080
  803. /* Driver supports dynamic HT 20/40 MHz channel changes during BSS lifetime */
  804. #define WPA_DRIVER_FLAGS_HT_2040_COEX 0x00000100
  805. /* Driver supports concurrent P2P operations */
  806. #define WPA_DRIVER_FLAGS_P2P_CONCURRENT 0x00000200
  807. /*
  808. * Driver uses the initial interface as a dedicated management interface, i.e.,
  809. * it cannot be used for P2P group operations or non-P2P purposes.
  810. */
  811. #define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE 0x00000400
  812. /* This interface is P2P capable (P2P GO or P2P Client) */
  813. #define WPA_DRIVER_FLAGS_P2P_CAPABLE 0x00000800
  814. /* Driver supports station and key removal when stopping an AP */
  815. #define WPA_DRIVER_FLAGS_AP_TEARDOWN_SUPPORT 0x00001000
  816. /*
  817. * Driver uses the initial interface for P2P management interface and non-P2P
  818. * purposes (e.g., connect to infra AP), but this interface cannot be used for
  819. * P2P group operations.
  820. */
  821. #define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P 0x00002000
  822. /*
  823. * Driver is known to use sane error codes, i.e., when it indicates that
  824. * something (e.g., association) fails, there was indeed a failure and the
  825. * operation does not end up getting completed successfully later.
  826. */
  827. #define WPA_DRIVER_FLAGS_SANE_ERROR_CODES 0x00004000
  828. /* Driver supports off-channel TX */
  829. #define WPA_DRIVER_FLAGS_OFFCHANNEL_TX 0x00008000
  830. /* Driver indicates TX status events for EAPOL Data frames */
  831. #define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS 0x00010000
  832. /* Driver indicates TX status events for Deauth/Disassoc frames */
  833. #define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS 0x00020000
  834. /* Driver supports roaming (BSS selection) in firmware */
  835. #define WPA_DRIVER_FLAGS_BSS_SELECTION 0x00040000
  836. /* Driver supports operating as a TDLS peer */
  837. #define WPA_DRIVER_FLAGS_TDLS_SUPPORT 0x00080000
  838. /* Driver requires external TDLS setup/teardown/discovery */
  839. #define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP 0x00100000
  840. /* Driver indicates support for Probe Response offloading in AP mode */
  841. #define WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD 0x00200000
  842. /* Driver supports U-APSD in AP mode */
  843. #define WPA_DRIVER_FLAGS_AP_UAPSD 0x00400000
  844. /* Driver supports inactivity timer in AP mode */
  845. #define WPA_DRIVER_FLAGS_INACTIVITY_TIMER 0x00800000
  846. /* Driver expects user space implementation of MLME in AP mode */
  847. #define WPA_DRIVER_FLAGS_AP_MLME 0x01000000
  848. /* Driver supports SAE with user space SME */
  849. #define WPA_DRIVER_FLAGS_SAE 0x02000000
  850. /* Driver makes use of OBSS scan mechanism in wpa_supplicant */
  851. #define WPA_DRIVER_FLAGS_OBSS_SCAN 0x04000000
  852. /* Driver supports IBSS (Ad-hoc) mode */
  853. #define WPA_DRIVER_FLAGS_IBSS 0x08000000
  854. /* Driver supports radar detection */
  855. #define WPA_DRIVER_FLAGS_RADAR 0x10000000
  856. /* Driver supports a dedicated interface for P2P Device */
  857. #define WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE 0x20000000
  858. /* Driver supports QoS Mapping */
  859. #define WPA_DRIVER_FLAGS_QOS_MAPPING 0x40000000
  860. /* Driver supports CSA in AP mode */
  861. #define WPA_DRIVER_FLAGS_AP_CSA 0x80000000
  862. unsigned int flags;
  863. int max_scan_ssids;
  864. int max_sched_scan_ssids;
  865. int sched_scan_supported;
  866. int max_match_sets;
  867. /**
  868. * max_remain_on_chan - Maximum remain-on-channel duration in msec
  869. */
  870. unsigned int max_remain_on_chan;
  871. /**
  872. * max_stations - Maximum number of associated stations the driver
  873. * supports in AP mode
  874. */
  875. unsigned int max_stations;
  876. /**
  877. * probe_resp_offloads - Bitmap of supported protocols by the driver
  878. * for Probe Response offloading.
  879. */
  880. /* Driver Probe Response offloading support for WPS ver. 1 */
  881. #define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS 0x00000001
  882. /* Driver Probe Response offloading support for WPS ver. 2 */
  883. #define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS2 0x00000002
  884. /* Driver Probe Response offloading support for P2P */
  885. #define WPA_DRIVER_PROBE_RESP_OFFLOAD_P2P 0x00000004
  886. /* Driver Probe Response offloading support for IEEE 802.11u (Interworking) */
  887. #define WPA_DRIVER_PROBE_RESP_OFFLOAD_INTERWORKING 0x00000008
  888. unsigned int probe_resp_offloads;
  889. unsigned int max_acl_mac_addrs;
  890. /**
  891. * Number of supported concurrent channels
  892. */
  893. unsigned int num_multichan_concurrent;
  894. /**
  895. * extended_capa - extended capabilities in driver/device
  896. *
  897. * Must be allocated and freed by driver and the pointers must be
  898. * valid for the lifetime of the driver, i.e., freed in deinit()
  899. */
  900. const u8 *extended_capa, *extended_capa_mask;
  901. unsigned int extended_capa_len;
  902. };
  903. struct hostapd_data;
  904. struct hostap_sta_driver_data {
  905. unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
  906. unsigned long current_tx_rate;
  907. unsigned long inactive_msec;
  908. unsigned long flags;
  909. unsigned long num_ps_buf_frames;
  910. unsigned long tx_retry_failed;
  911. unsigned long tx_retry_count;
  912. int last_rssi;
  913. int last_ack_rssi;
  914. };
  915. struct hostapd_sta_add_params {
  916. const u8 *addr;
  917. u16 aid;
  918. u16 capability;
  919. const u8 *supp_rates;
  920. size_t supp_rates_len;
  921. u16 listen_interval;
  922. const struct ieee80211_ht_capabilities *ht_capabilities;
  923. const struct ieee80211_vht_capabilities *vht_capabilities;
  924. int vht_opmode_enabled;
  925. u8 vht_opmode;
  926. u32 flags; /* bitmask of WPA_STA_* flags */
  927. int set; /* Set STA parameters instead of add */
  928. u8 qosinfo;
  929. const u8 *ext_capab;
  930. size_t ext_capab_len;
  931. const u8 *supp_channels;
  932. size_t supp_channels_len;
  933. const u8 *supp_oper_classes;
  934. size_t supp_oper_classes_len;
  935. };
  936. struct hostapd_freq_params {
  937. int mode;
  938. int freq;
  939. int channel;
  940. /* for HT */
  941. int ht_enabled;
  942. int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
  943. * secondary channel below primary, 1 = HT40
  944. * enabled, secondary channel above primary */
  945. /* for VHT */
  946. int vht_enabled;
  947. /* valid for both HT and VHT, center_freq2 is non-zero
  948. * only for bandwidth 80 and an 80+80 channel */
  949. int center_freq1, center_freq2;
  950. int bandwidth;
  951. };
  952. struct mac_address {
  953. u8 addr[ETH_ALEN];
  954. };
  955. struct hostapd_acl_params {
  956. u8 acl_policy;
  957. unsigned int num_mac_acl;
  958. struct mac_address mac_acl[0];
  959. };
  960. enum wpa_driver_if_type {
  961. /**
  962. * WPA_IF_STATION - Station mode interface
  963. */
  964. WPA_IF_STATION,
  965. /**
  966. * WPA_IF_AP_VLAN - AP mode VLAN interface
  967. *
  968. * This interface shares its address and Beacon frame with the main
  969. * BSS.
  970. */
  971. WPA_IF_AP_VLAN,
  972. /**
  973. * WPA_IF_AP_BSS - AP mode BSS interface
  974. *
  975. * This interface has its own address and Beacon frame.
  976. */
  977. WPA_IF_AP_BSS,
  978. /**
  979. * WPA_IF_P2P_GO - P2P Group Owner
  980. */
  981. WPA_IF_P2P_GO,
  982. /**
  983. * WPA_IF_P2P_CLIENT - P2P Client
  984. */
  985. WPA_IF_P2P_CLIENT,
  986. /**
  987. * WPA_IF_P2P_GROUP - P2P Group interface (will become either
  988. * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known)
  989. */
  990. WPA_IF_P2P_GROUP,
  991. /**
  992. * WPA_IF_P2P_DEVICE - P2P Device interface is used to indentify the
  993. * abstracted P2P Device function in the driver
  994. */
  995. WPA_IF_P2P_DEVICE
  996. };
  997. struct wpa_init_params {
  998. void *global_priv;
  999. const u8 *bssid;
  1000. const char *ifname;
  1001. const u8 *ssid;
  1002. size_t ssid_len;
  1003. const char *test_socket;
  1004. int use_pae_group_addr;
  1005. char **bridge;
  1006. size_t num_bridge;
  1007. u8 *own_addr; /* buffer for writing own MAC address */
  1008. };
  1009. struct wpa_bss_params {
  1010. /** Interface name (for multi-SSID/VLAN support) */
  1011. const char *ifname;
  1012. /** Whether IEEE 802.1X or WPA/WPA2 is enabled */
  1013. int enabled;
  1014. int wpa;
  1015. int ieee802_1x;
  1016. int wpa_group;
  1017. int wpa_pairwise;
  1018. int wpa_key_mgmt;
  1019. int rsn_preauth;
  1020. enum mfp_options ieee80211w;
  1021. };
  1022. #define WPA_STA_AUTHORIZED BIT(0)
  1023. #define WPA_STA_WMM BIT(1)
  1024. #define WPA_STA_SHORT_PREAMBLE BIT(2)
  1025. #define WPA_STA_MFP BIT(3)
  1026. #define WPA_STA_TDLS_PEER BIT(4)
  1027. enum tdls_oper {
  1028. TDLS_DISCOVERY_REQ,
  1029. TDLS_SETUP,
  1030. TDLS_TEARDOWN,
  1031. TDLS_ENABLE_LINK,
  1032. TDLS_DISABLE_LINK,
  1033. TDLS_ENABLE,
  1034. TDLS_DISABLE
  1035. };
  1036. enum wnm_oper {
  1037. WNM_SLEEP_ENTER_CONFIRM,
  1038. WNM_SLEEP_ENTER_FAIL,
  1039. WNM_SLEEP_EXIT_CONFIRM,
  1040. WNM_SLEEP_EXIT_FAIL,
  1041. WNM_SLEEP_TFS_REQ_IE_ADD, /* STA requests driver to add TFS req IE */
  1042. WNM_SLEEP_TFS_REQ_IE_NONE, /* STA requests empty TFS req IE */
  1043. WNM_SLEEP_TFS_REQ_IE_SET, /* AP requests driver to set TFS req IE for
  1044. * a STA */
  1045. WNM_SLEEP_TFS_RESP_IE_ADD, /* AP requests driver to add TFS resp IE
  1046. * for a STA */
  1047. WNM_SLEEP_TFS_RESP_IE_NONE, /* AP requests empty TFS resp IE */
  1048. WNM_SLEEP_TFS_RESP_IE_SET, /* AP requests driver to set TFS resp IE
  1049. * for a STA */
  1050. WNM_SLEEP_TFS_IE_DEL /* AP delete the TFS IE */
  1051. };
  1052. /* enum chan_width - Channel width definitions */
  1053. enum chan_width {
  1054. CHAN_WIDTH_20_NOHT,
  1055. CHAN_WIDTH_20,
  1056. CHAN_WIDTH_40,
  1057. CHAN_WIDTH_80,
  1058. CHAN_WIDTH_80P80,
  1059. CHAN_WIDTH_160,
  1060. CHAN_WIDTH_UNKNOWN
  1061. };
  1062. /**
  1063. * struct wpa_signal_info - Information about channel signal quality
  1064. */
  1065. struct wpa_signal_info {
  1066. u32 frequency;
  1067. int above_threshold;
  1068. int current_signal;
  1069. int avg_signal;
  1070. int current_noise;
  1071. int current_txrate;
  1072. enum chan_width chanwidth;
  1073. int center_frq1;
  1074. int center_frq2;
  1075. };
  1076. /**
  1077. * struct beacon_data - Beacon data
  1078. * @head: Head portion of Beacon frame (before TIM IE)
  1079. * @tail: Tail portion of Beacon frame (after TIM IE)
  1080. * @beacon_ies: Extra information element(s) to add into Beacon frames or %NULL
  1081. * @proberesp_ies: Extra information element(s) to add into Probe Response
  1082. * frames or %NULL
  1083. * @assocresp_ies: Extra information element(s) to add into (Re)Association
  1084. * Response frames or %NULL
  1085. * @probe_resp: Probe Response frame template
  1086. * @head_len: Length of @head
  1087. * @tail_len: Length of @tail
  1088. * @beacon_ies_len: Length of beacon_ies in octets
  1089. * @proberesp_ies_len: Length of proberesp_ies in octets
  1090. * @proberesp_ies_len: Length of proberesp_ies in octets
  1091. * @probe_resp_len: Length of probe response template (@probe_resp)
  1092. */
  1093. struct beacon_data {
  1094. u8 *head, *tail;
  1095. u8 *beacon_ies;
  1096. u8 *proberesp_ies;
  1097. u8 *assocresp_ies;
  1098. u8 *probe_resp;
  1099. size_t head_len, tail_len;
  1100. size_t beacon_ies_len;
  1101. size_t proberesp_ies_len;
  1102. size_t assocresp_ies_len;
  1103. size_t probe_resp_len;
  1104. };
  1105. /**
  1106. * struct csa_settings - Settings for channel switch command
  1107. * @cs_count: Count in Beacon frames (TBTT) to perform the switch
  1108. * @block_tx: 1 - block transmission for CSA period
  1109. * @freq_params: Next channel frequency parameter
  1110. * @beacon_csa: Beacon/probe resp/asooc resp info for CSA period
  1111. * @beacon_after: Next beacon/probe resp/asooc resp info
  1112. * @counter_offset_beacon: Offset to the count field in beacon's tail
  1113. * @counter_offset_presp: Offset to the count field in probe resp.
  1114. */
  1115. struct csa_settings {
  1116. u8 cs_count;
  1117. u8 block_tx;
  1118. struct hostapd_freq_params freq_params;
  1119. struct beacon_data beacon_csa;
  1120. struct beacon_data beacon_after;
  1121. u16 counter_offset_beacon;
  1122. u16 counter_offset_presp;
  1123. };
  1124. /* TDLS peer capabilities for send_tdls_mgmt() */
  1125. enum tdls_peer_capability {
  1126. TDLS_PEER_HT = BIT(0),
  1127. TDLS_PEER_VHT = BIT(1),
  1128. TDLS_PEER_WMM = BIT(2),
  1129. };
  1130. /**
  1131. * struct wpa_driver_ops - Driver interface API definition
  1132. *
  1133. * This structure defines the API that each driver interface needs to implement
  1134. * for core wpa_supplicant code. All driver specific functionality is captured
  1135. * in this wrapper.
  1136. */
  1137. struct wpa_driver_ops {
  1138. /** Name of the driver interface */
  1139. const char *name;
  1140. /** One line description of the driver interface */
  1141. const char *desc;
  1142. /**
  1143. * get_bssid - Get the current BSSID
  1144. * @priv: private driver interface data
  1145. * @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)
  1146. *
  1147. * Returns: 0 on success, -1 on failure
  1148. *
  1149. * Query kernel driver for the current BSSID and copy it to bssid.
  1150. * Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not
  1151. * associated.
  1152. */
  1153. int (*get_bssid)(void *priv, u8 *bssid);
  1154. /**
  1155. * get_ssid - Get the current SSID
  1156. * @priv: private driver interface data
  1157. * @ssid: buffer for SSID (at least 32 bytes)
  1158. *
  1159. * Returns: Length of the SSID on success, -1 on failure
  1160. *
  1161. * Query kernel driver for the current SSID and copy it to ssid.
  1162. * Returning zero is recommended if the STA is not associated.
  1163. *
  1164. * Note: SSID is an array of octets, i.e., it is not nul terminated and
  1165. * can, at least in theory, contain control characters (including nul)
  1166. * and as such, should be processed as binary data, not a printable
  1167. * string.
  1168. */
  1169. int (*get_ssid)(void *priv, u8 *ssid);
  1170. /**
  1171. * set_key - Configure encryption key
  1172. * @ifname: Interface name (for multi-SSID/VLAN support)
  1173. * @priv: private driver interface data
  1174. * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
  1175. * %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK,
  1176. * %WPA_ALG_GCMP, %WPA_ALG_GCMP_256, %WPA_ALG_CCMP_256,
  1177. * %WPA_ALG_BIP_GMAC_128, %WPA_ALG_BIP_GMAC_256,
  1178. * %WPA_ALG_BIP_CMAC_256);
  1179. * %WPA_ALG_NONE clears the key.
  1180. * @addr: Address of the peer STA (BSSID of the current AP when setting
  1181. * pairwise key in station mode), ff:ff:ff:ff:ff:ff for
  1182. * broadcast keys, %NULL for default keys that are used both for
  1183. * broadcast and unicast; when clearing keys, %NULL is used to
  1184. * indicate that both the broadcast-only and default key of the
  1185. * specified key index is to be cleared
  1186. * @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
  1187. * IGTK
  1188. * @set_tx: configure this key as the default Tx key (only used when
  1189. * driver does not support separate unicast/individual key
  1190. * @seq: sequence number/packet number, seq_len octets, the next
  1191. * packet number to be used for in replay protection; configured
  1192. * for Rx keys (in most cases, this is only used with broadcast
  1193. * keys and set to zero for unicast keys); %NULL if not set
  1194. * @seq_len: length of the seq, depends on the algorithm:
  1195. * TKIP: 6 octets, CCMP/GCMP: 6 octets, IGTK: 6 octets
  1196. * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
  1197. * 8-byte Rx Mic Key
  1198. * @key_len: length of the key buffer in octets (WEP: 5 or 13,
  1199. * TKIP: 32, CCMP/GCMP: 16, IGTK: 16)
  1200. *
  1201. * Returns: 0 on success, -1 on failure
  1202. *
  1203. * Configure the given key for the kernel driver. If the driver
  1204. * supports separate individual keys (4 default keys + 1 individual),
  1205. * addr can be used to determine whether the key is default or
  1206. * individual. If only 4 keys are supported, the default key with key
  1207. * index 0 is used as the individual key. STA must be configured to use
  1208. * it as the default Tx key (set_tx is set) and accept Rx for all the
  1209. * key indexes. In most cases, WPA uses only key indexes 1 and 2 for
  1210. * broadcast keys, so key index 0 is available for this kind of
  1211. * configuration.
  1212. *
  1213. * Please note that TKIP keys include separate TX and RX MIC keys and
  1214. * some drivers may expect them in different order than wpa_supplicant
  1215. * is using. If the TX/RX keys are swapped, all TKIP encrypted packets
  1216. * will trigger Michael MIC errors. This can be fixed by changing the
  1217. * order of MIC keys by swapping te bytes 16..23 and 24..31 of the key
  1218. * in driver_*.c set_key() implementation, see driver_ndis.c for an
  1219. * example on how this can be done.
  1220. */
  1221. int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg,
  1222. const u8 *addr, int key_idx, int set_tx,
  1223. const u8 *seq, size_t seq_len,
  1224. const u8 *key, size_t key_len);
  1225. /**
  1226. * init - Initialize driver interface
  1227. * @ctx: context to be used when calling wpa_supplicant functions,
  1228. * e.g., wpa_supplicant_event()
  1229. * @ifname: interface name, e.g., wlan0
  1230. *
  1231. * Returns: Pointer to private data, %NULL on failure
  1232. *
  1233. * Initialize driver interface, including event processing for kernel
  1234. * driver events (e.g., associated, scan results, Michael MIC failure).
  1235. * This function can allocate a private configuration data area for
  1236. * @ctx, file descriptor, interface name, etc. information that may be
  1237. * needed in future driver operations. If this is not used, non-NULL
  1238. * value will need to be returned because %NULL is used to indicate
  1239. * failure. The returned value will be used as 'void *priv' data for
  1240. * all other driver_ops functions.
  1241. *
  1242. * The main event loop (eloop.c) of wpa_supplicant can be used to
  1243. * register callback for read sockets (eloop_register_read_sock()).
  1244. *
  1245. * See below for more information about events and
  1246. * wpa_supplicant_event() function.
  1247. */
  1248. void * (*init)(void *ctx, const char *ifname);
  1249. /**
  1250. * deinit - Deinitialize driver interface
  1251. * @priv: private driver interface data from init()
  1252. *
  1253. * Shut down driver interface and processing of driver events. Free
  1254. * private data buffer if one was allocated in init() handler.
  1255. */
  1256. void (*deinit)(void *priv);
  1257. /**
  1258. * set_param - Set driver configuration parameters
  1259. * @priv: private driver interface data from init()
  1260. * @param: driver specific configuration parameters
  1261. *
  1262. * Returns: 0 on success, -1 on failure
  1263. *
  1264. * Optional handler for notifying driver interface about configuration
  1265. * parameters (driver_param).
  1266. */
  1267. int (*set_param)(void *priv, const char *param);
  1268. /**
  1269. * set_countermeasures - Enable/disable TKIP countermeasures
  1270. * @priv: private driver interface data
  1271. * @enabled: 1 = countermeasures enabled, 0 = disabled
  1272. *
  1273. * Returns: 0 on success, -1 on failure
  1274. *
  1275. * Configure TKIP countermeasures. When these are enabled, the driver
  1276. * should drop all received and queued frames that are using TKIP.
  1277. */
  1278. int (*set_countermeasures)(void *priv, int enabled);
  1279. /**
  1280. * deauthenticate - Request driver to deauthenticate
  1281. * @priv: private driver interface data
  1282. * @addr: peer address (BSSID of the AP)
  1283. * @reason_code: 16-bit reason code to be sent in the deauthentication
  1284. * frame
  1285. *
  1286. * Returns: 0 on success, -1 on failure
  1287. */
  1288. int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
  1289. /**
  1290. * associate - Request driver to associate
  1291. * @priv: private driver interface data
  1292. * @params: association parameters
  1293. *
  1294. * Returns: 0 on success, -1 on failure
  1295. */
  1296. int (*associate)(void *priv,
  1297. struct wpa_driver_associate_params *params);
  1298. /**
  1299. * add_pmkid - Add PMKSA cache entry to the driver
  1300. * @priv: private driver interface data
  1301. * @bssid: BSSID for the PMKSA cache entry
  1302. * @pmkid: PMKID for the PMKSA cache entry
  1303. *
  1304. * Returns: 0 on success, -1 on failure
  1305. *
  1306. * This function is called when a new PMK is received, as a result of
  1307. * either normal authentication or RSN pre-authentication.
  1308. *
  1309. * If the driver generates RSN IE, i.e., it does not use wpa_ie in
  1310. * associate(), add_pmkid() can be used to add new PMKSA cache entries
  1311. * in the driver. If the driver uses wpa_ie from wpa_supplicant, this
  1312. * driver_ops function does not need to be implemented. Likewise, if
  1313. * the driver does not support WPA, this function is not needed.
  1314. */
  1315. int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
  1316. /**
  1317. * remove_pmkid - Remove PMKSA cache entry to the driver
  1318. * @priv: private driver interface data
  1319. * @bssid: BSSID for the PMKSA cache entry
  1320. * @pmkid: PMKID for the PMKSA cache entry
  1321. *
  1322. * Returns: 0 on success, -1 on failure
  1323. *
  1324. * This function is called when the supplicant drops a PMKSA cache
  1325. * entry for any reason.
  1326. *
  1327. * If the driver generates RSN IE, i.e., it does not use wpa_ie in
  1328. * associate(), remove_pmkid() can be used to synchronize PMKSA caches
  1329. * between the driver and wpa_supplicant. If the driver uses wpa_ie
  1330. * from wpa_supplicant, this driver_ops function does not need to be
  1331. * implemented. Likewise, if the driver does not support WPA, this
  1332. * function is not needed.
  1333. */
  1334. int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
  1335. /**
  1336. * flush_pmkid - Flush PMKSA cache
  1337. * @priv: private driver interface data
  1338. *
  1339. * Returns: 0 on success, -1 on failure
  1340. *
  1341. * This function is called when the supplicant drops all PMKSA cache
  1342. * entries for any reason.
  1343. *
  1344. * If the driver generates RSN IE, i.e., it does not use wpa_ie in
  1345. * associate(), remove_pmkid() can be used to synchronize PMKSA caches
  1346. * between the driver and wpa_supplicant. If the driver uses wpa_ie
  1347. * from wpa_supplicant, this driver_ops function does not need to be
  1348. * implemented. Likewise, if the driver does not support WPA, this
  1349. * function is not needed.
  1350. */
  1351. int (*flush_pmkid)(void *priv);
  1352. /**
  1353. * get_capa - Get driver capabilities
  1354. * @priv: private driver interface data
  1355. *
  1356. * Returns: 0 on success, -1 on failure
  1357. *
  1358. * Get driver/firmware/hardware capabilities.
  1359. */
  1360. int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
  1361. /**
  1362. * poll - Poll driver for association information
  1363. * @priv: private driver interface data
  1364. *
  1365. * This is an option callback that can be used when the driver does not
  1366. * provide event mechanism for association events. This is called when
  1367. * receiving WPA EAPOL-Key messages that require association
  1368. * information. The driver interface is supposed to generate associnfo
  1369. * event before returning from this callback function. In addition, the
  1370. * driver interface should generate an association event after having
  1371. * sent out associnfo.
  1372. */
  1373. void (*poll)(void *priv);
  1374. /**
  1375. * get_ifname - Get interface name
  1376. * @priv: private driver interface data
  1377. *
  1378. * Returns: Pointer to the interface name. This can differ from the
  1379. * interface name used in init() call. Init() is called first.
  1380. *
  1381. * This optional function can be used to allow the driver interface to
  1382. * replace the interface name with something else, e.g., based on an
  1383. * interface mapping from a more descriptive name.
  1384. */
  1385. const char * (*get_ifname)(void *priv);
  1386. /**
  1387. * get_mac_addr - Get own MAC address
  1388. * @priv: private driver interface data
  1389. *
  1390. * Returns: Pointer to own MAC address or %NULL on failure
  1391. *
  1392. * This optional function can be used to get the own MAC address of the
  1393. * device from the driver interface code. This is only needed if the
  1394. * l2_packet implementation for the OS does not provide easy access to
  1395. * a MAC address. */
  1396. const u8 * (*get_mac_addr)(void *priv);
  1397. /**
  1398. * send_eapol - Optional function for sending EAPOL packets
  1399. * @priv: private driver interface data
  1400. * @dest: Destination MAC address
  1401. * @proto: Ethertype
  1402. * @data: EAPOL packet starting with IEEE 802.1X header
  1403. * @data_len: Size of the EAPOL packet
  1404. *
  1405. * Returns: 0 on success, -1 on failure
  1406. *
  1407. * This optional function can be used to override l2_packet operations
  1408. * with driver specific functionality. If this function pointer is set,
  1409. * l2_packet module is not used at all and the driver interface code is
  1410. * responsible for receiving and sending all EAPOL packets. The
  1411. * received EAPOL packets are sent to core code with EVENT_EAPOL_RX
  1412. * event. The driver interface is required to implement get_mac_addr()
  1413. * handler if send_eapol() is used.
  1414. */
  1415. int (*send_eapol)(void *priv, const u8 *dest, u16 proto,
  1416. const u8 *data, size_t data_len);
  1417. /**
  1418. * set_operstate - Sets device operating state to DORMANT or UP
  1419. * @priv: private driver interface data
  1420. * @state: 0 = dormant, 1 = up
  1421. * Returns: 0 on success, -1 on failure
  1422. *
  1423. * This is an optional function that can be used on operating systems
  1424. * that support a concept of controlling network device state from user
  1425. * space applications. This function, if set, gets called with
  1426. * state = 1 when authentication has been completed and with state = 0
  1427. * when connection is lost.
  1428. */
  1429. int (*set_operstate)(void *priv, int state);
  1430. /**
  1431. * mlme_setprotection - MLME-SETPROTECTION.request primitive
  1432. * @priv: Private driver interface data
  1433. * @addr: Address of the station for which to set protection (may be
  1434. * %NULL for group keys)
  1435. * @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_*
  1436. * @key_type: MLME_SETPROTECTION_KEY_TYPE_*
  1437. * Returns: 0 on success, -1 on failure
  1438. *
  1439. * This is an optional function that can be used to set the driver to
  1440. * require protection for Tx and/or Rx frames. This uses the layer
  1441. * interface defined in IEEE 802.11i-2004 clause 10.3.22.1
  1442. * (MLME-SETPROTECTION.request). Many drivers do not use explicit
  1443. * set protection operation; instead, they set protection implicitly
  1444. * based on configured keys.
  1445. */
  1446. int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
  1447. int key_type);
  1448. /**
  1449. * get_hw_feature_data - Get hardware support data (channels and rates)
  1450. * @priv: Private driver interface data
  1451. * @num_modes: Variable for returning the number of returned modes
  1452. * flags: Variable for returning hardware feature flags
  1453. * Returns: Pointer to allocated hardware data on success or %NULL on
  1454. * failure. Caller is responsible for freeing this.
  1455. */
  1456. struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
  1457. u16 *num_modes,
  1458. u16 *flags);
  1459. /**
  1460. * send_mlme - Send management frame from MLME
  1461. * @priv: Private driver interface data
  1462. * @data: IEEE 802.11 management frame with IEEE 802.11 header
  1463. * @data_len: Size of the management frame
  1464. * @noack: Do not wait for this frame to be acked (disable retries)
  1465. * Returns: 0 on success, -1 on failure
  1466. */
  1467. int (*send_mlme)(void *priv, const u8 *data, size_t data_len,
  1468. int noack);
  1469. /**
  1470. * update_ft_ies - Update FT (IEEE 802.11r) IEs
  1471. * @priv: Private driver interface data
  1472. * @md: Mobility domain (2 octets) (also included inside ies)
  1473. * @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs
  1474. * @ies_len: Length of FT IEs in bytes
  1475. * Returns: 0 on success, -1 on failure
  1476. *
  1477. * The supplicant uses this callback to let the driver know that keying
  1478. * material for FT is available and that the driver can use the
  1479. * provided IEs in the next message in FT authentication sequence.
  1480. *
  1481. * This function is only needed for driver that support IEEE 802.11r
  1482. * (Fast BSS Transition).
  1483. */
  1484. int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies,
  1485. size_t ies_len);
  1486. /**
  1487. * send_ft_action - Send FT Action frame (IEEE 802.11r)
  1488. * @priv: Private driver interface data
  1489. * @action: Action field value
  1490. * @target_ap: Target AP address
  1491. * @ies: FT IEs (MDIE, FTIE, ...) (FT Request action frame body)
  1492. * @ies_len: Length of FT IEs in bytes
  1493. * Returns: 0 on success, -1 on failure
  1494. *
  1495. * The supplicant uses this callback to request the driver to transmit
  1496. * an FT Action frame (action category 6) for over-the-DS fast BSS
  1497. * transition.
  1498. */
  1499. int (*send_ft_action)(void *priv, u8 action, const u8 *target_ap,
  1500. const u8 *ies, size_t ies_len);
  1501. /**
  1502. * get_scan_results2 - Fetch the latest scan results
  1503. * @priv: private driver interface data
  1504. *
  1505. * Returns: Allocated buffer of scan results (caller is responsible for
  1506. * freeing the data structure) on success, NULL on failure
  1507. */
  1508. struct wpa_scan_results * (*get_scan_results2)(void *priv);
  1509. /**
  1510. * set_country - Set country
  1511. * @priv: Private driver interface data
  1512. * @alpha2: country to which to switch to
  1513. * Returns: 0 on success, -1 on failure
  1514. *
  1515. * This function is for drivers which support some form
  1516. * of setting a regulatory domain.
  1517. */
  1518. int (*set_country)(void *priv, const char *alpha2);
  1519. /**
  1520. * get_country - Get country
  1521. * @priv: Private driver interface data
  1522. * @alpha2: Buffer for returning country code (at least 3 octets)
  1523. * Returns: 0 on success, -1 on failure
  1524. */
  1525. int (*get_country)(void *priv, char *alpha2);
  1526. /**
  1527. * global_init - Global driver initialization
  1528. * Returns: Pointer to private data (global), %NULL on failure
  1529. *
  1530. * This optional function is called to initialize the driver wrapper
  1531. * for global data, i.e., data that applies to all interfaces. If this
  1532. * function is implemented, global_deinit() will also need to be
  1533. * implemented to free the private data. The driver will also likely
  1534. * use init2() function instead of init() to get the pointer to global
  1535. * data available to per-interface initializer.
  1536. */
  1537. void * (*global_init)(void);
  1538. /**
  1539. * global_deinit - Global driver deinitialization
  1540. * @priv: private driver global data from global_init()
  1541. *
  1542. * Terminate any global driver related functionality and free the
  1543. * global data structure.
  1544. */
  1545. void (*global_deinit)(void *priv);
  1546. /**
  1547. * init2 - Initialize driver interface (with global data)
  1548. * @ctx: context to be used when calling wpa_supplicant functions,
  1549. * e.g., wpa_supplicant_event()
  1550. * @ifname: interface name, e.g., wlan0
  1551. * @global_priv: private driver global data from global_init()
  1552. * Returns: Pointer to private data, %NULL on failure
  1553. *
  1554. * This function can be used instead of init() if the driver wrapper
  1555. * uses global data.
  1556. */
  1557. void * (*init2)(void *ctx, const char *ifname, void *global_priv);
  1558. /**
  1559. * get_interfaces - Get information about available interfaces
  1560. * @global_priv: private driver global data from global_init()
  1561. * Returns: Allocated buffer of interface information (caller is
  1562. * responsible for freeing the data structure) on success, NULL on
  1563. * failure
  1564. */
  1565. struct wpa_interface_info * (*get_interfaces)(void *global_priv);
  1566. /**
  1567. * scan2 - Request the driver to initiate scan
  1568. * @priv: private driver interface data
  1569. * @params: Scan parameters
  1570. *
  1571. * Returns: 0 on success, -1 on failure
  1572. *
  1573. * Once the scan results are ready, the driver should report scan
  1574. * results event for wpa_supplicant which will eventually request the
  1575. * results with wpa_driver_get_scan_results2().
  1576. */
  1577. int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
  1578. /**
  1579. * authenticate - Request driver to authenticate
  1580. * @priv: private driver interface data
  1581. * @params: authentication parameters
  1582. * Returns: 0 on success, -1 on failure
  1583. *
  1584. * This is an optional function that can be used with drivers that
  1585. * support separate authentication and association steps, i.e., when
  1586. * wpa_supplicant can act as the SME. If not implemented, associate()
  1587. * function is expected to take care of IEEE 802.11 authentication,
  1588. * too.
  1589. */
  1590. int (*authenticate)(void *priv,
  1591. struct wpa_driver_auth_params *params);
  1592. /**
  1593. * set_ap - Set Beacon and Probe Response information for AP mode
  1594. * @priv: Private driver interface data
  1595. * @params: Parameters to use in AP mode
  1596. *
  1597. * This function is used to configure Beacon template and/or extra IEs
  1598. * to add for Beacon and Probe Response frames for the driver in
  1599. * AP mode. The driver is responsible for building the full Beacon
  1600. * frame by concatenating the head part with TIM IE generated by the
  1601. * driver/firmware and finishing with the tail part. Depending on the
  1602. * driver architectue, this can be done either by using the full
  1603. * template or the set of additional IEs (e.g., WPS and P2P IE).
  1604. * Similarly, Probe Response processing depends on the driver design.
  1605. * If the driver (or firmware) takes care of replying to Probe Request
  1606. * frames, the extra IEs provided here needs to be added to the Probe
  1607. * Response frames.
  1608. *
  1609. * Returns: 0 on success, -1 on failure
  1610. */
  1611. int (*set_ap)(void *priv, struct wpa_driver_ap_params *params);
  1612. /**
  1613. * set_acl - Set ACL in AP mode
  1614. * @priv: Private driver interface data
  1615. * @params: Parameters to configure ACL
  1616. * Returns: 0 on success, -1 on failure
  1617. *
  1618. * This is used only for the drivers which support MAC address ACL.
  1619. */
  1620. int (*set_acl)(void *priv, struct hostapd_acl_params *params);
  1621. /**
  1622. * hapd_init - Initialize driver interface (hostapd only)
  1623. * @hapd: Pointer to hostapd context
  1624. * @params: Configuration for the driver wrapper
  1625. * Returns: Pointer to private data, %NULL on failure
  1626. *
  1627. * This function is used instead of init() or init2() when the driver
  1628. * wrapper is used with hostapd.
  1629. */
  1630. void * (*hapd_init)(struct hostapd_data *hapd,
  1631. struct wpa_init_params *params);
  1632. /**
  1633. * hapd_deinit - Deinitialize driver interface (hostapd only)
  1634. * @priv: Private driver interface data from hapd_init()
  1635. */
  1636. void (*hapd_deinit)(void *priv);
  1637. /**
  1638. * set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
  1639. * @priv: Private driver interface data
  1640. * @params: BSS parameters
  1641. * Returns: 0 on success, -1 on failure
  1642. *
  1643. * This is an optional function to configure the kernel driver to
  1644. * enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
  1645. * can be left undefined (set to %NULL) if IEEE 802.1X support is
  1646. * always enabled and the driver uses set_ap() to set WPA/RSN IE
  1647. * for Beacon frames.
  1648. *
  1649. * DEPRECATED - use set_ap() instead
  1650. */
  1651. int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
  1652. /**
  1653. * set_privacy - Enable/disable privacy (AP only)
  1654. * @priv: Private driver interface data
  1655. * @enabled: 1 = privacy enabled, 0 = disabled
  1656. * Returns: 0 on success, -1 on failure
  1657. *
  1658. * This is an optional function to configure privacy field in the
  1659. * kernel driver for Beacon frames. This can be left undefined (set to
  1660. * %NULL) if the driver uses the Beacon template from set_ap().
  1661. *
  1662. * DEPRECATED - use set_ap() instead
  1663. */
  1664. int (*set_privacy)(void *priv, int enabled);
  1665. /**
  1666. * get_seqnum - Fetch the current TSC/packet number (AP only)
  1667. * @ifname: The interface name (main or virtual)
  1668. * @priv: Private driver interface data
  1669. * @addr: MAC address of the station or %NULL for group keys
  1670. * @idx: Key index
  1671. * @seq: Buffer for returning the latest used TSC/packet number
  1672. * Returns: 0 on success, -1 on failure
  1673. *
  1674. * This function is used to fetch the last used TSC/packet number for
  1675. * a TKIP, CCMP, GCMP, or BIP/IGTK key. It is mainly used with group
  1676. * keys, so there is no strict requirement on implementing support for
  1677. * unicast keys (i.e., addr != %NULL).
  1678. */
  1679. int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
  1680. int idx, u8 *seq);
  1681. /**
  1682. * flush - Flush all association stations (AP only)
  1683. * @priv: Private driver interface data
  1684. * Returns: 0 on success, -1 on failure
  1685. *
  1686. * This function requests the driver to disassociate all associated
  1687. * stations. This function does not need to be implemented if the
  1688. * driver does not process association frames internally.
  1689. */
  1690. int (*flush)(void *priv);
  1691. /**
  1692. * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP)
  1693. * @priv: Private driver interface data
  1694. * @elem: Information elements
  1695. * @elem_len: Length of the elem buffer in octets
  1696. * Returns: 0 on success, -1 on failure
  1697. *
  1698. * This is an optional function to add information elements in the
  1699. * kernel driver for Beacon and Probe Response frames. This can be left
  1700. * undefined (set to %NULL) if the driver uses the Beacon template from
  1701. * set_ap().
  1702. *
  1703. * DEPRECATED - use set_ap() instead
  1704. */
  1705. int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
  1706. /**
  1707. * read_sta_data - Fetch station data
  1708. * @priv: Private driver interface data
  1709. * @data: Buffer for returning station information
  1710. * @addr: MAC address of the station
  1711. * Returns: 0 on success, -1 on failure
  1712. */
  1713. int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
  1714. const u8 *addr);
  1715. /**
  1716. * hapd_send_eapol - Send an EAPOL packet (AP only)
  1717. * @priv: private driver interface data
  1718. * @addr: Destination MAC address
  1719. * @data: EAPOL packet starting with IEEE 802.1X header
  1720. * @data_len: Length of the EAPOL packet in octets
  1721. * @encrypt: Whether the frame should be encrypted
  1722. * @own_addr: Source MAC address
  1723. * @flags: WPA_STA_* flags for the destination station
  1724. *
  1725. * Returns: 0 on success, -1 on failure
  1726. */
  1727. int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
  1728. size_t data_len, int encrypt,
  1729. const u8 *own_addr, u32 flags);
  1730. /**
  1731. * sta_deauth - Deauthenticate a station (AP only)
  1732. * @priv: Private driver interface data
  1733. * @own_addr: Source address and BSSID for the Deauthentication frame
  1734. * @addr: MAC address of the station to deauthenticate
  1735. * @reason: Reason code for the Deauthentiation frame
  1736. * Returns: 0 on success, -1 on failure
  1737. *
  1738. * This function requests a specific station to be deauthenticated and
  1739. * a Deauthentication frame to be sent to it.
  1740. */
  1741. int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
  1742. int reason);
  1743. /**
  1744. * sta_disassoc - Disassociate a station (AP only)
  1745. * @priv: Private driver interface data
  1746. * @own_addr: Source address and BSSID for the Disassociation frame
  1747. * @addr: MAC address of the station to disassociate
  1748. * @reason: Reason code for the Disassociation frame
  1749. * Returns: 0 on success, -1 on failure
  1750. *
  1751. * This function requests a specific station to be disassociated and
  1752. * a Disassociation frame to be sent to it.
  1753. */
  1754. int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
  1755. int reason);
  1756. /**
  1757. * sta_remove - Remove a station entry (AP only)
  1758. * @priv: Private driver interface data
  1759. * @addr: MAC address of the station to be removed
  1760. * Returns: 0 on success, -1 on failure
  1761. */
  1762. int (*sta_remove)(void *priv, const u8 *addr);
  1763. /**
  1764. * hapd_get_ssid - Get the current SSID (AP only)
  1765. * @priv: Private driver interface data
  1766. * @buf: Buffer for returning the SSID
  1767. * @len: Maximum length of the buffer
  1768. * Returns: Length of the SSID on success, -1 on failure
  1769. *
  1770. * This function need not be implemented if the driver uses Beacon
  1771. * template from set_ap() and does not reply to Probe Request frames.
  1772. */
  1773. int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
  1774. /**
  1775. * hapd_set_ssid - Set SSID (AP only)
  1776. * @priv: Private driver interface data
  1777. * @buf: SSID
  1778. * @len: Length of the SSID in octets
  1779. * Returns: 0 on success, -1 on failure
  1780. *
  1781. * DEPRECATED - use set_ap() instead
  1782. */
  1783. int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
  1784. /**
  1785. * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP)
  1786. * @priv: Private driver interface data
  1787. * @enabled: 1 = countermeasures enabled, 0 = disabled
  1788. * Returns: 0 on success, -1 on failure
  1789. *
  1790. * This need not be implemented if the driver does not take care of
  1791. * association processing.
  1792. */
  1793. int (*hapd_set_countermeasures)(void *priv, int enabled);
  1794. /**
  1795. * sta_add - Add a station entry
  1796. * @priv: Private driver interface data
  1797. * @params: Station parameters
  1798. * Returns: 0 on success, -1 on failure
  1799. *
  1800. * This function is used to add a station entry to the driver once the
  1801. * station has completed association. This is only used if the driver
  1802. * does not take care of association processing.
  1803. *
  1804. * With TDLS, this function is also used to add or set (params->set 1)
  1805. * TDLS peer entries.
  1806. */
  1807. int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
  1808. /**
  1809. * get_inact_sec - Get station inactivity duration (AP only)
  1810. * @priv: Private driver interface data
  1811. * @addr: Station address
  1812. * Returns: Number of seconds station has been inactive, -1 on failure
  1813. */
  1814. int (*get_inact_sec)(void *priv, const u8 *addr);
  1815. /**
  1816. * sta_clear_stats - Clear station statistics (AP only)
  1817. * @priv: Private driver interface data
  1818. * @addr: Station address
  1819. * Returns: 0 on success, -1 on failure
  1820. */
  1821. int (*sta_clear_stats)(void *priv, const u8 *addr);
  1822. /**
  1823. * set_freq - Set channel/frequency (AP only)
  1824. * @priv: Private driver interface data
  1825. * @freq: Channel parameters
  1826. * Returns: 0 on success, -1 on failure
  1827. */
  1828. int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
  1829. /**
  1830. * set_rts - Set RTS threshold
  1831. * @priv: Private driver interface data
  1832. * @rts: RTS threshold in octets
  1833. * Returns: 0 on success, -1 on failure
  1834. */
  1835. int (*set_rts)(void *priv, int rts);
  1836. /**
  1837. * set_frag - Set fragmentation threshold
  1838. * @priv: Private driver interface data
  1839. * @frag: Fragmentation threshold in octets
  1840. * Returns: 0 on success, -1 on failure
  1841. */
  1842. int (*set_frag)(void *priv, int frag);
  1843. /**
  1844. * sta_set_flags - Set station flags (AP only)
  1845. * @priv: Private driver interface data
  1846. * @addr: Station address
  1847. * @total_flags: Bitmap of all WPA_STA_* flags currently set
  1848. * @flags_or: Bitmap of WPA_STA_* flags to add
  1849. * @flags_and: Bitmap of WPA_STA_* flags to us as a mask
  1850. * Returns: 0 on success, -1 on failure
  1851. */
  1852. int (*sta_set_flags)(void *priv, const u8 *addr,
  1853. int total_flags, int flags_or, int flags_and);
  1854. /**
  1855. * set_tx_queue_params - Set TX queue parameters
  1856. * @priv: Private driver interface data
  1857. * @queue: Queue number (0 = VO, 1 = VI, 2 = BE, 3 = BK)
  1858. * @aifs: AIFS
  1859. * @cw_min: cwMin
  1860. * @cw_max: cwMax
  1861. * @burst_time: Maximum length for bursting in 0.1 msec units
  1862. */
  1863. int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
  1864. int cw_max, int burst_time);
  1865. /**
  1866. * if_add - Add a virtual interface
  1867. * @priv: Private driver interface data
  1868. * @type: Interface type
  1869. * @ifname: Interface name for the new virtual interface
  1870. * @addr: Local address to use for the interface or %NULL to use the
  1871. * parent interface address
  1872. * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces
  1873. * @drv_priv: Pointer for overwriting the driver context or %NULL if
  1874. * not allowed (applies only to %WPA_IF_AP_BSS type)
  1875. * @force_ifname: Buffer for returning an interface name that the
  1876. * driver ended up using if it differs from the requested ifname
  1877. * @if_addr: Buffer for returning the allocated interface address
  1878. * (this may differ from the requested addr if the driver cannot
  1879. * change interface address)
  1880. * @bridge: Bridge interface to use or %NULL if no bridge configured
  1881. * @use_existing: Whether to allow existing interface to be used
  1882. * Returns: 0 on success, -1 on failure
  1883. */
  1884. int (*if_add)(void *priv, enum wpa_driver_if_type type,
  1885. const char *ifname, const u8 *addr, void *bss_ctx,
  1886. void **drv_priv, char *force_ifname, u8 *if_addr,
  1887. const char *bridge, int use_existing);
  1888. /**
  1889. * if_remove - Remove a virtual interface
  1890. * @priv: Private driver interface data
  1891. * @type: Interface type
  1892. * @ifname: Interface name of the virtual interface to be removed
  1893. * Returns: 0 on success, -1 on failure
  1894. */
  1895. int (*if_remove)(void *priv, enum wpa_driver_if_type type,
  1896. const char *ifname);
  1897. /**
  1898. * set_sta_vlan - Bind a station into a specific interface (AP only)
  1899. * @priv: Private driver interface data
  1900. * @ifname: Interface (main or virtual BSS or VLAN)
  1901. * @addr: MAC address of the associated station
  1902. * @vlan_id: VLAN ID
  1903. * Returns: 0 on success, -1 on failure
  1904. *
  1905. * This function is used to bind a station to a specific virtual
  1906. * interface. It is only used if when virtual interfaces are supported,
  1907. * e.g., to assign stations to different VLAN interfaces based on
  1908. * information from a RADIUS server. This allows separate broadcast
  1909. * domains to be used with a single BSS.
  1910. */
  1911. int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
  1912. int vlan_id);
  1913. /**
  1914. * commit - Optional commit changes handler (AP only)
  1915. * @priv: driver private data
  1916. * Returns: 0 on success, -1 on failure
  1917. *
  1918. * This optional handler function can be registered if the driver
  1919. * interface implementation needs to commit changes (e.g., by setting
  1920. * network interface up) at the end of initial configuration. If set,
  1921. * this handler will be called after initial setup has been completed.
  1922. */
  1923. int (*commit)(void *priv);
  1924. /**
  1925. * send_ether - Send an ethernet packet (AP only)
  1926. * @priv: private driver interface data
  1927. * @dst: Destination MAC address
  1928. * @src: Source MAC address
  1929. * @proto: Ethertype
  1930. * @data: EAPOL packet starting with IEEE 802.1X header
  1931. * @data_len: Length of the EAPOL packet in octets
  1932. * Returns: 0 on success, -1 on failure
  1933. */
  1934. int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
  1935. const u8 *data, size_t data_len);
  1936. /**
  1937. * set_radius_acl_auth - Notification of RADIUS ACL change
  1938. * @priv: Private driver interface data
  1939. * @mac: MAC address of the station
  1940. * @accepted: Whether the station was accepted
  1941. * @session_timeout: Session timeout for the station
  1942. * Returns: 0 on success, -1 on failure
  1943. */
  1944. int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
  1945. u32 session_timeout);
  1946. /**
  1947. * set_radius_acl_expire - Notification of RADIUS ACL expiration
  1948. * @priv: Private driver interface data
  1949. * @mac: MAC address of the station
  1950. * Returns: 0 on success, -1 on failure
  1951. */
  1952. int (*set_radius_acl_expire)(void *priv, const u8 *mac);
  1953. /**
  1954. * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP)
  1955. * @priv: Private driver interface data
  1956. * @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s)
  1957. * @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove
  1958. * extra IE(s)
  1959. * @assocresp: WPS IE(s) for (Re)Association Response frames or %NULL
  1960. * to remove extra IE(s)
  1961. * Returns: 0 on success, -1 on failure
  1962. *
  1963. * This is an optional function to add WPS IE in the kernel driver for
  1964. * Beacon and Probe Response frames. This can be left undefined (set
  1965. * to %NULL) if the driver uses the Beacon template from set_ap()
  1966. * and does not process Probe Request frames. If the driver takes care
  1967. * of (Re)Association frame processing, the assocresp buffer includes
  1968. * WPS IE(s) that need to be added to (Re)Association Response frames
  1969. * whenever a (Re)Association Request frame indicated use of WPS.
  1970. *
  1971. * This will also be used to add P2P IE(s) into Beacon/Probe Response
  1972. * frames when operating as a GO. The driver is responsible for adding
  1973. * timing related attributes (e.g., NoA) in addition to the IEs
  1974. * included here by appending them after these buffers. This call is
  1975. * also used to provide Probe Response IEs for P2P Listen state
  1976. * operations for drivers that generate the Probe Response frames
  1977. * internally.
  1978. *
  1979. * DEPRECATED - use set_ap() instead
  1980. */
  1981. int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
  1982. const struct wpabuf *proberesp,
  1983. const struct wpabuf *assocresp);
  1984. /**
  1985. * set_supp_port - Set IEEE 802.1X Supplicant Port status
  1986. * @priv: Private driver interface data
  1987. * @authorized: Whether the port is authorized
  1988. * Returns: 0 on success, -1 on failure
  1989. */
  1990. int (*set_supp_port)(void *priv, int authorized);
  1991. /**
  1992. * set_wds_sta - Bind a station into a 4-address WDS (AP only)
  1993. * @priv: Private driver interface data
  1994. * @addr: MAC address of the associated station
  1995. * @aid: Association ID
  1996. * @val: 1 = bind to 4-address WDS; 0 = unbind
  1997. * @bridge_ifname: Bridge interface to use for the WDS station or %NULL
  1998. * to indicate that bridge is not to be used
  1999. * @ifname_wds: Buffer to return the interface name for the new WDS
  2000. * station or %NULL to indicate name is not returned.
  2001. * Returns: 0 on success, -1 on failure
  2002. */
  2003. int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
  2004. const char *bridge_ifname, char *ifname_wds);
  2005. /**
  2006. * send_action - Transmit an Action frame
  2007. * @priv: Private driver interface data
  2008. * @freq: Frequency (in MHz) of the channel
  2009. * @wait: Time to wait off-channel for a response (in ms), or zero
  2010. * @dst: Destination MAC address (Address 1)
  2011. * @src: Source MAC address (Address 2)
  2012. * @bssid: BSSID (Address 3)
  2013. * @data: Frame body
  2014. * @data_len: data length in octets
  2015. @ @no_cck: Whether CCK rates must not be used to transmit this frame
  2016. * Returns: 0 on success, -1 on failure
  2017. *
  2018. * This command can be used to request the driver to transmit an action
  2019. * frame to the specified destination.
  2020. *
  2021. * If the %WPA_DRIVER_FLAGS_OFFCHANNEL_TX flag is set, the frame will
  2022. * be transmitted on the given channel and the device will wait for a
  2023. * response on that channel for the given wait time.
  2024. *
  2025. * If the flag is not set, the wait time will be ignored. In this case,
  2026. * if a remain-on-channel duration is in progress, the frame must be
  2027. * transmitted on that channel; alternatively the frame may be sent on
  2028. * the current operational channel (if in associated state in station
  2029. * mode or while operating as an AP.)
  2030. */
  2031. int (*send_action)(void *priv, unsigned int freq, unsigned int wait,
  2032. const u8 *dst, const u8 *src, const u8 *bssid,
  2033. const u8 *data, size_t data_len, int no_cck);
  2034. /**
  2035. * send_action_cancel_wait - Cancel action frame TX wait
  2036. * @priv: Private driver interface data
  2037. *
  2038. * This command cancels the wait time associated with sending an action
  2039. * frame. It is only available when %WPA_DRIVER_FLAGS_OFFCHANNEL_TX is
  2040. * set in the driver flags.
  2041. */
  2042. void (*send_action_cancel_wait)(void *priv);
  2043. /**
  2044. * remain_on_channel - Remain awake on a channel
  2045. * @priv: Private driver interface data
  2046. * @freq: Frequency (in MHz) of the channel
  2047. * @duration: Duration in milliseconds
  2048. * Returns: 0 on success, -1 on failure
  2049. *
  2050. * This command is used to request the driver to remain awake on the
  2051. * specified channel for the specified duration and report received
  2052. * Action frames with EVENT_RX_MGMT events. Optionally, received
  2053. * Probe Request frames may also be requested to be reported by calling
  2054. * probe_req_report(). These will be reported with EVENT_RX_PROBE_REQ.
  2055. *
  2056. * The driver may not be at the requested channel when this function
  2057. * returns, i.e., the return code is only indicating whether the
  2058. * request was accepted. The caller will need to wait until the
  2059. * EVENT_REMAIN_ON_CHANNEL event indicates that the driver has
  2060. * completed the channel change. This may take some time due to other
  2061. * need for the radio and the caller should be prepared to timing out
  2062. * its wait since there are no guarantees on when this request can be
  2063. * executed.
  2064. */
  2065. int (*remain_on_channel)(void *priv, unsigned int freq,
  2066. unsigned int duration);
  2067. /**
  2068. * cancel_remain_on_channel - Cancel remain-on-channel operation
  2069. * @priv: Private driver interface data
  2070. *
  2071. * This command can be used to cancel a remain-on-channel operation
  2072. * before its originally requested duration has passed. This could be
  2073. * used, e.g., when remain_on_channel() is used to request extra time
  2074. * to receive a response to an Action frame and the response is
  2075. * received when there is still unneeded time remaining on the
  2076. * remain-on-channel operation.
  2077. */
  2078. int (*cancel_remain_on_channel)(void *priv);
  2079. /**
  2080. * probe_req_report - Request Probe Request frames to be indicated
  2081. * @priv: Private driver interface data
  2082. * @report: Whether to report received Probe Request frames
  2083. * Returns: 0 on success, -1 on failure (or if not supported)
  2084. *
  2085. * This command can be used to request the driver to indicate when
  2086. * Probe Request frames are received with EVENT_RX_PROBE_REQ events.
  2087. * Since this operation may require extra resources, e.g., due to less
  2088. * optimal hardware/firmware RX filtering, many drivers may disable
  2089. * Probe Request reporting at least in station mode. This command is
  2090. * used to notify the driver when the Probe Request frames need to be
  2091. * reported, e.g., during remain-on-channel operations.
  2092. */
  2093. int (*probe_req_report)(void *priv, int report);
  2094. /**
  2095. * deinit_ap - Deinitialize AP mode
  2096. * @priv: Private driver interface data
  2097. * Returns: 0 on success, -1 on failure (or if not supported)
  2098. *
  2099. * This optional function can be used to disable AP mode related
  2100. * configuration. If the interface was not dynamically added,
  2101. * change the driver mode to station mode to allow normal station
  2102. * operations like scanning to be completed.
  2103. */
  2104. int (*deinit_ap)(void *priv);
  2105. /**
  2106. * deinit_p2p_cli - Deinitialize P2P client mode
  2107. * @priv: Private driver interface data
  2108. * Returns: 0 on success, -1 on failure (or if not supported)
  2109. *
  2110. * This optional function can be used to disable P2P client mode. If the
  2111. * interface was not dynamically added, change the interface type back
  2112. * to station mode.
  2113. */
  2114. int (*deinit_p2p_cli)(void *priv);
  2115. /**
  2116. * suspend - Notification on system suspend/hibernate event
  2117. * @priv: Private driver interface data
  2118. */
  2119. void (*suspend)(void *priv);
  2120. /**
  2121. * resume - Notification on system resume/thaw event
  2122. * @priv: Private driver interface data
  2123. */
  2124. void (*resume)(void *priv);
  2125. /**
  2126. * signal_monitor - Set signal monitoring parameters
  2127. * @priv: Private driver interface data
  2128. * @threshold: Threshold value for signal change events; 0 = disabled
  2129. * @hysteresis: Minimum change in signal strength before indicating a
  2130. * new event
  2131. * Returns: 0 on success, -1 on failure (or if not supported)
  2132. *
  2133. * This function can be used to configure monitoring of signal strength
  2134. * with the current AP. Whenever signal strength drops below the
  2135. * %threshold value or increases above it, EVENT_SIGNAL_CHANGE event
  2136. * should be generated assuming the signal strength has changed at
  2137. * least %hysteresis from the previously indicated signal change event.
  2138. */
  2139. int (*signal_monitor)(void *priv, int threshold, int hysteresis);
  2140. /**
  2141. * send_frame - Send IEEE 802.11 frame (testing use only)
  2142. * @priv: Private driver interface data
  2143. * @data: IEEE 802.11 frame with IEEE 802.11 header
  2144. * @data_len: Size of the frame
  2145. * @encrypt: Whether to encrypt the frame (if keys are set)
  2146. * Returns: 0 on success, -1 on failure
  2147. *
  2148. * This function is only used for debugging purposes and is not
  2149. * required to be implemented for normal operations.
  2150. */
  2151. int (*send_frame)(void *priv, const u8 *data, size_t data_len,
  2152. int encrypt);
  2153. /**
  2154. * shared_freq - Get operating frequency of shared interface(s)
  2155. * @priv: Private driver interface data
  2156. * Returns: Operating frequency in MHz, 0 if no shared operation in
  2157. * use, or -1 on failure
  2158. *
  2159. * This command can be used to request the current operating frequency
  2160. * of any virtual interface that shares the same radio to provide
  2161. * information for channel selection for other virtual interfaces.
  2162. */
  2163. int (*shared_freq)(void *priv);
  2164. /**
  2165. * get_noa - Get current Notice of Absence attribute payload
  2166. * @priv: Private driver interface data
  2167. * @buf: Buffer for returning NoA
  2168. * @buf_len: Buffer length in octets
  2169. * Returns: Number of octets used in buf, 0 to indicate no NoA is being
  2170. * advertized, or -1 on failure
  2171. *
  2172. * This function is used to fetch the current Notice of Absence
  2173. * attribute value from GO.
  2174. */
  2175. int (*get_noa)(void *priv, u8 *buf, size_t buf_len);
  2176. /**
  2177. * set_noa - Set Notice of Absence parameters for GO (testing)
  2178. * @priv: Private driver interface data
  2179. * @count: Count
  2180. * @start: Start time in ms from next TBTT
  2181. * @duration: Duration in ms
  2182. * Returns: 0 on success or -1 on failure
  2183. *
  2184. * This function is used to set Notice of Absence parameters for GO. It
  2185. * is used only for testing. To disable NoA, all parameters are set to
  2186. * 0.
  2187. */
  2188. int (*set_noa)(void *priv, u8 count, int start, int duration);
  2189. /**
  2190. * set_p2p_powersave - Set P2P power save options
  2191. * @priv: Private driver interface data
  2192. * @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change
  2193. * @opp_ps: 0 = disable, 1 = enable, -1 = no change
  2194. * @ctwindow: 0.. = change (msec), -1 = no change
  2195. * Returns: 0 on success or -1 on failure
  2196. */
  2197. int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
  2198. int ctwindow);
  2199. /**
  2200. * ampdu - Enable/disable aggregation
  2201. * @priv: Private driver interface data
  2202. * @ampdu: 1/0 = enable/disable A-MPDU aggregation
  2203. * Returns: 0 on success or -1 on failure
  2204. */
  2205. int (*ampdu)(void *priv, int ampdu);
  2206. /**
  2207. * get_radio_name - Get physical radio name for the device
  2208. * @priv: Private driver interface data
  2209. * Returns: Radio name or %NULL if not known
  2210. *
  2211. * The returned data must not be modified by the caller. It is assumed
  2212. * that any interface that has the same radio name as another is
  2213. * sharing the same physical radio. This information can be used to
  2214. * share scan results etc. information between the virtual interfaces
  2215. * to speed up various operations.
  2216. */
  2217. const char * (*get_radio_name)(void *priv);
  2218. /**
  2219. * send_tdls_mgmt - for sending TDLS management packets
  2220. * @priv: private driver interface data
  2221. * @dst: Destination (peer) MAC address
  2222. * @action_code: TDLS action code for the mssage
  2223. * @dialog_token: Dialog Token to use in the message (if needed)
  2224. * @status_code: Status Code or Reason Code to use (if needed)
  2225. * @peer_capab: TDLS peer capability (TDLS_PEER_* bitfield)
  2226. * @buf: TDLS IEs to add to the message
  2227. * @len: Length of buf in octets
  2228. * Returns: 0 on success, negative (<0) on failure
  2229. *
  2230. * This optional function can be used to send packet to driver which is
  2231. * responsible for receiving and sending all TDLS packets.
  2232. */
  2233. int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
  2234. u8 dialog_token, u16 status_code, u32 peer_capab,
  2235. const u8 *buf, size_t len);
  2236. /**
  2237. * tdls_oper - Ask the driver to perform high-level TDLS operations
  2238. * @priv: Private driver interface data
  2239. * @oper: TDLS high-level operation. See %enum tdls_oper
  2240. * @peer: Destination (peer) MAC address
  2241. * Returns: 0 on success, negative (<0) on failure
  2242. *
  2243. * This optional function can be used to send high-level TDLS commands
  2244. * to the driver.
  2245. */
  2246. int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
  2247. /**
  2248. * wnm_oper - Notify driver of the WNM frame reception
  2249. * @priv: Private driver interface data
  2250. * @oper: WNM operation. See %enum wnm_oper
  2251. * @peer: Destination (peer) MAC address
  2252. * @buf: Buffer for the driver to fill in (for getting IE)
  2253. * @buf_len: Return the len of buf
  2254. * Returns: 0 on success, negative (<0) on failure
  2255. */
  2256. int (*wnm_oper)(void *priv, enum wnm_oper oper, const u8 *peer,
  2257. u8 *buf, u16 *buf_len);
  2258. /**
  2259. * set_qos_map - Set QoS Map
  2260. * @priv: Private driver interface data
  2261. * @qos_map_set: QoS Map
  2262. * @qos_map_set_len: Length of QoS Map
  2263. */
  2264. int (*set_qos_map)(void *priv, const u8 *qos_map_set,
  2265. u8 qos_map_set_len);
  2266. /**
  2267. * signal_poll - Get current connection information
  2268. * @priv: Private driver interface data
  2269. * @signal_info: Connection info structure
  2270. */
  2271. int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
  2272. /**
  2273. * set_authmode - Set authentication algorithm(s) for static WEP
  2274. * @priv: Private driver interface data
  2275. * @authmode: 1=Open System, 2=Shared Key, 3=both
  2276. * Returns: 0 on success, -1 on failure
  2277. *
  2278. * This function can be used to set authentication algorithms for AP
  2279. * mode when static WEP is used. If the driver uses user space MLME/SME
  2280. * implementation, there is no need to implement this function.
  2281. *
  2282. * DEPRECATED - use set_ap() instead
  2283. */
  2284. int (*set_authmode)(void *priv, int authmode);
  2285. #ifdef ANDROID
  2286. /**
  2287. * driver_cmd - Execute driver-specific command
  2288. * @priv: Private driver interface data
  2289. * @cmd: Command to execute
  2290. * @buf: Return buffer
  2291. * @buf_len: Buffer length
  2292. * Returns: 0 on success, -1 on failure
  2293. */
  2294. int (*driver_cmd)(void *priv, char *cmd, char *buf, size_t buf_len);
  2295. #endif /* ANDROID */
  2296. /**
  2297. * vendor_cmd - Execute vendor specific command
  2298. * @priv: Private driver interface data
  2299. * @vendor_id: Vendor id
  2300. * @subcmd: Vendor command id
  2301. * @data: Vendor command parameters (%NULL if no parameters)
  2302. * @data_len: Data length
  2303. * @buf: Return buffer (%NULL to ignore reply)
  2304. * Returns: 0 on success, negative (<0) on failure
  2305. *
  2306. * This function handles vendor specific commands that are passed to
  2307. * the driver/device. The command is identified by vendor id and
  2308. * command id. Parameters can be passed as argument to the command
  2309. * in the data buffer. Reply (if any) will be filled in the supplied
  2310. * return buffer.
  2311. *
  2312. * The exact driver behavior is driver interface and vendor specific. As
  2313. * an example, this will be converted to a vendor specific cfg80211
  2314. * command in case of the nl80211 driver interface.
  2315. */
  2316. int (*vendor_cmd)(void *priv, unsigned int vendor_id,
  2317. unsigned int subcmd, const u8 *data, size_t data_len,
  2318. struct wpabuf *buf);
  2319. /**
  2320. * set_rekey_info - Set rekey information
  2321. * @priv: Private driver interface data
  2322. * @kek: Current KEK
  2323. * @kck: Current KCK
  2324. * @replay_ctr: Current EAPOL-Key Replay Counter
  2325. *
  2326. * This optional function can be used to provide information for the
  2327. * driver/firmware to process EAPOL-Key frames in Group Key Handshake
  2328. * while the host (including wpa_supplicant) is sleeping.
  2329. */
  2330. void (*set_rekey_info)(void *priv, const u8 *kek, const u8 *kck,
  2331. const u8 *replay_ctr);
  2332. /**
  2333. * sta_assoc - Station association indication
  2334. * @priv: Private driver interface data
  2335. * @own_addr: Source address and BSSID for association frame
  2336. * @addr: MAC address of the station to associate
  2337. * @reassoc: flag to indicate re-association
  2338. * @status: association response status code
  2339. * @ie: assoc response ie buffer
  2340. * @len: ie buffer length
  2341. * Returns: 0 on success, -1 on failure
  2342. *
  2343. * This function indicates the driver to send (Re)Association
  2344. * Response frame to the station.
  2345. */
  2346. int (*sta_assoc)(void *priv, const u8 *own_addr, const u8 *addr,
  2347. int reassoc, u16 status, const u8 *ie, size_t len);
  2348. /**
  2349. * sta_auth - Station authentication indication
  2350. * @priv: Private driver interface data
  2351. * @own_addr: Source address and BSSID for authentication frame
  2352. * @addr: MAC address of the station to associate
  2353. * @seq: authentication sequence number
  2354. * @status: authentication response status code
  2355. * @ie: authentication frame ie buffer
  2356. * @len: ie buffer length
  2357. *
  2358. * This function indicates the driver to send Authentication frame
  2359. * to the station.
  2360. */
  2361. int (*sta_auth)(void *priv, const u8 *own_addr, const u8 *addr,
  2362. u16 seq, u16 status, const u8 *ie, size_t len);
  2363. /**
  2364. * add_tspec - Add traffic stream
  2365. * @priv: Private driver interface data
  2366. * @addr: MAC address of the station to associate
  2367. * @tspec_ie: tspec ie buffer
  2368. * @tspec_ielen: tspec ie length
  2369. * Returns: 0 on success, -1 on failure
  2370. *
  2371. * This function adds the traffic steam for the station
  2372. * and fills the medium_time in tspec_ie.
  2373. */
  2374. int (*add_tspec)(void *priv, const u8 *addr, u8 *tspec_ie,
  2375. size_t tspec_ielen);
  2376. /**
  2377. * add_sta_node - Add a station node in the driver
  2378. * @priv: Private driver interface data
  2379. * @addr: MAC address of the station to add
  2380. * @auth_alg: authentication algorithm used by the station
  2381. * Returns: 0 on success, -1 on failure
  2382. *
  2383. * This function adds the station node in the driver, when
  2384. * the station gets added by FT-over-DS.
  2385. */
  2386. int (*add_sta_node)(void *priv, const u8 *addr, u16 auth_alg);
  2387. /**
  2388. * sched_scan - Request the driver to initiate scheduled scan
  2389. * @priv: Private driver interface data
  2390. * @params: Scan parameters
  2391. * @interval: Interval between scan cycles in milliseconds
  2392. * Returns: 0 on success, -1 on failure
  2393. *
  2394. * This operation should be used for scheduled scan offload to
  2395. * the hardware. Every time scan results are available, the
  2396. * driver should report scan results event for wpa_supplicant
  2397. * which will eventually request the results with
  2398. * wpa_driver_get_scan_results2(). This operation is optional
  2399. * and if not provided or if it returns -1, we fall back to
  2400. * normal host-scheduled scans.
  2401. */
  2402. int (*sched_scan)(void *priv, struct wpa_driver_scan_params *params,
  2403. u32 interval);
  2404. /**
  2405. * stop_sched_scan - Request the driver to stop a scheduled scan
  2406. * @priv: Private driver interface data
  2407. * Returns: 0 on success, -1 on failure
  2408. *
  2409. * This should cause the scheduled scan to be stopped and
  2410. * results should stop being sent. Must be supported if
  2411. * sched_scan is supported.
  2412. */
  2413. int (*stop_sched_scan)(void *priv);
  2414. /**
  2415. * poll_client - Probe (null data or such) the given station
  2416. * @priv: Private driver interface data
  2417. * @own_addr: MAC address of sending interface
  2418. * @addr: MAC address of the station to probe
  2419. * @qos: Indicates whether station is QoS station
  2420. *
  2421. * This function is used to verify whether an associated station is
  2422. * still present. This function does not need to be implemented if the
  2423. * driver provides such inactivity polling mechanism.
  2424. */
  2425. void (*poll_client)(void *priv, const u8 *own_addr,
  2426. const u8 *addr, int qos);
  2427. /**
  2428. * radio_disable - Disable/enable radio
  2429. * @priv: Private driver interface data
  2430. * @disabled: 1=disable 0=enable radio
  2431. * Returns: 0 on success, -1 on failure
  2432. *
  2433. * This optional command is for testing purposes. It can be used to
  2434. * disable the radio on a testbed device to simulate out-of-radio-range
  2435. * conditions.
  2436. */
  2437. int (*radio_disable)(void *priv, int disabled);
  2438. /**
  2439. * switch_channel - Announce channel switch and migrate the GO to the
  2440. * given frequency
  2441. * @priv: Private driver interface data
  2442. * @settings: Settings for CSA period and new channel
  2443. * Returns: 0 on success, -1 on failure
  2444. *
  2445. * This function is used to move the GO to the legacy STA channel to
  2446. * avoid frequency conflict in single channel concurrency.
  2447. */
  2448. int (*switch_channel)(void *priv, struct csa_settings *settings);
  2449. /**
  2450. * start_dfs_cac - Listen for radar interference on the channel
  2451. * @priv: Private driver interface data
  2452. * @freq: Channel parameters
  2453. * Returns: 0 on success, -1 on failure
  2454. */
  2455. int (*start_dfs_cac)(void *priv, struct hostapd_freq_params *freq);
  2456. /**
  2457. * stop_ap - Removes beacon from AP
  2458. * @priv: Private driver interface data
  2459. * Returns: 0 on success, -1 on failure (or if not supported)
  2460. *
  2461. * This optional function can be used to disable AP mode related
  2462. * configuration. Unlike deinit_ap, it does not change to station
  2463. * mode.
  2464. */
  2465. int (*stop_ap)(void *priv);
  2466. /**
  2467. * get_survey - Retrieve survey data
  2468. * @priv: Private driver interface data
  2469. * @freq: If set, survey data for the specified frequency is only
  2470. * being requested. If not set, all survey data is requested.
  2471. * Returns: 0 on success, -1 on failure
  2472. *
  2473. * Use this to retrieve:
  2474. *
  2475. * - the observed channel noise floor
  2476. * - the amount of time we have spent on the channel
  2477. * - the amount of time during which we have spent on the channel that
  2478. * the radio has determined the medium is busy and we cannot
  2479. * transmit
  2480. * - the amount of time we have spent receiving data
  2481. * - the amount of time we have spent transmitting data
  2482. *
  2483. * This data can be used for spectrum heuristics. One example is
  2484. * Automatic Channel Selection (ACS). The channel survey data is
  2485. * kept on a linked list on the channel data, one entry is added
  2486. * for each survey. The min_nf of the channel is updated for each
  2487. * survey.
  2488. */
  2489. int (*get_survey)(void *priv, unsigned int freq);
  2490. /**
  2491. * status - Get driver interface status information
  2492. * @priv: Private driver interface data
  2493. * @buf: Buffer for printing tou the status information
  2494. * @buflen: Maximum length of the buffer
  2495. * Returns: Length of written status information or -1 on failure
  2496. */
  2497. int (*status)(void *priv, char *buf, size_t buflen);
  2498. };
  2499. /**
  2500. * enum wpa_event_type - Event type for wpa_supplicant_event() calls
  2501. */
  2502. enum wpa_event_type {
  2503. /**
  2504. * EVENT_ASSOC - Association completed
  2505. *
  2506. * This event needs to be delivered when the driver completes IEEE
  2507. * 802.11 association or reassociation successfully.
  2508. * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
  2509. * after this event has been generated. In addition, optional
  2510. * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
  2511. * more information about the association. If the driver interface gets
  2512. * both of these events at the same time, it can also include the
  2513. * assoc_info data in EVENT_ASSOC call.
  2514. */
  2515. EVENT_ASSOC,
  2516. /**
  2517. * EVENT_DISASSOC - Association lost
  2518. *
  2519. * This event should be called when association is lost either due to
  2520. * receiving deauthenticate or disassociate frame from the AP or when
  2521. * sending either of these frames to the current AP. If the driver
  2522. * supports separate deauthentication event, EVENT_DISASSOC should only
  2523. * be used for disassociation and EVENT_DEAUTH for deauthentication.
  2524. * In AP mode, union wpa_event_data::disassoc_info is required.
  2525. */
  2526. EVENT_DISASSOC,
  2527. /**
  2528. * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
  2529. *
  2530. * This event must be delivered when a Michael MIC error is detected by
  2531. * the local driver. Additional data for event processing is
  2532. * provided with union wpa_event_data::michael_mic_failure. This
  2533. * information is used to request new encyption key and to initiate
  2534. * TKIP countermeasures if needed.
  2535. */
  2536. EVENT_MICHAEL_MIC_FAILURE,
  2537. /**
  2538. * EVENT_SCAN_RESULTS - Scan results available
  2539. *
  2540. * This event must be called whenever scan results are available to be
  2541. * fetched with struct wpa_driver_ops::get_scan_results(). This event
  2542. * is expected to be used some time after struct wpa_driver_ops::scan()
  2543. * is called. If the driver provides an unsolicited event when the scan
  2544. * has been completed, this event can be used to trigger
  2545. * EVENT_SCAN_RESULTS call. If such event is not available from the
  2546. * driver, the driver wrapper code is expected to use a registered
  2547. * timeout to generate EVENT_SCAN_RESULTS call after the time that the
  2548. * scan is expected to be completed. Optional information about
  2549. * completed scan can be provided with union wpa_event_data::scan_info.
  2550. */
  2551. EVENT_SCAN_RESULTS,
  2552. /**
  2553. * EVENT_ASSOCINFO - Report optional extra information for association
  2554. *
  2555. * This event can be used to report extra association information for
  2556. * EVENT_ASSOC processing. This extra information includes IEs from
  2557. * association frames and Beacon/Probe Response frames in union
  2558. * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
  2559. * EVENT_ASSOC. Alternatively, the driver interface can include
  2560. * assoc_info data in the EVENT_ASSOC call if it has all the
  2561. * information available at the same point.
  2562. */
  2563. EVENT_ASSOCINFO,
  2564. /**
  2565. * EVENT_INTERFACE_STATUS - Report interface status changes
  2566. *
  2567. * This optional event can be used to report changes in interface
  2568. * status (interface added/removed) using union
  2569. * wpa_event_data::interface_status. This can be used to trigger
  2570. * wpa_supplicant to stop and re-start processing for the interface,
  2571. * e.g., when a cardbus card is ejected/inserted.
  2572. */
  2573. EVENT_INTERFACE_STATUS,
  2574. /**
  2575. * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
  2576. *
  2577. * This event can be used to inform wpa_supplicant about candidates for
  2578. * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
  2579. * for scan request (ap_scan=2 mode), this event is required for
  2580. * pre-authentication. If wpa_supplicant is performing scan request
  2581. * (ap_scan=1), this event is optional since scan results can be used
  2582. * to add pre-authentication candidates. union
  2583. * wpa_event_data::pmkid_candidate is used to report the BSSID of the
  2584. * candidate and priority of the candidate, e.g., based on the signal
  2585. * strength, in order to try to pre-authenticate first with candidates
  2586. * that are most likely targets for re-association.
  2587. *
  2588. * EVENT_PMKID_CANDIDATE can be called whenever the driver has updates
  2589. * on the candidate list. In addition, it can be called for the current
  2590. * AP and APs that have existing PMKSA cache entries. wpa_supplicant
  2591. * will automatically skip pre-authentication in cases where a valid
  2592. * PMKSA exists. When more than one candidate exists, this event should
  2593. * be generated once for each candidate.
  2594. *
  2595. * Driver will be notified about successful pre-authentication with
  2596. * struct wpa_driver_ops::add_pmkid() calls.
  2597. */
  2598. EVENT_PMKID_CANDIDATE,
  2599. /**
  2600. * EVENT_STKSTART - Request STK handshake (MLME-STKSTART.request)
  2601. *
  2602. * This event can be used to inform wpa_supplicant about desire to set
  2603. * up secure direct link connection between two stations as defined in
  2604. * IEEE 802.11e with a new PeerKey mechanism that replaced the original
  2605. * STAKey negotiation. The caller will need to set peer address for the
  2606. * event.
  2607. */
  2608. EVENT_STKSTART,
  2609. /**
  2610. * EVENT_TDLS - Request TDLS operation
  2611. *
  2612. * This event can be used to request a TDLS operation to be performed.
  2613. */
  2614. EVENT_TDLS,
  2615. /**
  2616. * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
  2617. *
  2618. * The driver is expected to report the received FT IEs from
  2619. * FT authentication sequence from the AP. The FT IEs are included in
  2620. * the extra information in union wpa_event_data::ft_ies.
  2621. */
  2622. EVENT_FT_RESPONSE,
  2623. /**
  2624. * EVENT_IBSS_RSN_START - Request RSN authentication in IBSS
  2625. *
  2626. * The driver can use this event to inform wpa_supplicant about a STA
  2627. * in an IBSS with which protected frames could be exchanged. This
  2628. * event starts RSN authentication with the other STA to authenticate
  2629. * the STA and set up encryption keys with it.
  2630. */
  2631. EVENT_IBSS_RSN_START,
  2632. /**
  2633. * EVENT_AUTH - Authentication result
  2634. *
  2635. * This event should be called when authentication attempt has been
  2636. * completed. This is only used if the driver supports separate
  2637. * authentication step (struct wpa_driver_ops::authenticate).
  2638. * Information about authentication result is included in
  2639. * union wpa_event_data::auth.
  2640. */
  2641. EVENT_AUTH,
  2642. /**
  2643. * EVENT_DEAUTH - Authentication lost
  2644. *
  2645. * This event should be called when authentication is lost either due
  2646. * to receiving deauthenticate frame from the AP or when sending that
  2647. * frame to the current AP.
  2648. * In AP mode, union wpa_event_data::deauth_info is required.
  2649. */
  2650. EVENT_DEAUTH,
  2651. /**
  2652. * EVENT_ASSOC_REJECT - Association rejected
  2653. *
  2654. * This event should be called when (re)association attempt has been
  2655. * rejected by the AP. Information about the association response is
  2656. * included in union wpa_event_data::assoc_reject.
  2657. */
  2658. EVENT_ASSOC_REJECT,
  2659. /**
  2660. * EVENT_AUTH_TIMED_OUT - Authentication timed out
  2661. */
  2662. EVENT_AUTH_TIMED_OUT,
  2663. /**
  2664. * EVENT_ASSOC_TIMED_OUT - Association timed out
  2665. */
  2666. EVENT_ASSOC_TIMED_OUT,
  2667. /**
  2668. * EVENT_FT_RRB_RX - FT (IEEE 802.11r) RRB frame received
  2669. */
  2670. EVENT_FT_RRB_RX,
  2671. /**
  2672. * EVENT_WPS_BUTTON_PUSHED - Report hardware push button press for WPS
  2673. */
  2674. EVENT_WPS_BUTTON_PUSHED,
  2675. /**
  2676. * EVENT_TX_STATUS - Report TX status
  2677. */
  2678. EVENT_TX_STATUS,
  2679. /**
  2680. * EVENT_RX_FROM_UNKNOWN - Report RX from unknown STA
  2681. */
  2682. EVENT_RX_FROM_UNKNOWN,
  2683. /**
  2684. * EVENT_RX_MGMT - Report RX of a management frame
  2685. */
  2686. EVENT_RX_MGMT,
  2687. /**
  2688. * EVENT_REMAIN_ON_CHANNEL - Remain-on-channel duration started
  2689. *
  2690. * This event is used to indicate when the driver has started the
  2691. * requested remain-on-channel duration. Information about the
  2692. * operation is included in union wpa_event_data::remain_on_channel.
  2693. */
  2694. EVENT_REMAIN_ON_CHANNEL,
  2695. /**
  2696. * EVENT_CANCEL_REMAIN_ON_CHANNEL - Remain-on-channel timed out
  2697. *
  2698. * This event is used to indicate when the driver has completed
  2699. * remain-on-channel duration, i.e., may noot be available on the
  2700. * requested channel anymore. Information about the
  2701. * operation is included in union wpa_event_data::remain_on_channel.
  2702. */
  2703. EVENT_CANCEL_REMAIN_ON_CHANNEL,
  2704. /**
  2705. * EVENT_MLME_RX - Report reception of frame for MLME (test use only)
  2706. *
  2707. * This event is used only by driver_test.c and userspace MLME.
  2708. */
  2709. EVENT_MLME_RX,
  2710. /**
  2711. * EVENT_RX_PROBE_REQ - Indicate received Probe Request frame
  2712. *
  2713. * This event is used to indicate when a Probe Request frame has been
  2714. * received. Information about the received frame is included in
  2715. * union wpa_event_data::rx_probe_req. The driver is required to report
  2716. * these events only after successfully completed probe_req_report()
  2717. * commands to request the events (i.e., report parameter is non-zero)
  2718. * in station mode. In AP mode, Probe Request frames should always be
  2719. * reported.
  2720. */
  2721. EVENT_RX_PROBE_REQ,
  2722. /**
  2723. * EVENT_NEW_STA - New wired device noticed
  2724. *
  2725. * This event is used to indicate that a new device has been detected
  2726. * in a network that does not use association-like functionality (i.e.,
  2727. * mainly wired Ethernet). This can be used to start EAPOL
  2728. * authenticator when receiving a frame from a device. The address of
  2729. * the device is included in union wpa_event_data::new_sta.
  2730. */
  2731. EVENT_NEW_STA,
  2732. /**
  2733. * EVENT_EAPOL_RX - Report received EAPOL frame
  2734. *
  2735. * When in AP mode with hostapd, this event is required to be used to
  2736. * deliver the receive EAPOL frames from the driver. With
  2737. * %wpa_supplicant, this event is used only if the send_eapol() handler
  2738. * is used to override the use of l2_packet for EAPOL frame TX.
  2739. */
  2740. EVENT_EAPOL_RX,
  2741. /**
  2742. * EVENT_SIGNAL_CHANGE - Indicate change in signal strength
  2743. *
  2744. * This event is used to indicate changes in the signal strength
  2745. * observed in frames received from the current AP if signal strength
  2746. * monitoring has been enabled with signal_monitor().
  2747. */
  2748. EVENT_SIGNAL_CHANGE,
  2749. /**
  2750. * EVENT_INTERFACE_ENABLED - Notify that interface was enabled
  2751. *
  2752. * This event is used to indicate that the interface was enabled after
  2753. * having been previously disabled, e.g., due to rfkill.
  2754. */
  2755. EVENT_INTERFACE_ENABLED,
  2756. /**
  2757. * EVENT_INTERFACE_DISABLED - Notify that interface was disabled
  2758. *
  2759. * This event is used to indicate that the interface was disabled,
  2760. * e.g., due to rfkill.
  2761. */
  2762. EVENT_INTERFACE_DISABLED,
  2763. /**
  2764. * EVENT_CHANNEL_LIST_CHANGED - Channel list changed
  2765. *
  2766. * This event is used to indicate that the channel list has changed,
  2767. * e.g., because of a regulatory domain change triggered by scan
  2768. * results including an AP advertising a country code.
  2769. */
  2770. EVENT_CHANNEL_LIST_CHANGED,
  2771. /**
  2772. * EVENT_INTERFACE_UNAVAILABLE - Notify that interface is unavailable
  2773. *
  2774. * This event is used to indicate that the driver cannot maintain this
  2775. * interface in its operation mode anymore. The most likely use for
  2776. * this is to indicate that AP mode operation is not available due to
  2777. * operating channel would need to be changed to a DFS channel when
  2778. * the driver does not support radar detection and another virtual
  2779. * interfaces caused the operating channel to change. Other similar
  2780. * resource conflicts could also trigger this for station mode
  2781. * interfaces.
  2782. */
  2783. EVENT_INTERFACE_UNAVAILABLE,
  2784. /**
  2785. * EVENT_BEST_CHANNEL
  2786. *
  2787. * Driver generates this event whenever it detects a better channel
  2788. * (e.g., based on RSSI or channel use). This information can be used
  2789. * to improve channel selection for a new AP/P2P group.
  2790. */
  2791. EVENT_BEST_CHANNEL,
  2792. /**
  2793. * EVENT_UNPROT_DEAUTH - Unprotected Deauthentication frame received
  2794. *
  2795. * This event should be called when a Deauthentication frame is dropped
  2796. * due to it not being protected (MFP/IEEE 802.11w).
  2797. * union wpa_event_data::unprot_deauth is required to provide more
  2798. * details of the frame.
  2799. */
  2800. EVENT_UNPROT_DEAUTH,
  2801. /**
  2802. * EVENT_UNPROT_DISASSOC - Unprotected Disassociation frame received
  2803. *
  2804. * This event should be called when a Disassociation frame is dropped
  2805. * due to it not being protected (MFP/IEEE 802.11w).
  2806. * union wpa_event_data::unprot_disassoc is required to provide more
  2807. * details of the frame.
  2808. */
  2809. EVENT_UNPROT_DISASSOC,
  2810. /**
  2811. * EVENT_STATION_LOW_ACK
  2812. *
  2813. * Driver generates this event whenever it detected that a particular
  2814. * station was lost. Detection can be through massive transmission
  2815. * failures for example.
  2816. */
  2817. EVENT_STATION_LOW_ACK,
  2818. /**
  2819. * EVENT_IBSS_PEER_LOST - IBSS peer not reachable anymore
  2820. */
  2821. EVENT_IBSS_PEER_LOST,
  2822. /**
  2823. * EVENT_DRIVER_GTK_REKEY - Device/driver did GTK rekey
  2824. *
  2825. * This event carries the new replay counter to notify wpa_supplicant
  2826. * of the current EAPOL-Key Replay Counter in case the driver/firmware
  2827. * completed Group Key Handshake while the host (including
  2828. * wpa_supplicant was sleeping).
  2829. */
  2830. EVENT_DRIVER_GTK_REKEY,
  2831. /**
  2832. * EVENT_SCHED_SCAN_STOPPED - Scheduled scan was stopped
  2833. */
  2834. EVENT_SCHED_SCAN_STOPPED,
  2835. /**
  2836. * EVENT_DRIVER_CLIENT_POLL_OK - Station responded to poll
  2837. *
  2838. * This event indicates that the station responded to the poll
  2839. * initiated with @poll_client.
  2840. */
  2841. EVENT_DRIVER_CLIENT_POLL_OK,
  2842. /**
  2843. * EVENT_EAPOL_TX_STATUS - notify of EAPOL TX status
  2844. */
  2845. EVENT_EAPOL_TX_STATUS,
  2846. /**
  2847. * EVENT_CH_SWITCH - AP or GO decided to switch channels
  2848. *
  2849. * Described in wpa_event_data.ch_switch
  2850. * */
  2851. EVENT_CH_SWITCH,
  2852. /**
  2853. * EVENT_WNM - Request WNM operation
  2854. *
  2855. * This event can be used to request a WNM operation to be performed.
  2856. */
  2857. EVENT_WNM,
  2858. /**
  2859. * EVENT_CONNECT_FAILED_REASON - Connection failure reason in AP mode
  2860. *
  2861. * This event indicates that the driver reported a connection failure
  2862. * with the specified client (for example, max client reached, etc.) in
  2863. * AP mode.
  2864. */
  2865. EVENT_CONNECT_FAILED_REASON,
  2866. /**
  2867. * EVENT_RADAR_DETECTED - Notify of radar detection
  2868. *
  2869. * A radar has been detected on the supplied frequency, hostapd should
  2870. * react accordingly (e.g., change channel).
  2871. */
  2872. EVENT_DFS_RADAR_DETECTED,
  2873. /**
  2874. * EVENT_CAC_FINISHED - Notify that channel availability check has been completed
  2875. *
  2876. * After a successful CAC, the channel can be marked clear and used.
  2877. */
  2878. EVENT_DFS_CAC_FINISHED,
  2879. /**
  2880. * EVENT_CAC_ABORTED - Notify that channel availability check has been aborted
  2881. *
  2882. * The CAC was not successful, and the channel remains in the previous
  2883. * state. This may happen due to a radar beeing detected or other
  2884. * external influences.
  2885. */
  2886. EVENT_DFS_CAC_ABORTED,
  2887. /**
  2888. * EVENT_DFS_CAC_NOP_FINISHED - Notify that non-occupancy period is over
  2889. *
  2890. * The channel which was previously unavailable is now available again.
  2891. */
  2892. EVENT_DFS_NOP_FINISHED,
  2893. /**
  2894. * EVENT_SURVEY - Received survey data
  2895. *
  2896. * This event gets triggered when a driver query is issued for survey
  2897. * data and the requested data becomes available. The returned data is
  2898. * stored in struct survey_results. The results provide at most one
  2899. * survey entry for each frequency and at minimum will provide one
  2900. * survey entry for one frequency. The survey data can be os_malloc()'d
  2901. * and then os_free()'d, so the event callback must only copy data.
  2902. */
  2903. EVENT_SURVEY,
  2904. /**
  2905. * EVENT_SCAN_STARTED - Scan started
  2906. *
  2907. * This indicates that driver has started a scan operation either based
  2908. * on a request from wpa_supplicant/hostapd or from another application.
  2909. * EVENT_SCAN_RESULTS is used to indicate when the scan has been
  2910. * completed (either successfully or by getting cancelled).
  2911. */
  2912. EVENT_SCAN_STARTED,
  2913. /**
  2914. * EVENT_AVOID_FREQUENCIES - Received avoid frequency range
  2915. *
  2916. * This event indicates a set of frequency ranges that should be avoided
  2917. * to reduce issues due to interference or internal co-existence
  2918. * information in the driver.
  2919. */
  2920. EVENT_AVOID_FREQUENCIES
  2921. };
  2922. /**
  2923. * struct freq_survey - Channel survey info
  2924. *
  2925. * @ifidx: Interface index in which this survey was observed
  2926. * @freq: Center of frequency of the surveyed channel
  2927. * @nf: Channel noise floor in dBm
  2928. * @channel_time: Amount of time in ms the radio spent on the channel
  2929. * @channel_time_busy: Amount of time in ms the radio detected some signal
  2930. * that indicated to the radio the channel was not clear
  2931. * @channel_time_rx: Amount of time the radio spent receiving data
  2932. * @channel_time_tx: Amount of time the radio spent transmitting data
  2933. * @filled: bitmask indicating which fields have been reported, see
  2934. * SURVEY_HAS_* defines.
  2935. * @list: Internal list pointers
  2936. */
  2937. struct freq_survey {
  2938. u32 ifidx;
  2939. unsigned int freq;
  2940. s8 nf;
  2941. u64 channel_time;
  2942. u64 channel_time_busy;
  2943. u64 channel_time_rx;
  2944. u64 channel_time_tx;
  2945. unsigned int filled;
  2946. struct dl_list list;
  2947. };
  2948. #define SURVEY_HAS_NF BIT(0)
  2949. #define SURVEY_HAS_CHAN_TIME BIT(1)
  2950. #define SURVEY_HAS_CHAN_TIME_BUSY BIT(2)
  2951. #define SURVEY_HAS_CHAN_TIME_RX BIT(3)
  2952. #define SURVEY_HAS_CHAN_TIME_TX BIT(4)
  2953. /**
  2954. * union wpa_event_data - Additional data for wpa_supplicant_event() calls
  2955. */
  2956. union wpa_event_data {
  2957. /**
  2958. * struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events
  2959. *
  2960. * This structure is optional for EVENT_ASSOC calls and required for
  2961. * EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the
  2962. * driver interface does not need to generate separate EVENT_ASSOCINFO
  2963. * calls.
  2964. */
  2965. struct assoc_info {
  2966. /**
  2967. * reassoc - Flag to indicate association or reassociation
  2968. */
  2969. int reassoc;
  2970. /**
  2971. * req_ies - (Re)Association Request IEs
  2972. *
  2973. * If the driver generates WPA/RSN IE, this event data must be
  2974. * returned for WPA handshake to have needed information. If
  2975. * wpa_supplicant-generated WPA/RSN IE is used, this
  2976. * information event is optional.
  2977. *
  2978. * This should start with the first IE (fixed fields before IEs
  2979. * are not included).
  2980. */
  2981. const u8 *req_ies;
  2982. /**
  2983. * req_ies_len - Length of req_ies in bytes
  2984. */
  2985. size_t req_ies_len;
  2986. /**
  2987. * resp_ies - (Re)Association Response IEs
  2988. *
  2989. * Optional association data from the driver. This data is not
  2990. * required WPA, but may be useful for some protocols and as
  2991. * such, should be reported if this is available to the driver
  2992. * interface.
  2993. *
  2994. * This should start with the first IE (fixed fields before IEs
  2995. * are not included).
  2996. */
  2997. const u8 *resp_ies;
  2998. /**
  2999. * resp_ies_len - Length of resp_ies in bytes
  3000. */
  3001. size_t resp_ies_len;
  3002. /**
  3003. * beacon_ies - Beacon or Probe Response IEs
  3004. *
  3005. * Optional Beacon/ProbeResp data: IEs included in Beacon or
  3006. * Probe Response frames from the current AP (i.e., the one
  3007. * that the client just associated with). This information is
  3008. * used to update WPA/RSN IE for the AP. If this field is not
  3009. * set, the results from previous scan will be used. If no
  3010. * data for the new AP is found, scan results will be requested
  3011. * again (without scan request). At this point, the driver is
  3012. * expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is
  3013. * used).
  3014. *
  3015. * This should start with the first IE (fixed fields before IEs
  3016. * are not included).
  3017. */
  3018. const u8 *beacon_ies;
  3019. /**
  3020. * beacon_ies_len - Length of beacon_ies */
  3021. size_t beacon_ies_len;
  3022. /**
  3023. * freq - Frequency of the operational channel in MHz
  3024. */
  3025. unsigned int freq;
  3026. /**
  3027. * addr - Station address (for AP mode)
  3028. */
  3029. const u8 *addr;
  3030. } assoc_info;
  3031. /**
  3032. * struct disassoc_info - Data for EVENT_DISASSOC events
  3033. */
  3034. struct disassoc_info {
  3035. /**
  3036. * addr - Station address (for AP mode)
  3037. */
  3038. const u8 *addr;
  3039. /**
  3040. * reason_code - Reason Code (host byte order) used in
  3041. * Deauthentication frame
  3042. */
  3043. u16 reason_code;
  3044. /**
  3045. * ie - Optional IE(s) in Disassociation frame
  3046. */
  3047. const u8 *ie;
  3048. /**
  3049. * ie_len - Length of ie buffer in octets
  3050. */
  3051. size_t ie_len;
  3052. /**
  3053. * locally_generated - Whether the frame was locally generated
  3054. */
  3055. int locally_generated;
  3056. } disassoc_info;
  3057. /**
  3058. * struct deauth_info - Data for EVENT_DEAUTH events
  3059. */
  3060. struct deauth_info {
  3061. /**
  3062. * addr - Station address (for AP mode)
  3063. */
  3064. const u8 *addr;
  3065. /**
  3066. * reason_code - Reason Code (host byte order) used in
  3067. * Deauthentication frame
  3068. */
  3069. u16 reason_code;
  3070. /**
  3071. * ie - Optional IE(s) in Deauthentication frame
  3072. */
  3073. const u8 *ie;
  3074. /**
  3075. * ie_len - Length of ie buffer in octets
  3076. */
  3077. size_t ie_len;
  3078. /**
  3079. * locally_generated - Whether the frame was locally generated
  3080. */
  3081. int locally_generated;
  3082. } deauth_info;
  3083. /**
  3084. * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
  3085. */
  3086. struct michael_mic_failure {
  3087. int unicast;
  3088. const u8 *src;
  3089. } michael_mic_failure;
  3090. /**
  3091. * struct interface_status - Data for EVENT_INTERFACE_STATUS
  3092. */
  3093. struct interface_status {
  3094. char ifname[100];
  3095. enum {
  3096. EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED
  3097. } ievent;
  3098. } interface_status;
  3099. /**
  3100. * struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE
  3101. */
  3102. struct pmkid_candidate {
  3103. /** BSSID of the PMKID candidate */
  3104. u8 bssid[ETH_ALEN];
  3105. /** Smaller the index, higher the priority */
  3106. int index;
  3107. /** Whether RSN IE includes pre-authenticate flag */
  3108. int preauth;
  3109. } pmkid_candidate;
  3110. /**
  3111. * struct stkstart - Data for EVENT_STKSTART
  3112. */
  3113. struct stkstart {
  3114. u8 peer[ETH_ALEN];
  3115. } stkstart;
  3116. /**
  3117. * struct tdls - Data for EVENT_TDLS
  3118. */
  3119. struct tdls {
  3120. u8 peer[ETH_ALEN];
  3121. enum {
  3122. TDLS_REQUEST_SETUP,
  3123. TDLS_REQUEST_TEARDOWN
  3124. } oper;
  3125. u16 reason_code; /* for teardown */
  3126. } tdls;
  3127. /**
  3128. * struct wnm - Data for EVENT_WNM
  3129. */
  3130. struct wnm {
  3131. u8 addr[ETH_ALEN];
  3132. enum {
  3133. WNM_OPER_SLEEP,
  3134. } oper;
  3135. enum {
  3136. WNM_SLEEP_ENTER,
  3137. WNM_SLEEP_EXIT
  3138. } sleep_action;
  3139. int sleep_intval;
  3140. u16 reason_code;
  3141. u8 *buf;
  3142. u16 buf_len;
  3143. } wnm;
  3144. /**
  3145. * struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
  3146. *
  3147. * During FT (IEEE 802.11r) authentication sequence, the driver is
  3148. * expected to use this event to report received FT IEs (MDIE, FTIE,
  3149. * RSN IE, TIE, possible resource request) to the supplicant. The FT
  3150. * IEs for the next message will be delivered through the
  3151. * struct wpa_driver_ops::update_ft_ies() callback.
  3152. */
  3153. struct ft_ies {
  3154. const u8 *ies;
  3155. size_t ies_len;
  3156. int ft_action;
  3157. u8 target_ap[ETH_ALEN];
  3158. /** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
  3159. const u8 *ric_ies;
  3160. /** Length of ric_ies buffer in octets */
  3161. size_t ric_ies_len;
  3162. } ft_ies;
  3163. /**
  3164. * struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START
  3165. */
  3166. struct ibss_rsn_start {
  3167. u8 peer[ETH_ALEN];
  3168. } ibss_rsn_start;
  3169. /**
  3170. * struct auth_info - Data for EVENT_AUTH events
  3171. */
  3172. struct auth_info {
  3173. u8 peer[ETH_ALEN];
  3174. u8 bssid[ETH_ALEN];
  3175. u16 auth_type;
  3176. u16 auth_transaction;
  3177. u16 status_code;
  3178. const u8 *ies;
  3179. size_t ies_len;
  3180. } auth;
  3181. /**
  3182. * struct assoc_reject - Data for EVENT_ASSOC_REJECT events
  3183. */
  3184. struct assoc_reject {
  3185. /**
  3186. * bssid - BSSID of the AP that rejected association
  3187. */
  3188. const u8 *bssid;
  3189. /**
  3190. * resp_ies - (Re)Association Response IEs
  3191. *
  3192. * Optional association data from the driver. This data is not
  3193. * required WPA, but may be useful for some protocols and as
  3194. * such, should be reported if this is available to the driver
  3195. * interface.
  3196. *
  3197. * This should start with the first IE (fixed fields before IEs
  3198. * are not included).
  3199. */
  3200. const u8 *resp_ies;
  3201. /**
  3202. * resp_ies_len - Length of resp_ies in bytes
  3203. */
  3204. size_t resp_ies_len;
  3205. /**
  3206. * status_code - Status Code from (Re)association Response
  3207. */
  3208. u16 status_code;
  3209. } assoc_reject;
  3210. struct timeout_event {
  3211. u8 addr[ETH_ALEN];
  3212. } timeout_event;
  3213. /**
  3214. * struct ft_rrb_rx - Data for EVENT_FT_RRB_RX events
  3215. */
  3216. struct ft_rrb_rx {
  3217. const u8 *src;
  3218. const u8 *data;
  3219. size_t data_len;
  3220. } ft_rrb_rx;
  3221. /**
  3222. * struct tx_status - Data for EVENT_TX_STATUS events
  3223. */
  3224. struct tx_status {
  3225. u16 type;
  3226. u16 stype;
  3227. const u8 *dst;
  3228. const u8 *data;
  3229. size_t data_len;
  3230. int ack;
  3231. } tx_status;
  3232. /**
  3233. * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
  3234. */
  3235. struct rx_from_unknown {
  3236. const u8 *bssid;
  3237. const u8 *addr;
  3238. int wds;
  3239. } rx_from_unknown;
  3240. /**
  3241. * struct rx_mgmt - Data for EVENT_RX_MGMT events
  3242. */
  3243. struct rx_mgmt {
  3244. const u8 *frame;
  3245. size_t frame_len;
  3246. u32 datarate;
  3247. /**
  3248. * drv_priv - Pointer to store driver private BSS information
  3249. *
  3250. * If not set to NULL, this is used for comparison with
  3251. * hostapd_data->drv_priv to determine which BSS should process
  3252. * the frame.
  3253. */
  3254. void *drv_priv;
  3255. /**
  3256. * freq - Frequency (in MHz) on which the frame was received
  3257. */
  3258. int freq;
  3259. /**
  3260. * ssi_signal - Signal strength in dBm (or 0 if not available)
  3261. */
  3262. int ssi_signal;
  3263. } rx_mgmt;
  3264. /**
  3265. * struct remain_on_channel - Data for EVENT_REMAIN_ON_CHANNEL events
  3266. *
  3267. * This is also used with EVENT_CANCEL_REMAIN_ON_CHANNEL events.
  3268. */
  3269. struct remain_on_channel {
  3270. /**
  3271. * freq - Channel frequency in MHz
  3272. */
  3273. unsigned int freq;
  3274. /**
  3275. * duration - Duration to remain on the channel in milliseconds
  3276. */
  3277. unsigned int duration;
  3278. } remain_on_channel;
  3279. /**
  3280. * struct scan_info - Optional data for EVENT_SCAN_RESULTS events
  3281. * @aborted: Whether the scan was aborted
  3282. * @freqs: Scanned frequencies in MHz (%NULL = all channels scanned)
  3283. * @num_freqs: Number of entries in freqs array
  3284. * @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard
  3285. * SSID)
  3286. * @num_ssids: Number of entries in ssids array
  3287. */
  3288. struct scan_info {
  3289. int aborted;
  3290. const int *freqs;
  3291. size_t num_freqs;
  3292. struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
  3293. size_t num_ssids;
  3294. } scan_info;
  3295. /**
  3296. * struct mlme_rx - Data for EVENT_MLME_RX events
  3297. */
  3298. struct mlme_rx {
  3299. const u8 *buf;
  3300. size_t len;
  3301. int freq;
  3302. int channel;
  3303. int ssi;
  3304. } mlme_rx;
  3305. /**
  3306. * struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events
  3307. */
  3308. struct rx_probe_req {
  3309. /**
  3310. * sa - Source address of the received Probe Request frame
  3311. */
  3312. const u8 *sa;
  3313. /**
  3314. * da - Destination address of the received Probe Request frame
  3315. * or %NULL if not available
  3316. */
  3317. const u8 *da;
  3318. /**
  3319. * bssid - BSSID of the received Probe Request frame or %NULL
  3320. * if not available
  3321. */
  3322. const u8 *bssid;
  3323. /**
  3324. * ie - IEs from the Probe Request body
  3325. */
  3326. const u8 *ie;
  3327. /**
  3328. * ie_len - Length of ie buffer in octets
  3329. */
  3330. size_t ie_len;
  3331. /**
  3332. * signal - signal strength in dBm (or 0 if not available)
  3333. */
  3334. int ssi_signal;
  3335. } rx_probe_req;
  3336. /**
  3337. * struct new_sta - Data for EVENT_NEW_STA events
  3338. */
  3339. struct new_sta {
  3340. const u8 *addr;
  3341. } new_sta;
  3342. /**
  3343. * struct eapol_rx - Data for EVENT_EAPOL_RX events
  3344. */
  3345. struct eapol_rx {
  3346. const u8 *src;
  3347. const u8 *data;
  3348. size_t data_len;
  3349. } eapol_rx;
  3350. /**
  3351. * signal_change - Data for EVENT_SIGNAL_CHANGE events
  3352. */
  3353. struct wpa_signal_info signal_change;
  3354. /**
  3355. * struct best_channel - Data for EVENT_BEST_CHANNEL events
  3356. * @freq_24: Best 2.4 GHz band channel frequency in MHz
  3357. * @freq_5: Best 5 GHz band channel frequency in MHz
  3358. * @freq_overall: Best channel frequency in MHz
  3359. *
  3360. * 0 can be used to indicate no preference in either band.
  3361. */
  3362. struct best_channel {
  3363. int freq_24;
  3364. int freq_5;
  3365. int freq_overall;
  3366. } best_chan;
  3367. struct unprot_deauth {
  3368. const u8 *sa;
  3369. const u8 *da;
  3370. u16 reason_code;
  3371. } unprot_deauth;
  3372. struct unprot_disassoc {
  3373. const u8 *sa;
  3374. const u8 *da;
  3375. u16 reason_code;
  3376. } unprot_disassoc;
  3377. /**
  3378. * struct low_ack - Data for EVENT_STATION_LOW_ACK events
  3379. * @addr: station address
  3380. */
  3381. struct low_ack {
  3382. u8 addr[ETH_ALEN];
  3383. } low_ack;
  3384. /**
  3385. * struct ibss_peer_lost - Data for EVENT_IBSS_PEER_LOST
  3386. */
  3387. struct ibss_peer_lost {
  3388. u8 peer[ETH_ALEN];
  3389. } ibss_peer_lost;
  3390. /**
  3391. * struct driver_gtk_rekey - Data for EVENT_DRIVER_GTK_REKEY
  3392. */
  3393. struct driver_gtk_rekey {
  3394. const u8 *bssid;
  3395. const u8 *replay_ctr;
  3396. } driver_gtk_rekey;
  3397. /**
  3398. * struct client_poll - Data for EVENT_DRIVER_CLIENT_POLL_OK events
  3399. * @addr: station address
  3400. */
  3401. struct client_poll {
  3402. u8 addr[ETH_ALEN];
  3403. } client_poll;
  3404. /**
  3405. * struct eapol_tx_status
  3406. * @dst: Original destination
  3407. * @data: Data starting with IEEE 802.1X header (!)
  3408. * @data_len: Length of data
  3409. * @ack: Indicates ack or lost frame
  3410. *
  3411. * This corresponds to hapd_send_eapol if the frame sent
  3412. * there isn't just reported as EVENT_TX_STATUS.
  3413. */
  3414. struct eapol_tx_status {
  3415. const u8 *dst;
  3416. const u8 *data;
  3417. int data_len;
  3418. int ack;
  3419. } eapol_tx_status;
  3420. /**
  3421. * struct ch_switch
  3422. * @freq: Frequency of new channel in MHz
  3423. * @ht_enabled: Whether this is an HT channel
  3424. * @ch_offset: Secondary channel offset
  3425. * @ch_width: Channel width
  3426. * @cf1: Center frequency 1
  3427. * @cf2: Center frequency 2
  3428. */
  3429. struct ch_switch {
  3430. int freq;
  3431. int ht_enabled;
  3432. int ch_offset;
  3433. enum chan_width ch_width;
  3434. int cf1;
  3435. int cf2;
  3436. } ch_switch;
  3437. /**
  3438. * struct connect_failed - Data for EVENT_CONNECT_FAILED_REASON
  3439. * @addr: Remote client address
  3440. * @code: Reason code for connection failure
  3441. */
  3442. struct connect_failed_reason {
  3443. u8 addr[ETH_ALEN];
  3444. enum {
  3445. MAX_CLIENT_REACHED,
  3446. BLOCKED_CLIENT
  3447. } code;
  3448. } connect_failed_reason;
  3449. /**
  3450. * struct dfs_event - Data for radar detected events
  3451. * @freq: Frequency of the channel in MHz
  3452. */
  3453. struct dfs_event {
  3454. int freq;
  3455. int ht_enabled;
  3456. int chan_offset;
  3457. enum chan_width chan_width;
  3458. int cf1;
  3459. int cf2;
  3460. } dfs_event;
  3461. /**
  3462. * survey_results - Survey result data for EVENT_SURVEY
  3463. * @freq_filter: Requested frequency survey filter, 0 if request
  3464. * was for all survey data
  3465. * @survey_list: Linked list of survey data
  3466. */
  3467. struct survey_results {
  3468. unsigned int freq_filter;
  3469. struct dl_list survey_list; /* struct freq_survey */
  3470. } survey_results;
  3471. /**
  3472. * channel_list_changed - Data for EVENT_CHANNEL_LIST_CHANGED
  3473. * @initiator: Initiator of the regulatory change
  3474. * @type: Regulatory change type
  3475. * @alpha2: Country code (or "" if not available)
  3476. */
  3477. struct channel_list_changed {
  3478. enum reg_change_initiator initiator;
  3479. enum reg_type type;
  3480. char alpha2[3];
  3481. } channel_list_changed;
  3482. /**
  3483. * freq_range - List of frequency ranges
  3484. *
  3485. * This is used as the data with EVENT_AVOID_FREQUENCIES.
  3486. */
  3487. struct wpa_freq_range_list freq_range;
  3488. };
  3489. /**
  3490. * wpa_supplicant_event - Report a driver event for wpa_supplicant
  3491. * @ctx: Context pointer (wpa_s); this is the ctx variable registered
  3492. * with struct wpa_driver_ops::init()
  3493. * @event: event type (defined above)
  3494. * @data: possible extra data for the event
  3495. *
  3496. * Driver wrapper code should call this function whenever an event is received
  3497. * from the driver.
  3498. */
  3499. void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
  3500. union wpa_event_data *data);
  3501. /*
  3502. * The following inline functions are provided for convenience to simplify
  3503. * event indication for some of the common events.
  3504. */
  3505. static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
  3506. size_t ielen, int reassoc)
  3507. {
  3508. union wpa_event_data event;
  3509. os_memset(&event, 0, sizeof(event));
  3510. event.assoc_info.reassoc = reassoc;
  3511. event.assoc_info.req_ies = ie;
  3512. event.assoc_info.req_ies_len = ielen;
  3513. event.assoc_info.addr = addr;
  3514. wpa_supplicant_event(ctx, EVENT_ASSOC, &event);
  3515. }
  3516. static inline void drv_event_disassoc(void *ctx, const u8 *addr)
  3517. {
  3518. union wpa_event_data event;
  3519. os_memset(&event, 0, sizeof(event));
  3520. event.disassoc_info.addr = addr;
  3521. wpa_supplicant_event(ctx, EVENT_DISASSOC, &event);
  3522. }
  3523. static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
  3524. size_t data_len)
  3525. {
  3526. union wpa_event_data event;
  3527. os_memset(&event, 0, sizeof(event));
  3528. event.eapol_rx.src = src;
  3529. event.eapol_rx.data = data;
  3530. event.eapol_rx.data_len = data_len;
  3531. wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
  3532. }
  3533. /* driver_common.c */
  3534. void wpa_scan_results_free(struct wpa_scan_results *res);
  3535. /* Convert wpa_event_type to a string for logging */
  3536. const char * event_to_string(enum wpa_event_type event);
  3537. /* NULL terminated array of linked in driver wrappers */
  3538. extern struct wpa_driver_ops *wpa_drivers[];
  3539. #endif /* DRIVER_H */