driver.h 142 KB

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