driver.h 165 KB

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