driver.h 157 KB

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