driver.h 139 KB

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