├── .gitignore ├── Black80211.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ └── rpeshkov.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── Black80211 ├── Black80211Control.cpp ├── Black80211Control.hpp ├── Black80211Control_ioctl.cpp ├── Black80211Interface.cpp ├── Black80211Interface.hpp ├── IONetworkController.h ├── IONetworkInterface.h ├── Info.plist ├── apple80211.h ├── apple80211 │ ├── catalina │ │ ├── IO80211Controller.h │ │ ├── IO80211Interface.h │ │ ├── IO80211SkywalkInterface.h │ │ ├── IO80211WorkLoop.h │ │ ├── IOSkywalkEthernetInterface.h │ │ ├── apple80211_ioctl.h │ │ ├── apple80211_var.h │ │ └── apple80211_wps.h │ └── ioctl ├── debug.h ├── ieee80211_ioctl.h └── interop.h ├── IPSettings.png ├── LICENSE ├── Maps.png ├── NetworkInterfaces.png ├── NetworkMenu.png ├── NetworkMenuIcon.png ├── README.md ├── SystemProfiler.png └── makefile /.gitignore: -------------------------------------------------------------------------------- 1 | DerivedData/ 2 | xcuserdata/ 3 | 4 | .DS_Store 5 | build/ 6 | -------------------------------------------------------------------------------- /Black80211.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 358C6ABA24D15CBF008A4FBD /* Black80211Interface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 358C6AB824D15CBF008A4FBD /* Black80211Interface.cpp */; }; 11 | 358C6ABB24D15CBF008A4FBD /* Black80211Interface.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 358C6AB924D15CBF008A4FBD /* Black80211Interface.hpp */; }; 12 | 35CB508D24E2D606001E2639 /* Black80211Control.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A612723C203A1079009DD95B /* Black80211Control.cpp */; }; 13 | 35CB508E24E2D606001E2639 /* Black80211Control_ioctl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A632F0D620E8230700AAC444 /* Black80211Control_ioctl.cpp */; }; 14 | 35CB508F24E2D606001E2639 /* Black80211Interface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 358C6AB824D15CBF008A4FBD /* Black80211Interface.cpp */; }; 15 | 35CB509224E2D606001E2639 /* apple80211_ioctl.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BADF23E36DB00004FF34 /* apple80211_ioctl.h */; }; 16 | 35CB509324E2D606001E2639 /* IOSkywalkEthernetInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BAD723E36DB00004FF34 /* IOSkywalkEthernetInterface.h */; }; 17 | 35CB509424E2D606001E2639 /* apple80211_wps.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BADC23E36DB00004FF34 /* apple80211_wps.h */; }; 18 | 35CB509524E2D606001E2639 /* IO80211WorkLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BADD23E36DB00004FF34 /* IO80211WorkLoop.h */; }; 19 | 35CB509624E2D606001E2639 /* IO80211SkywalkInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BADA23E36DB00004FF34 /* IO80211SkywalkInterface.h */; }; 20 | 35CB509724E2D606001E2639 /* IO80211Interface.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BAD823E36DB00004FF34 /* IO80211Interface.h */; }; 21 | 35CB509824E2D606001E2639 /* IO80211Controller.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BAD923E36DB00004FF34 /* IO80211Controller.h */; }; 22 | 35CB509924E2D606001E2639 /* Black80211Control.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A61272252039FD13009DD95B /* Black80211Control.hpp */; }; 23 | 35CB509A24E2D606001E2639 /* apple80211_var.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BADB23E36DB00004FF34 /* apple80211_var.h */; }; 24 | 35CB509B24E2D606001E2639 /* Black80211Interface.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 358C6AB924D15CBF008A4FBD /* Black80211Interface.hpp */; }; 25 | 6811BAE123E36DB00004FF34 /* IOSkywalkEthernetInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BAD723E36DB00004FF34 /* IOSkywalkEthernetInterface.h */; }; 26 | 6811BAE223E36DB00004FF34 /* IO80211Interface.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BAD823E36DB00004FF34 /* IO80211Interface.h */; }; 27 | 6811BAE323E36DB00004FF34 /* IO80211Controller.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BAD923E36DB00004FF34 /* IO80211Controller.h */; }; 28 | 6811BAE423E36DB00004FF34 /* IO80211SkywalkInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BADA23E36DB00004FF34 /* IO80211SkywalkInterface.h */; }; 29 | 6811BAE523E36DB00004FF34 /* apple80211_var.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BADB23E36DB00004FF34 /* apple80211_var.h */; }; 30 | 6811BAE623E36DB00004FF34 /* apple80211_wps.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BADC23E36DB00004FF34 /* apple80211_wps.h */; }; 31 | 6811BAE723E36DB00004FF34 /* IO80211WorkLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BADD23E36DB00004FF34 /* IO80211WorkLoop.h */; }; 32 | 6811BAE923E36DB00004FF34 /* apple80211_ioctl.h in Headers */ = {isa = PBXBuildFile; fileRef = 6811BADF23E36DB00004FF34 /* apple80211_ioctl.h */; }; 33 | 6863647723E36CDF00549C37 /* Black80211Control.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A612723C203A1079009DD95B /* Black80211Control.cpp */; }; 34 | 6863647823E36CDF00549C37 /* Black80211Control_ioctl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A632F0D620E8230700AAC444 /* Black80211Control_ioctl.cpp */; }; 35 | 6863648523E36CDF00549C37 /* Black80211Control.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A61272252039FD13009DD95B /* Black80211Control.hpp */; }; 36 | /* End PBXBuildFile section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 358C6AB824D15CBF008A4FBD /* Black80211Interface.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Black80211Interface.cpp; sourceTree = ""; }; 40 | 358C6AB924D15CBF008A4FBD /* Black80211Interface.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Black80211Interface.hpp; sourceTree = ""; }; 41 | 35CB50A024E2D606001E2639 /* Black80211.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Black80211.kext; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 35EB748624D6FD4700F06692 /* interop.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = interop.h; sourceTree = ""; }; 43 | 6811BAD723E36DB00004FF34 /* IOSkywalkEthernetInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOSkywalkEthernetInterface.h; sourceTree = ""; }; 44 | 6811BAD823E36DB00004FF34 /* IO80211Interface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IO80211Interface.h; sourceTree = ""; }; 45 | 6811BAD923E36DB00004FF34 /* IO80211Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IO80211Controller.h; sourceTree = ""; }; 46 | 6811BADA23E36DB00004FF34 /* IO80211SkywalkInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IO80211SkywalkInterface.h; sourceTree = ""; }; 47 | 6811BADB23E36DB00004FF34 /* apple80211_var.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = apple80211_var.h; sourceTree = ""; }; 48 | 6811BADC23E36DB00004FF34 /* apple80211_wps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = apple80211_wps.h; sourceTree = ""; }; 49 | 6811BADD23E36DB00004FF34 /* IO80211WorkLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IO80211WorkLoop.h; sourceTree = ""; }; 50 | 6811BADF23E36DB00004FF34 /* apple80211_ioctl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = apple80211_ioctl.h; sourceTree = ""; }; 51 | 6863648D23E36CDF00549C37 /* Black80211.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Black80211.kext; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | A61272252039FD13009DD95B /* Black80211Control.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Black80211Control.hpp; sourceTree = ""; }; 53 | A61272292039FD13009DD95B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | A612723C203A1079009DD95B /* Black80211Control.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Black80211Control.cpp; sourceTree = ""; }; 55 | A632F0D620E8230700AAC444 /* Black80211Control_ioctl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Black80211Control_ioctl.cpp; sourceTree = ""; }; 56 | A635043B209A3CC700C82B59 /* apple80211.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = apple80211.h; sourceTree = ""; }; 57 | A688015320EDA58B00590651 /* debug.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 35CB509024E2D606001E2639 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | 6863647923E36CDF00549C37 /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | /* End PBXFrameworksBuildPhase section */ 76 | 77 | /* Begin PBXGroup section */ 78 | 6863647323E36C8700549C37 /* catalina */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 6811BADF23E36DB00004FF34 /* apple80211_ioctl.h */, 82 | 6811BADB23E36DB00004FF34 /* apple80211_var.h */, 83 | 6811BADC23E36DB00004FF34 /* apple80211_wps.h */, 84 | 6811BAD923E36DB00004FF34 /* IO80211Controller.h */, 85 | 6811BAD823E36DB00004FF34 /* IO80211Interface.h */, 86 | 6811BADA23E36DB00004FF34 /* IO80211SkywalkInterface.h */, 87 | 6811BADD23E36DB00004FF34 /* IO80211WorkLoop.h */, 88 | 6811BAD723E36DB00004FF34 /* IOSkywalkEthernetInterface.h */, 89 | ); 90 | path = catalina; 91 | sourceTree = ""; 92 | }; 93 | A61272182039FD13009DD95B = { 94 | isa = PBXGroup; 95 | children = ( 96 | A61272242039FD13009DD95B /* Black80211 */, 97 | A61272232039FD13009DD95B /* Products */, 98 | ); 99 | sourceTree = ""; 100 | }; 101 | A61272232039FD13009DD95B /* Products */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 6863648D23E36CDF00549C37 /* Black80211.kext */, 105 | 35CB50A024E2D606001E2639 /* Black80211.kext */, 106 | ); 107 | name = Products; 108 | sourceTree = ""; 109 | }; 110 | A61272242039FD13009DD95B /* Black80211 */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | A612722F2039FFC1009DD95B /* apple80211 */, 114 | A61272252039FD13009DD95B /* Black80211Control.hpp */, 115 | A612723C203A1079009DD95B /* Black80211Control.cpp */, 116 | A632F0D620E8230700AAC444 /* Black80211Control_ioctl.cpp */, 117 | A61272292039FD13009DD95B /* Info.plist */, 118 | A635043B209A3CC700C82B59 /* apple80211.h */, 119 | A688015320EDA58B00590651 /* debug.h */, 120 | 358C6AB824D15CBF008A4FBD /* Black80211Interface.cpp */, 121 | 358C6AB924D15CBF008A4FBD /* Black80211Interface.hpp */, 122 | 35EB748624D6FD4700F06692 /* interop.h */, 123 | ); 124 | path = Black80211; 125 | sourceTree = ""; 126 | }; 127 | A612722F2039FFC1009DD95B /* apple80211 */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 6863647323E36C8700549C37 /* catalina */, 131 | ); 132 | path = apple80211; 133 | sourceTree = ""; 134 | }; 135 | /* End PBXGroup section */ 136 | 137 | /* Begin PBXHeadersBuildPhase section */ 138 | 35CB509124E2D606001E2639 /* Headers */ = { 139 | isa = PBXHeadersBuildPhase; 140 | buildActionMask = 2147483647; 141 | files = ( 142 | 35CB509224E2D606001E2639 /* apple80211_ioctl.h in Headers */, 143 | 35CB509324E2D606001E2639 /* IOSkywalkEthernetInterface.h in Headers */, 144 | 35CB509424E2D606001E2639 /* apple80211_wps.h in Headers */, 145 | 35CB509524E2D606001E2639 /* IO80211WorkLoop.h in Headers */, 146 | 35CB509624E2D606001E2639 /* IO80211SkywalkInterface.h in Headers */, 147 | 35CB509724E2D606001E2639 /* IO80211Interface.h in Headers */, 148 | 35CB509824E2D606001E2639 /* IO80211Controller.h in Headers */, 149 | 35CB509924E2D606001E2639 /* Black80211Control.hpp in Headers */, 150 | 35CB509A24E2D606001E2639 /* apple80211_var.h in Headers */, 151 | 35CB509B24E2D606001E2639 /* Black80211Interface.hpp in Headers */, 152 | ); 153 | runOnlyForDeploymentPostprocessing = 0; 154 | }; 155 | 6863647A23E36CDF00549C37 /* Headers */ = { 156 | isa = PBXHeadersBuildPhase; 157 | buildActionMask = 2147483647; 158 | files = ( 159 | 6811BAE923E36DB00004FF34 /* apple80211_ioctl.h in Headers */, 160 | 6811BAE123E36DB00004FF34 /* IOSkywalkEthernetInterface.h in Headers */, 161 | 6811BAE623E36DB00004FF34 /* apple80211_wps.h in Headers */, 162 | 6811BAE723E36DB00004FF34 /* IO80211WorkLoop.h in Headers */, 163 | 6811BAE423E36DB00004FF34 /* IO80211SkywalkInterface.h in Headers */, 164 | 6811BAE223E36DB00004FF34 /* IO80211Interface.h in Headers */, 165 | 6811BAE323E36DB00004FF34 /* IO80211Controller.h in Headers */, 166 | 6863648523E36CDF00549C37 /* Black80211Control.hpp in Headers */, 167 | 6811BAE523E36DB00004FF34 /* apple80211_var.h in Headers */, 168 | 358C6ABB24D15CBF008A4FBD /* Black80211Interface.hpp in Headers */, 169 | ); 170 | runOnlyForDeploymentPostprocessing = 0; 171 | }; 172 | /* End PBXHeadersBuildPhase section */ 173 | 174 | /* Begin PBXNativeTarget section */ 175 | 35CB508B24E2D606001E2639 /* Big Sur */ = { 176 | isa = PBXNativeTarget; 177 | buildConfigurationList = 35CB509D24E2D606001E2639 /* Build configuration list for PBXNativeTarget "Big Sur" */; 178 | buildPhases = ( 179 | 35CB508C24E2D606001E2639 /* Sources */, 180 | 35CB509024E2D606001E2639 /* Frameworks */, 181 | 35CB509124E2D606001E2639 /* Headers */, 182 | 35CB509C24E2D606001E2639 /* Resources */, 183 | ); 184 | buildRules = ( 185 | ); 186 | dependencies = ( 187 | ); 188 | name = "Big Sur"; 189 | productName = Black80211; 190 | productReference = 35CB50A024E2D606001E2639 /* Black80211.kext */; 191 | productType = "com.apple.product-type.kernel-extension"; 192 | }; 193 | 6863647423E36CDF00549C37 /* Catalina */ = { 194 | isa = PBXNativeTarget; 195 | buildConfigurationList = 6863648A23E36CDF00549C37 /* Build configuration list for PBXNativeTarget "Catalina" */; 196 | buildPhases = ( 197 | 6863647523E36CDF00549C37 /* Sources */, 198 | 6863647923E36CDF00549C37 /* Frameworks */, 199 | 6863647A23E36CDF00549C37 /* Headers */, 200 | 6863648923E36CDF00549C37 /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | ); 206 | name = Catalina; 207 | productName = Black80211; 208 | productReference = 6863648D23E36CDF00549C37 /* Black80211.kext */; 209 | productType = "com.apple.product-type.kernel-extension"; 210 | }; 211 | /* End PBXNativeTarget section */ 212 | 213 | /* Begin PBXProject section */ 214 | A61272192039FD13009DD95B /* Project object */ = { 215 | isa = PBXProject; 216 | attributes = { 217 | LastUpgradeCheck = 0930; 218 | ORGANIZATIONNAME = "Roman Peshkov"; 219 | }; 220 | buildConfigurationList = A612721C2039FD13009DD95B /* Build configuration list for PBXProject "Black80211" */; 221 | compatibilityVersion = "Xcode 8.0"; 222 | developmentRegion = en; 223 | hasScannedForEncodings = 0; 224 | knownRegions = ( 225 | en, 226 | ); 227 | mainGroup = A61272182039FD13009DD95B; 228 | productRefGroup = A61272232039FD13009DD95B /* Products */; 229 | projectDirPath = ""; 230 | projectRoot = ""; 231 | targets = ( 232 | 6863647423E36CDF00549C37 /* Catalina */, 233 | 35CB508B24E2D606001E2639 /* Big Sur */, 234 | ); 235 | }; 236 | /* End PBXProject section */ 237 | 238 | /* Begin PBXResourcesBuildPhase section */ 239 | 35CB509C24E2D606001E2639 /* Resources */ = { 240 | isa = PBXResourcesBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | ); 244 | runOnlyForDeploymentPostprocessing = 0; 245 | }; 246 | 6863648923E36CDF00549C37 /* Resources */ = { 247 | isa = PBXResourcesBuildPhase; 248 | buildActionMask = 2147483647; 249 | files = ( 250 | ); 251 | runOnlyForDeploymentPostprocessing = 0; 252 | }; 253 | /* End PBXResourcesBuildPhase section */ 254 | 255 | /* Begin PBXSourcesBuildPhase section */ 256 | 35CB508C24E2D606001E2639 /* Sources */ = { 257 | isa = PBXSourcesBuildPhase; 258 | buildActionMask = 2147483647; 259 | files = ( 260 | 35CB508D24E2D606001E2639 /* Black80211Control.cpp in Sources */, 261 | 35CB508E24E2D606001E2639 /* Black80211Control_ioctl.cpp in Sources */, 262 | 35CB508F24E2D606001E2639 /* Black80211Interface.cpp in Sources */, 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | }; 266 | 6863647523E36CDF00549C37 /* Sources */ = { 267 | isa = PBXSourcesBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | 6863647723E36CDF00549C37 /* Black80211Control.cpp in Sources */, 271 | 6863647823E36CDF00549C37 /* Black80211Control_ioctl.cpp in Sources */, 272 | 358C6ABA24D15CBF008A4FBD /* Black80211Interface.cpp in Sources */, 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | /* End PBXSourcesBuildPhase section */ 277 | 278 | /* Begin XCBuildConfiguration section */ 279 | 35CB509E24E2D606001E2639 /* Debug */ = { 280 | isa = XCBuildConfiguration; 281 | buildSettings = { 282 | ARCHS = "$(NATIVE_ARCH_ACTUAL)"; 283 | CLANG_CXX_LANGUAGE_STANDARD = "c++14"; 284 | CLANG_WARN_DOCUMENTATION_COMMENTS = NO; 285 | CODE_SIGN_IDENTITY = ""; 286 | CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)/Big Sur"; 287 | CURRENT_PROJECT_VERSION = 1.0.0d1; 288 | GCC_PREPROCESSOR_DEFINITIONS = ( 289 | "DEBUG=1", 290 | "__PRIVATE_SPI__=1", 291 | "$(inherited)", 292 | BIG_SUR, 293 | ); 294 | INFOPLIST_FILE = Black80211/Info.plist; 295 | MACOSX_DEPLOYMENT_TARGET = 10.15; 296 | MODULE_NAME = net.rpeshkov.Black80211; 297 | MODULE_VERSION = 1.0.0d1; 298 | ONLY_ACTIVE_ARCH = YES; 299 | PRODUCT_BUNDLE_IDENTIFIER = net.rpeshkov.Black80211; 300 | PRODUCT_NAME = Black80211; 301 | SDKROOT = macosx; 302 | WARNING_CFLAGS = "-Wno-inconsistent-missing-override"; 303 | WRAPPER_EXTENSION = kext; 304 | }; 305 | name = Debug; 306 | }; 307 | 35CB509F24E2D606001E2639 /* Release */ = { 308 | isa = XCBuildConfiguration; 309 | buildSettings = { 310 | ARCHS = "$(NATIVE_ARCH_ACTUAL)"; 311 | CLANG_CXX_LANGUAGE_STANDARD = "c++14"; 312 | CLANG_WARN_DOCUMENTATION_COMMENTS = NO; 313 | CODE_SIGN_IDENTITY = ""; 314 | CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)/Big Sur"; 315 | CURRENT_PROJECT_VERSION = 1.0.0d1; 316 | GCC_PREPROCESSOR_DEFINITIONS = ( 317 | "__PRIVATE_SPI__=1", 318 | BIG_SUR, 319 | ); 320 | INFOPLIST_FILE = Black80211/Info.plist; 321 | MACOSX_DEPLOYMENT_TARGET = 10.15; 322 | MODULE_NAME = net.rpeshkov.Black80211; 323 | MODULE_VERSION = 1.0.0d1; 324 | ONLY_ACTIVE_ARCH = YES; 325 | PRODUCT_BUNDLE_IDENTIFIER = net.rpeshkov.Black80211; 326 | PRODUCT_NAME = Black80211; 327 | SDKROOT = macosx; 328 | WARNING_CFLAGS = ( 329 | "-Wno-inconsistent-missing-override", 330 | "-D__PRIVATE_SPI__", 331 | ); 332 | WRAPPER_EXTENSION = kext; 333 | }; 334 | name = Release; 335 | }; 336 | 6863648B23E36CDF00549C37 /* Debug */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | ARCHS = "$(NATIVE_ARCH_ACTUAL)"; 340 | CLANG_CXX_LANGUAGE_STANDARD = "c++14"; 341 | CLANG_WARN_DOCUMENTATION_COMMENTS = NO; 342 | CODE_SIGN_IDENTITY = ""; 343 | CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)/Catalina"; 344 | CURRENT_PROJECT_VERSION = 1.0.0d1; 345 | GCC_PREPROCESSOR_DEFINITIONS = ( 346 | "DEBUG=1", 347 | "__PRIVATE_SPI__=1", 348 | "$(inherited)", 349 | ); 350 | INFOPLIST_FILE = Black80211/Info.plist; 351 | MACOSX_DEPLOYMENT_TARGET = 10.15; 352 | MODULE_NAME = net.rpeshkov.Black80211; 353 | MODULE_VERSION = 1.0.0d1; 354 | ONLY_ACTIVE_ARCH = YES; 355 | PRODUCT_BUNDLE_IDENTIFIER = net.rpeshkov.Black80211; 356 | PRODUCT_NAME = Black80211; 357 | SDKROOT = macosx; 358 | WARNING_CFLAGS = "-Wno-inconsistent-missing-override"; 359 | WRAPPER_EXTENSION = kext; 360 | }; 361 | name = Debug; 362 | }; 363 | 6863648C23E36CDF00549C37 /* Release */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ARCHS = "$(NATIVE_ARCH_ACTUAL)"; 367 | CLANG_CXX_LANGUAGE_STANDARD = "c++14"; 368 | CLANG_WARN_DOCUMENTATION_COMMENTS = NO; 369 | CODE_SIGN_IDENTITY = ""; 370 | CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)/Catalina"; 371 | CURRENT_PROJECT_VERSION = 1.0.0d1; 372 | GCC_PREPROCESSOR_DEFINITIONS = "CATALINA=1"; 373 | INFOPLIST_FILE = Black80211/Info.plist; 374 | MACOSX_DEPLOYMENT_TARGET = 10.15; 375 | MODULE_NAME = net.rpeshkov.Black80211; 376 | MODULE_VERSION = 1.0.0d1; 377 | ONLY_ACTIVE_ARCH = YES; 378 | PRODUCT_BUNDLE_IDENTIFIER = net.rpeshkov.Black80211; 379 | PRODUCT_NAME = Black80211; 380 | SDKROOT = macosx; 381 | WARNING_CFLAGS = ( 382 | "-Wno-inconsistent-missing-override", 383 | "-D__PRIVATE_SPI__", 384 | ); 385 | WRAPPER_EXTENSION = kext; 386 | }; 387 | name = Release; 388 | }; 389 | A612722A2039FD13009DD95B /* Debug */ = { 390 | isa = XCBuildConfiguration; 391 | buildSettings = { 392 | ALWAYS_SEARCH_USER_PATHS = NO; 393 | CLANG_ANALYZER_NONNULL = YES; 394 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 395 | CLANG_CXX_LANGUAGE_STANDARD = "c++17"; 396 | CLANG_ENABLE_MODULES = YES; 397 | CLANG_ENABLE_OBJC_ARC = YES; 398 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 399 | CLANG_WARN_BOOL_CONVERSION = YES; 400 | CLANG_WARN_COMMA = YES; 401 | CLANG_WARN_CONSTANT_CONVERSION = YES; 402 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 403 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 404 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 405 | CLANG_WARN_EMPTY_BODY = YES; 406 | CLANG_WARN_ENUM_CONVERSION = YES; 407 | CLANG_WARN_INFINITE_RECURSION = YES; 408 | CLANG_WARN_INT_CONVERSION = YES; 409 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 410 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 411 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 412 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 413 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 414 | CLANG_WARN_STRICT_PROTOTYPES = YES; 415 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 416 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 417 | CLANG_WARN_UNREACHABLE_CODE = YES; 418 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 419 | CODE_SIGN_IDENTITY = "-"; 420 | COPY_PHASE_STRIP = NO; 421 | DEBUG_INFORMATION_FORMAT = dwarf; 422 | ENABLE_STRICT_OBJC_MSGSEND = YES; 423 | ENABLE_TESTABILITY = YES; 424 | GCC_C_LANGUAGE_STANDARD = gnu99; 425 | GCC_DYNAMIC_NO_PIC = NO; 426 | GCC_NO_COMMON_BLOCKS = YES; 427 | GCC_OPTIMIZATION_LEVEL = 0; 428 | GCC_PREPROCESSOR_DEFINITIONS = ( 429 | "DEBUG=1", 430 | "__PRIVATE_SPI__=1", 431 | "$(inherited)", 432 | ); 433 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 434 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 435 | GCC_WARN_UNDECLARED_SELECTOR = YES; 436 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 437 | GCC_WARN_UNUSED_FUNCTION = YES; 438 | GCC_WARN_UNUSED_VARIABLE = YES; 439 | MACOSX_DEPLOYMENT_TARGET = 10.13; 440 | MTL_ENABLE_DEBUG_INFO = YES; 441 | ONLY_ACTIVE_ARCH = YES; 442 | SDKROOT = macosx; 443 | }; 444 | name = Debug; 445 | }; 446 | A612722B2039FD13009DD95B /* Release */ = { 447 | isa = XCBuildConfiguration; 448 | buildSettings = { 449 | ALWAYS_SEARCH_USER_PATHS = NO; 450 | CLANG_ANALYZER_NONNULL = YES; 451 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 452 | CLANG_CXX_LANGUAGE_STANDARD = "c++17"; 453 | CLANG_ENABLE_MODULES = YES; 454 | CLANG_ENABLE_OBJC_ARC = YES; 455 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 456 | CLANG_WARN_BOOL_CONVERSION = YES; 457 | CLANG_WARN_COMMA = YES; 458 | CLANG_WARN_CONSTANT_CONVERSION = YES; 459 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 460 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 461 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 462 | CLANG_WARN_EMPTY_BODY = YES; 463 | CLANG_WARN_ENUM_CONVERSION = YES; 464 | CLANG_WARN_INFINITE_RECURSION = YES; 465 | CLANG_WARN_INT_CONVERSION = YES; 466 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 467 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 468 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 469 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 470 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 471 | CLANG_WARN_STRICT_PROTOTYPES = YES; 472 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 473 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 474 | CLANG_WARN_UNREACHABLE_CODE = YES; 475 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 476 | CODE_SIGN_IDENTITY = "-"; 477 | COPY_PHASE_STRIP = NO; 478 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 479 | ENABLE_NS_ASSERTIONS = NO; 480 | ENABLE_STRICT_OBJC_MSGSEND = YES; 481 | GCC_C_LANGUAGE_STANDARD = gnu99; 482 | GCC_NO_COMMON_BLOCKS = YES; 483 | GCC_PREPROCESSOR_DEFINITIONS = "__PRIVATE_SPI__=1"; 484 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 485 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 486 | GCC_WARN_UNDECLARED_SELECTOR = YES; 487 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 488 | GCC_WARN_UNUSED_FUNCTION = YES; 489 | GCC_WARN_UNUSED_VARIABLE = YES; 490 | MACOSX_DEPLOYMENT_TARGET = 10.13; 491 | MTL_ENABLE_DEBUG_INFO = NO; 492 | ONLY_ACTIVE_ARCH = YES; 493 | SDKROOT = macosx; 494 | }; 495 | name = Release; 496 | }; 497 | /* End XCBuildConfiguration section */ 498 | 499 | /* Begin XCConfigurationList section */ 500 | 35CB509D24E2D606001E2639 /* Build configuration list for PBXNativeTarget "Big Sur" */ = { 501 | isa = XCConfigurationList; 502 | buildConfigurations = ( 503 | 35CB509E24E2D606001E2639 /* Debug */, 504 | 35CB509F24E2D606001E2639 /* Release */, 505 | ); 506 | defaultConfigurationIsVisible = 0; 507 | defaultConfigurationName = Release; 508 | }; 509 | 6863648A23E36CDF00549C37 /* Build configuration list for PBXNativeTarget "Catalina" */ = { 510 | isa = XCConfigurationList; 511 | buildConfigurations = ( 512 | 6863648B23E36CDF00549C37 /* Debug */, 513 | 6863648C23E36CDF00549C37 /* Release */, 514 | ); 515 | defaultConfigurationIsVisible = 0; 516 | defaultConfigurationName = Release; 517 | }; 518 | A612721C2039FD13009DD95B /* Build configuration list for PBXProject "Black80211" */ = { 519 | isa = XCConfigurationList; 520 | buildConfigurations = ( 521 | A612722A2039FD13009DD95B /* Debug */, 522 | A612722B2039FD13009DD95B /* Release */, 523 | ); 524 | defaultConfigurationIsVisible = 0; 525 | defaultConfigurationName = Release; 526 | }; 527 | /* End XCConfigurationList section */ 528 | }; 529 | rootObject = A61272192039FD13009DD95B /* Project object */; 530 | } 531 | -------------------------------------------------------------------------------- /Black80211.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Black80211.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Black80211.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Black80211.xcodeproj/xcuserdata/rpeshkov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Black80211_HighSierra.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | Black80211_Sierra.xcscheme 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | A61272212039FD13009DD95B 21 | 22 | primary 23 | 24 | 25 | A6881FF6209A29A3009B1576 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Black80211/Black80211Control.cpp: -------------------------------------------------------------------------------- 1 | /* add your code here*/ 2 | 3 | typedef unsigned int ifnet_ctl_cmd_t; 4 | 5 | #include "IONetworkInterface.h" 6 | #include "IONetworkController.h" 7 | 8 | #include "Black80211Control.hpp" 9 | #include "Black80211Interface.hpp" 10 | 11 | #include "debug.h" 12 | 13 | OSDefineMetaClassAndStructors(Black80211Control, IO80211Controller); 14 | #define super IO80211Controller 15 | 16 | bool Black80211Control::init(OSDictionary* parameters) { 17 | IOCTL_NAMES[353] = "NSS"; 18 | 19 | IOLog("Black80211: Init\n"); 20 | 21 | if (!super::init(parameters)) { 22 | IOLog("Black80211: Failed to call IO80211Controller::init!\n"); 23 | return false; 24 | } 25 | scan_result = nullptr; 26 | 27 | requestedScanning = false; 28 | powerState = APPLE80211_POWER_ON; 29 | networkIndex = 0; 30 | 31 | fInterface = nullptr; 32 | fTimerEventSource = nullptr; 33 | fWorkloop = nullptr; 34 | fCommandGate = nullptr; 35 | fProvider = nullptr; 36 | 37 | authtype_upper = 0; 38 | authtype_lower = 0; 39 | memset(&cipher_key, 0, sizeof(apple80211_key)); 40 | 41 | return true; 42 | } 43 | 44 | void Black80211Control::free() { 45 | IOLog("Black80211: Free\n"); 46 | 47 | ReleaseAll(); 48 | super::free(); 49 | } 50 | 51 | bool Black80211Control::useAppleRSNSupplicant(IO80211Interface *interface) { 52 | return true; 53 | } 54 | 55 | bool Black80211Control::useAppleRSNSupplicant(IO80211VirtualInterface *interface) { 56 | return true; 57 | } 58 | 59 | IOService* Black80211Control::probe(IOService *provider, SInt32 *score) { 60 | IOLog("Black80211: probing\n"); 61 | 62 | if (!super::probe(provider, score)) 63 | return NULL; 64 | 65 | fProvider = (Black80211Device*)provider->metaCast("Black80211Device"); 66 | 67 | if (!fProvider) { 68 | IOLog("Black80211: failed to find itlwm\n"); 69 | return NULL; 70 | } 71 | fProvider->retain(); 72 | 73 | return this; 74 | } 75 | 76 | IONetworkInterface *Black80211Control::createInterface() { 77 | auto *interface = new Black80211Interface; 78 | if (interface == NULL) 79 | return NULL; 80 | if (!interface->init(this)) { 81 | interface->release(); 82 | return NULL; 83 | } 84 | interface->setProperty(kIOBuiltin, true); 85 | return interface; 86 | } 87 | 88 | bool Black80211Control::createWorkLoop() { 89 | if(!fWorkloop) { 90 | fWorkloop = IO80211WorkLoop::workLoop(); 91 | } 92 | return (fWorkloop != NULL); 93 | } 94 | 95 | IOWorkLoop* Black80211Control::getWorkLoop() const { 96 | return fWorkloop; 97 | } 98 | 99 | bool Black80211Control::start(IOService* provider) { 100 | OSDictionary *matchingDict = provider->serviceMatching("AppleSMC"); 101 | if (!matchingDict) 102 | return false; 103 | 104 | IOService *smc = provider->waitForMatchingService(matchingDict); 105 | OSSafeReleaseNULL(matchingDict); 106 | 107 | if (!smc) 108 | return false; // too early 109 | 110 | OSSafeReleaseNULL(smc); 111 | 112 | IOLog("Black80211: Start\n"); 113 | 114 | createWorkLoop(); 115 | if (!fWorkloop) { 116 | IOLog("Black80211: Failed to get workloop!\n"); 117 | ReleaseAll(); 118 | return false; 119 | } 120 | 121 | 122 | fProvider->setController(this); 123 | 124 | if (!super::start(provider)) { 125 | IOLog("Black80211: Failed to call IO80211Controller::start!\n"); 126 | ReleaseAll(); 127 | return false; 128 | } 129 | 130 | fCommandGate = fProvider->getCommandGate(); 131 | if (!fCommandGate) { 132 | IOLog("Black80211: Failed to create command gate!\n"); 133 | ReleaseAll(); 134 | return false; 135 | } 136 | fCommandGate->retain(); 137 | 138 | fTimerEventSource = IOTimerEventSource::timerEventSource(this); 139 | if (!fTimerEventSource) { 140 | IOLog("Black80211: Failed to create timer event source!\n"); 141 | ReleaseAll(); 142 | return false; 143 | } 144 | 145 | fWorkloop->addEventSource(fTimerEventSource); 146 | 147 | mediumDict = OSDictionary::withCapacity(MEDIUM_TYPE_INVALID + 1); 148 | addMediumType(kIOMediumIEEE80211None, 0, MEDIUM_TYPE_NONE); 149 | addMediumType(kIOMediumIEEE80211Auto, 0, MEDIUM_TYPE_AUTO); 150 | addMediumType(kIOMediumIEEE80211DS1, 1000000, MEDIUM_TYPE_1MBIT); 151 | addMediumType(kIOMediumIEEE80211DS2, 2000000, MEDIUM_TYPE_2MBIT); 152 | addMediumType(kIOMediumIEEE80211DS5, 5500000, MEDIUM_TYPE_5MBIT); 153 | addMediumType(kIOMediumIEEE80211DS11, 11000000, MEDIUM_TYPE_11MBIT); 154 | addMediumType(kIOMediumIEEE80211, 54000000, MEDIUM_TYPE_54MBIT, "OFDM54"); 155 | //addMediumType(kIOMediumIEEE80211OptionAdhoc, 0, MEDIUM_TYPE_ADHOC,"ADHOC"); 156 | 157 | if (!publishMediumDictionary(mediumDict)) { 158 | IOLog("Black80211: Failed to publish medium dictionary!\n"); 159 | ReleaseAll(); 160 | return false; 161 | } 162 | 163 | if (!setCurrentMedium(mediumTable[MEDIUM_TYPE_AUTO])) { 164 | IOLog("Black80211: Failed to set current medium!\n"); 165 | ReleaseAll(); 166 | return false; 167 | } 168 | if (!setSelectedMedium(mediumTable[MEDIUM_TYPE_AUTO])) { 169 | IOLog("Black80211: Failed to set selected medium!\n"); 170 | ReleaseAll(); 171 | return false; 172 | } 173 | 174 | /* 175 | if (!setLinkStatus(kIONetworkLinkValid, mediumTable[MEDIUM_TYPE_AUTO])) { 176 | IOLog("Black80211: Failed to set link status!"); 177 | ReleaseAll(); 178 | return false; 179 | } 180 | */ 181 | if (!attachInterface((IONetworkInterface**) &fInterface, false)) { 182 | IOLog("Black80211: Failed to attach interface!\n"); 183 | ReleaseAll(); 184 | return false; 185 | } 186 | 187 | //((uint8_t*)fInterface)[0x160] &= ~2; // disable use of Apple RSN supplicant 188 | //((uint64_t*)fInterface)[0x280] = 0xffffffffffffffffull; // ffffull debug! 189 | 190 | attach(provider); 191 | fProvider->setInterface(fInterface); 192 | 193 | fInterface->registerService(); 194 | registerService(); 195 | 196 | return true; 197 | } 198 | 199 | bool Black80211Control::setLinkStatus( 200 | UInt32 status, 201 | const IONetworkMedium * activeMedium, 202 | UInt64 speed, 203 | OSData * data) { 204 | if (!fInterface) 205 | return false; 206 | IOLog("Changing link status: %d\n", status); 207 | bool ret = super::setLinkStatus(status, activeMedium, speed, data); 208 | if (status & kIONetworkLinkValid && status & kIONetworkLinkActive) { 209 | fInterface->setLinkState(kIO80211NetworkLinkUp, 0); 210 | } 211 | else if (status & kIONetworkLinkValid) { 212 | fInterface->setLinkState(kIO80211NetworkLinkDown, 0); 213 | } 214 | else { 215 | fInterface->setLinkState(kIO80211NetworkLinkUndefined, 0); 216 | } 217 | return ret; 218 | } 219 | 220 | IOReturn Black80211Control::enable(IONetworkInterface* iface) { 221 | IOLog("Black80211: enable"); 222 | IOMediumType mediumType = kIOMediumIEEE80211Auto; 223 | IONetworkMedium *medium = IONetworkMedium::getMediumWithType(mediumDict, mediumType); 224 | setLinkStatus(kIONetworkLinkValid, medium); 225 | 226 | fProvider->enable(); 227 | 228 | if(fInterface) { 229 | fInterface->postMessage(APPLE80211_M_POWER_CHANGED); 230 | } 231 | 232 | return kIOReturnSuccess; 233 | } 234 | 235 | IOReturn Black80211Control::disable(IONetworkInterface* iface) { 236 | IOLog("Black80211: disable"); 237 | fProvider->disable(); 238 | return kIOReturnSuccess; 239 | } 240 | 241 | bool Black80211Control::addMediumType(UInt32 type, UInt32 speed, UInt32 code, char* name) { 242 | bool ret = false; 243 | 244 | IONetworkMedium* medium = IONetworkMedium::medium(type, speed, 0, code, name); 245 | if (medium) { 246 | ret = IONetworkMedium::addMedium(mediumDict, medium); 247 | if (ret) 248 | mediumTable[code] = medium; 249 | medium->release(); 250 | } 251 | return ret; 252 | } 253 | 254 | 255 | void Black80211Control::stop(IOService* provider) { 256 | if (fCommandGate) { 257 | IOLog("Black80211::stop: Command gate alive. Disabling it.\n"); 258 | fCommandGate->disable(); 259 | IOLog("Black80211::stop: Done disabling command gate\n"); 260 | if (fWorkloop) { 261 | IOLog("Black80211::stop: Workloop alive. Removing command gate\n"); 262 | fWorkloop->removeEventSource(fCommandGate); 263 | } 264 | } 265 | 266 | if (fInterface) { 267 | IOLog("Black80211::stop: Detaching interface\n"); 268 | detachInterface(fInterface, true); 269 | OSSafeReleaseNULL(fInterface); 270 | fInterface = NULL; 271 | } 272 | 273 | detach(provider); 274 | 275 | super::stop(provider); 276 | } 277 | 278 | IOReturn Black80211Control::getHardwareAddress(IOEthernetAddress* addr) { 279 | return fProvider->getMACAddress(addr); 280 | } 281 | 282 | IOReturn Black80211Control::getHardwareAddressForInterface(IO80211Interface* netif, 283 | IOEthernetAddress* addr) { 284 | return getHardwareAddress(addr); 285 | } 286 | 287 | SInt32 Black80211Control::apple80211Request(unsigned int request_type, 288 | int request_number, 289 | IO80211Interface* interface, 290 | void* data) { 291 | if (request_type != SIOCGA80211 && request_type != SIOCSA80211) { 292 | IOLog("Black80211: Invalid IOCTL request type: %u\n", request_type); 293 | IOLog("Expected either %lu or %lu\n", SIOCGA80211, SIOCSA80211); 294 | return kIOReturnError; 295 | } 296 | return fCommandGate->runActionBlock(^IOReturn{ 297 | return apple80211RequestGated(request_type, request_number, interface, data); 298 | }); 299 | } 300 | 301 | SInt32 Black80211Control::apple80211RequestGated(unsigned int request_type, 302 | int request_number, 303 | IO80211Interface* interface, 304 | void* data) { 305 | IOReturn ret = 0; 306 | 307 | bool isGet = (request_type == SIOCGA80211); 308 | 309 | #define IOCTL(REQ_TYPE, REQ, DATA_TYPE) \ 310 | if (REQ_TYPE == SIOCGA80211) { \ 311 | ret = get##REQ(interface, (struct DATA_TYPE* )data); \ 312 | } else { \ 313 | ret = set##REQ(interface, (struct DATA_TYPE* )data); \ 314 | } 315 | 316 | #define IOCTL_GET(REQ_TYPE, REQ, DATA_TYPE) \ 317 | if (REQ_TYPE == SIOCGA80211) { \ 318 | ret = get##REQ(interface, (struct DATA_TYPE* )data); \ 319 | } 320 | #define IOCTL_SET(REQ_TYPE, REQ, DATA_TYPE) \ 321 | if (REQ_TYPE == SIOCSA80211) { \ 322 | ret = set##REQ(interface, (struct DATA_TYPE* )data); \ 323 | } 324 | 325 | IOLog("Black80211: IOCTL %s(%d) %s\n", 326 | isGet ? "get" : "set", 327 | request_number, 328 | IOCTL_NAMES[request_number]); 329 | 330 | switch (request_number) { 331 | case APPLE80211_IOC_SSID: // 1 332 | IOCTL(request_type, SSID, apple80211_ssid_data); 333 | break; 334 | case APPLE80211_IOC_AUTH_TYPE: // 2 335 | IOCTL(request_type, AUTH_TYPE, apple80211_authtype_data); 336 | break; 337 | case APPLE80211_IOC_CIPHER_KEY: // 3 338 | IOCTL(request_type, CIPHER_KEY, apple80211_key); 339 | break; 340 | case APPLE80211_IOC_CHANNEL: // 4 341 | IOCTL_GET(request_type, CHANNEL, apple80211_channel_data); 342 | break; 343 | case APPLE80211_IOC_PROTMODE: // 6 344 | IOCTL_GET(request_type, PROTMODE, apple80211_protmode_data); 345 | break; 346 | case APPLE80211_IOC_TXPOWER: // 7 347 | IOCTL_GET(request_type, TXPOWER, apple80211_txpower_data); 348 | break; 349 | case APPLE80211_IOC_RATE: // 8 350 | IOCTL_GET(request_type, RATE, apple80211_rate_data); 351 | break; 352 | case APPLE80211_IOC_BSSID: // 9 353 | IOCTL_GET(request_type, BSSID, apple80211_bssid_data); 354 | break; 355 | case APPLE80211_IOC_SCAN_REQ: // 10 356 | IOCTL_SET(request_type, SCAN_REQ, apple80211_scan_data); 357 | break; 358 | case APPLE80211_IOC_SCAN_REQ_MULTIPLE: 359 | IOCTL_SET(request_type, SCAN_REQ_MULTIPLE, apple80211_scan_multiple_data); 360 | break; 361 | case APPLE80211_IOC_SCAN_RESULT: // 11 362 | IOCTL_GET(request_type, SCAN_RESULT, apple80211_scan_result*); 363 | break; 364 | case APPLE80211_IOC_CARD_CAPABILITIES: // 12 365 | IOCTL_GET(request_type, CARD_CAPABILITIES, apple80211_capability_data); 366 | break; 367 | case APPLE80211_IOC_STATE: // 13 368 | IOCTL_GET(request_type, STATE, apple80211_state_data); 369 | break; 370 | case APPLE80211_IOC_PHY_MODE: // 14 371 | IOCTL_GET(request_type, PHY_MODE, apple80211_phymode_data); 372 | break; 373 | case APPLE80211_IOC_OP_MODE: // 15 374 | IOCTL_GET(request_type, OP_MODE, apple80211_opmode_data); 375 | break; 376 | case APPLE80211_IOC_RSSI: // 16 377 | IOCTL_GET(request_type, RSSI, apple80211_rssi_data); 378 | break; 379 | case APPLE80211_IOC_NOISE: // 17 380 | IOCTL_GET(request_type, NOISE, apple80211_noise_data); 381 | break; 382 | case APPLE80211_IOC_INT_MIT: // 18 383 | IOCTL_GET(request_type, INT_MIT, apple80211_intmit_data); 384 | break; 385 | case APPLE80211_IOC_POWER: // 19 386 | IOCTL(request_type, POWER, apple80211_power_data); 387 | break; 388 | case APPLE80211_IOC_ASSOCIATE: // 20 389 | IOCTL_SET(request_type, ASSOCIATE, apple80211_assoc_data); 390 | break; 391 | case APPLE80211_IOC_DISASSOCIATE: // 22 392 | if (request_type == SIOCSA80211) 393 | ret = setDISASSOCIATE(interface); 394 | break; 395 | case APPLE80211_IOC_SUPPORTED_CHANNELS: // 27 396 | IOCTL_GET(request_type, SUPPORTED_CHANNELS, apple80211_sup_channel_data); 397 | break; 398 | case APPLE80211_IOC_DEAUTH: // 29 399 | IOCTL_GET(request_type, DEAUTH, apple80211_deauth_data); 400 | break; 401 | case APPLE80211_IOC_LOCALE: // 28 402 | IOCTL_GET(request_type, LOCALE, apple80211_locale_data); 403 | break; 404 | case APPLE80211_IOC_TX_ANTENNA: // 37 405 | IOCTL_GET(request_type, TX_ANTENNA, apple80211_antenna_data); 406 | break; 407 | case APPLE80211_IOC_ANTENNA_DIVERSITY: // 39 408 | IOCTL_GET(request_type, ANTENNA_DIVERSITY, apple80211_antenna_data); 409 | break; 410 | case APPLE80211_IOC_DRIVER_VERSION: // 43 411 | IOCTL_GET(request_type, DRIVER_VERSION, apple80211_version_data); 412 | break; 413 | case APPLE80211_IOC_HARDWARE_VERSION: // 44 414 | IOCTL_GET(request_type, HARDWARE_VERSION, apple80211_version_data); 415 | break; 416 | case APPLE80211_IOC_RSN_IE: // 46 417 | IOCTL(request_type, RSN_IE, apple80211_rsn_ie_data); 418 | break; 419 | case APPLE80211_IOC_AP_IE_LIST: // 48 420 | IOCTL_GET(request_type, AP_IE_LIST, apple80211_ap_ie_data); 421 | break; 422 | case APPLE80211_IOC_ASSOCIATION_STATUS: // 50 423 | IOCTL_GET(request_type, ASSOCIATION_STATUS, apple80211_assoc_status_data); 424 | break; 425 | case APPLE80211_IOC_COUNTRY_CODE: // 51 426 | IOCTL_GET(request_type, COUNTRY_CODE, apple80211_country_code_data); 427 | break; 428 | case APPLE80211_IOC_RADIO_INFO: 429 | IOCTL_GET(request_type, RADIO_INFO, apple80211_radio_info_data); 430 | break; 431 | case APPLE80211_IOC_MCS: // 57 432 | IOCTL_GET(request_type, MCS, apple80211_mcs_data); 433 | break; 434 | case APPLE80211_IOC_WOW_PARAMETERS: // 69 435 | break; 436 | case APPLE80211_IOC_ROAM_THRESH:// 80 437 | IOCTL_GET(request_type, ROAM_THRESH, apple80211_roam_threshold_data); 438 | break; 439 | case APPLE80211_IOC_SCANCACHE_CLEAR: // 90 440 | if (request_type == SIOCSA80211) 441 | ret = setSCANCACHE_CLEAR(interface); 442 | break; 443 | case APPLE80211_IOC_TX_CHAIN_POWER: // 108 444 | break; 445 | case APPLE80211_IOC_THERMAL_THROTTLING: // 111 446 | break; 447 | case APPLE80211_IOC_LINK_CHANGED_EVENT_DATA: // 156 448 | IOCTL_GET(request_type, LINK_CHANGED_EVENT_DATA, apple80211_link_changed_event_data); 449 | break; 450 | case APPLE80211_IOC_HW_SUPPORTED_CHANNELS: // 254 451 | IOCTL_GET(request_type, HW_SUPPORTED_CHANNELS, apple80211_sup_channel_data); 452 | break; 453 | case APPLE80211_IOC_NSS: // 353 454 | IOCTL_GET(request_type, NSS, apple80211_nss_data); 455 | break; 456 | default: 457 | IOLog("Black80211: unhandled ioctl %s %d\n", request_number > 353 ? "" : IOCTL_NAMES[request_number], request_number); 458 | break; 459 | } 460 | #undef IOCTL 461 | 462 | return ret; 463 | } 464 | 465 | bool Black80211Control::configureInterface(IONetworkInterface *netif) { 466 | IOLog("Black80211: Configure interface\n"); 467 | if (!super::configureInterface(netif)) { 468 | return false; 469 | } 470 | 471 | return true; 472 | } 473 | 474 | IO80211Interface* Black80211Control::getNetworkInterface() { 475 | return fInterface; 476 | } 477 | 478 | const char* hexdump(uint8_t *buf, size_t len); 479 | 480 | UInt32 Black80211Control::outputPacket(mbuf_t packet, void* param) { 481 | uint8_t ether_type[2]; 482 | if (mbuf_len(packet) >= 14 && mbuf_copydata(packet, 12, 2, ðer_type) == 0 && (ether_type[0] == 0x88 && ether_type[1] == 0x8e)) { // EAPOL packet 483 | const char* dump = hexdump((uint8_t*)mbuf_data(packet), mbuf_len(packet)); 484 | IOLog("Black80211: output EAPOL packet, len: %zu, data: %s\n", mbuf_len(packet), dump ? dump : "Failed to allocate memory"); 485 | if (dump) 486 | IOFree((void*)dump, 3 * mbuf_len(packet) + 1); 487 | } 488 | return fProvider->outputPacket(packet, param); 489 | } 490 | 491 | int Black80211Control::outputActionFrame(IO80211Interface * interface, mbuf_t m) { 492 | IOLog("%s, length %zu\n", __FUNCTION__, mbuf_pkthdr_len(m)); 493 | return fProvider->outputPacket(m, nullptr); 494 | } 495 | 496 | int Black80211Control::outputRaw80211Packet(IO80211Interface * interface, mbuf_t m) { 497 | IOLog("%s, length %zu\n", __FUNCTION__, mbuf_pkthdr_len(m)); 498 | return fProvider->outputPacket(m, nullptr); 499 | } 500 | 501 | IOReturn Black80211Control::getMaxPacketSize( UInt32* maxSize ) const { 502 | *maxSize = 1500; 503 | return kIOReturnSuccess; 504 | } 505 | 506 | IOReturn Black80211Control::setPromiscuousMode(IOEnetPromiscuousMode mode) { 507 | IOLog("%s\n", __FUNCTION__); 508 | return kIOReturnSuccess; 509 | } 510 | 511 | IOReturn Black80211Control::setMulticastMode(IOEnetMulticastMode mode) { 512 | IOLog("%s\n", __FUNCTION__); 513 | return kIOReturnSuccess; 514 | } 515 | 516 | IOReturn Black80211Control::setMulticastList(IOEthernetAddress* addr, UInt32 len) { 517 | IOLog("%s\n", __FUNCTION__); 518 | return kIOReturnSuccess; 519 | } 520 | 521 | SInt32 Black80211Control::monitorModeSetEnabled(IO80211Interface* interface, 522 | bool enabled, 523 | UInt32 dlt) { 524 | IOLog("%s\n", __FUNCTION__); 525 | return kIOReturnSuccess; 526 | } 527 | 528 | const OSString* Black80211Control::newVendorString() const { 529 | return fProvider->newVendorString(); 530 | } 531 | 532 | const OSString* Black80211Control::newModelString() const { 533 | return fProvider->newModelString(); 534 | } 535 | 536 | const OSString* Black80211Control::newRevisionString() const { 537 | return OSString::withCString("1.0"); 538 | } 539 | -------------------------------------------------------------------------------- /Black80211/Black80211Control.hpp: -------------------------------------------------------------------------------- 1 | /* add your code here */ 2 | #ifndef net80211_Voodoo80211Device_h 3 | #define net80211_Voodoo80211Device_h 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | 25 | #include 26 | 27 | #include "interop.h" 28 | 29 | #include "apple80211.h" 30 | 31 | typedef enum { 32 | MEDIUM_TYPE_NONE = 0, 33 | MEDIUM_TYPE_AUTO, 34 | MEDIUM_TYPE_1MBIT, 35 | MEDIUM_TYPE_2MBIT, 36 | MEDIUM_TYPE_5MBIT, 37 | MEDIUM_TYPE_11MBIT, 38 | MEDIUM_TYPE_54MBIT, 39 | MEDIUM_TYPE_INVALID 40 | } mediumType_t; 41 | 42 | class Black80211Control : public IO80211Controller { 43 | 44 | OSDeclareDefaultStructors(Black80211Control) 45 | 46 | public: 47 | bool init(OSDictionary* parameters) override; 48 | void free() override; 49 | bool start(IOService* provider) override; 50 | void stop(IOService* provider) override; 51 | IOService* probe(IOService* provider, SInt32* score) override; 52 | 53 | SInt32 apple80211Request(unsigned int request_type, int request_number, IO80211Interface* interface, void* data) override; 54 | SInt32 apple80211RequestGated(unsigned int request_type, int request_number, IO80211Interface* interface, void* data); 55 | UInt32 outputPacket (mbuf_t m, void* param) override; 56 | IOReturn getMaxPacketSize(UInt32* maxSize) const; 57 | const OSString* newVendorString() const; 58 | const OSString* newModelString() const; 59 | const OSString* newRevisionString() const; 60 | IOReturn enable(IONetworkInterface *netif) override; 61 | IOReturn disable(IONetworkInterface *netif) override; 62 | bool configureInterface(IONetworkInterface *netif) override; 63 | IO80211Interface* getNetworkInterface() override; 64 | IOReturn getHardwareAddressForInterface(IO80211Interface* netif, IOEthernetAddress* addr) override; 65 | IOReturn getHardwareAddress(IOEthernetAddress* addr) override; 66 | IOReturn setPromiscuousMode(IOEnetPromiscuousMode mode) override; 67 | IOReturn setMulticastMode(IOEnetMulticastMode mode) override; 68 | IOReturn setMulticastList(IOEthernetAddress* addr, UInt32 len) override; 69 | SInt32 monitorModeSetEnabled(IO80211Interface* interface, bool enabled, UInt32 dlt) override; 70 | 71 | int outputRaw80211Packet(IO80211Interface *, mbuf_t) override; 72 | int outputActionFrame(IO80211Interface *, mbuf_t) override; 73 | 74 | bool createWorkLoop() override; 75 | IOWorkLoop* getWorkLoop() const override; 76 | 77 | IOReturn message(UInt32 type, IOService * provider, void * argument = NULL) override; 78 | 79 | virtual bool setLinkStatus( 80 | UInt32 status, 81 | const IONetworkMedium * activeMedium = 0, 82 | UInt64 speed = 0, 83 | OSData * data = 0) override; 84 | 85 | virtual IONetworkInterface * createInterface() override; 86 | 87 | virtual bool useAppleRSNSupplicant(IO80211Interface* interface) override; 88 | virtual bool useAppleRSNSupplicant(IO80211VirtualInterface* interface) override; 89 | 90 | protected: 91 | IO80211Interface* getInterface(); 92 | 93 | private: 94 | // 1 - SSID 95 | IOReturn getSSID(IO80211Interface* interface, struct apple80211_ssid_data* sd); 96 | IOReturn setSSID(IO80211Interface* interface, struct apple80211_ssid_data* sd); 97 | // 2 - AUTH_TYPE 98 | IOReturn getAUTH_TYPE(IO80211Interface* interface, struct apple80211_authtype_data* ad); 99 | IOReturn setAUTH_TYPE(IO80211Interface* interface, struct apple80211_authtype_data* ad); 100 | // 3 - CIPHER_KEY 101 | IOReturn getCIPHER_KEY(IO80211Interface* interface, struct apple80211_key* key); 102 | IOReturn setCIPHER_KEY(IO80211Interface* interface, struct apple80211_key* key); 103 | // 4 - CHANNEL 104 | IOReturn getCHANNEL(IO80211Interface* interface, struct apple80211_channel_data* cd); 105 | // 6 - PROTMODE 106 | IOReturn getPROTMODE(IO80211Interface* interface, struct apple80211_protmode_data* pd); 107 | // 7 - TXPOWER 108 | IOReturn getTXPOWER(IO80211Interface* interface, struct apple80211_txpower_data* txd); 109 | // 8 - RATE 110 | IOReturn getRATE(IO80211Interface* interface, struct apple80211_rate_data* rd); 111 | // 9 - BSSID 112 | IOReturn getBSSID(IO80211Interface* interface, struct apple80211_bssid_data* bd); 113 | // 10 - SCAN_REQ 114 | IOReturn setSCAN_REQ(IO80211Interface* interface, struct apple80211_scan_data* sd); 115 | IOReturn setSCAN_REQ_MULTIPLE(IO80211Interface* interface, struct apple80211_scan_multiple_data* sd); 116 | // 11 - SCAN_RESULT 117 | IOReturn getSCAN_RESULT(IO80211Interface* interface, apple80211_scan_result* *sr); 118 | // 12 - CARD_CAPABILITIES 119 | IOReturn getCARD_CAPABILITIES(IO80211Interface* interface, struct apple80211_capability_data* cd); 120 | // 13 - STATE 121 | IOReturn getSTATE(IO80211Interface* interface, struct apple80211_state_data* sd); 122 | IOReturn setSTATE(IO80211Interface* interface, struct apple80211_state_data* sd); 123 | // 14 - PHY_MODE 124 | IOReturn getPHY_MODE(IO80211Interface* interface, struct apple80211_phymode_data* pd); 125 | // 15 - OP_MODE 126 | IOReturn getOP_MODE(IO80211Interface* interface, struct apple80211_opmode_data* od); 127 | // 16 - RSSI 128 | IOReturn getRSSI(IO80211Interface* interface, struct apple80211_rssi_data* rd); 129 | // 17 - NOISE 130 | IOReturn getNOISE(IO80211Interface* interface,struct apple80211_noise_data* nd); 131 | // 18 - INT_MIT 132 | IOReturn getINT_MIT(IO80211Interface* interface, struct apple80211_intmit_data* imd); 133 | // 19 - POWER 134 | IOReturn getPOWER(IO80211Interface* interface, struct apple80211_power_data* pd); 135 | IOReturn setPOWER(IO80211Interface* interface, struct apple80211_power_data* pd); 136 | // 20 - ASSOCIATE 137 | IOReturn setASSOCIATE(IO80211Interface* interface, struct apple80211_assoc_data* ad); 138 | // 22 - DISASSOCIATE 139 | IOReturn setDISASSOCIATE(IO80211Interface* interface); 140 | // 27 - SUPPORTED_CHANNELS 141 | IOReturn getSUPPORTED_CHANNELS(IO80211Interface* interface, struct apple80211_sup_channel_data* ad); 142 | // 28 - LOCALE 143 | IOReturn getLOCALE(IO80211Interface* interface, struct apple80211_locale_data* ld); 144 | // 29 - DEAUTH 145 | IOReturn getDEAUTH(IO80211Interface* interface, struct apple80211_deauth_data* dd); 146 | // 37 - TX_ANTENNA 147 | IOReturn getTX_ANTENNA(IO80211Interface* interface, apple80211_antenna_data* ad); 148 | // 39 - ANTENNA_DIVERSITY 149 | IOReturn getANTENNA_DIVERSITY(IO80211Interface* interface, apple80211_antenna_data* ad); 150 | // 43 - DRIVER_VERSION 151 | IOReturn getDRIVER_VERSION(IO80211Interface* interface, struct apple80211_version_data* hv); 152 | // 44 - HARDWARE_VERSION 153 | IOReturn getHARDWARE_VERSION(IO80211Interface* interface, struct apple80211_version_data* hv); 154 | // 46 - RSN_IE 155 | IOReturn getRSN_IE(IO80211Interface *interface, struct apple80211_rsn_ie_data *rsn_ie_data); 156 | IOReturn setRSN_IE(IO80211Interface *interface, struct apple80211_rsn_ie_data *rsn_ie_data); 157 | // 48 - AP_IE_LIST 158 | IOReturn getAP_IE_LIST(IO80211Interface *interface, struct apple80211_ap_ie_data *ap_ie_data); 159 | // 50 - ASSOCIATION_STATUS 160 | IOReturn getASSOCIATION_STATUS(IO80211Interface *interface, struct apple80211_assoc_status_data *sd); 161 | // 51 - COUNTRY_CODE 162 | IOReturn getCOUNTRY_CODE(IO80211Interface* interface, struct apple80211_country_code_data* cd); 163 | // 57 - MCS 164 | IOReturn getMCS(IO80211Interface* interface, struct apple80211_mcs_data* md); 165 | IOReturn getROAM_THRESH(IO80211Interface* interface, struct apple80211_roam_threshold_data* md); 166 | IOReturn getRADIO_INFO(IO80211Interface* interface, struct apple80211_radio_info_data* md); 167 | // 90 - SCANCACHE_CLEAR 168 | IOReturn setSCANCACHE_CLEAR(IO80211Interface* interface); 169 | // 156 - LINK_CHANGED_EVENT_DATA 170 | IOReturn getLINK_CHANGED_EVENT_DATA(IO80211Interface* interface, struct apple80211_link_changed_event_data* ed); 171 | // 254 - HW_SUPPORTED_CHANNELS 172 | IOReturn getHW_SUPPORTED_CHANNELS(IO80211Interface *interface, struct apple80211_sup_channel_data *cd); 173 | // 353 - NSS 174 | IOReturn getNSS(IO80211Interface *interface, struct apple80211_nss_data *nd); 175 | 176 | 177 | inline void ReleaseAll() { 178 | OSSafeReleaseNULL(fCommandGate); 179 | OSSafeReleaseNULL(fWorkloop); 180 | OSSafeReleaseNULL(mediumDict); 181 | OSSafeReleaseNULL(fWorkloop); 182 | OSSafeReleaseNULL(fTimerEventSource); 183 | } 184 | 185 | bool addMediumType(UInt32 type, UInt32 speed, UInt32 code, char* name = 0); 186 | static void postScanningDoneMessage(OSObject* self, ...); 187 | public: 188 | ScanResult* scan_result; 189 | 190 | IOWorkLoop* fWorkloop; 191 | IO80211Interface* fInterface; 192 | IOCommandGate* fCommandGate; 193 | Black80211Device* fProvider; 194 | IOTimerEventSource* fTimerEventSource; 195 | 196 | size_t networkIndex = 0; 197 | 198 | OSDictionary* mediumDict; 199 | IONetworkMedium* mediumTable[MEDIUM_TYPE_INVALID]; 200 | 201 | bool requestedScanning; 202 | bool requestIsMulti; 203 | struct apple80211_scan_data request; 204 | struct apple80211_scan_multiple_data multiRequest; 205 | 206 | uint32_t authtype_lower; 207 | uint32_t authtype_upper; 208 | 209 | uint32_t powerState; 210 | 211 | apple80211_key cipher_key; 212 | }; 213 | 214 | #endif 215 | -------------------------------------------------------------------------------- /Black80211/Black80211Interface.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Black80211Interface.cpp 3 | // Black80211_Catalina 4 | // 5 | // Created by usrsse2 on 29.07.2020. 6 | // Copyright © 2020 Roman Peshkov. All rights reserved. 7 | // 8 | 9 | #include "Black80211Interface.hpp" 10 | 11 | #define super IO80211Interface 12 | 13 | OSDefineMetaClassAndStructors(Black80211Interface, IO80211Interface); 14 | 15 | const char* hexdump(uint8_t *buf, size_t len); 16 | 17 | UInt32 Black80211Interface::inputPacket(mbuf_t packet, UInt32 length, IOOptionBits options, void *param) { 18 | uint16_t ether_type; 19 | size_t len = mbuf_len(packet); 20 | if (len >= 14 && mbuf_copydata(packet, 12, 2, ðer_type) == 0 && ether_type == _OSSwapInt16(ETHERTYPE_PAE)) { // EAPOL packet 21 | const char* dump = hexdump((uint8_t*)mbuf_data(packet), len); 22 | IOLog("Black80211: input EAPOL packet, len: %zu, data: %s\n", len, dump ? dump : "Failed to allocate memory"); 23 | if (dump) 24 | IOFree((void*)dump, 3 * len + 1); 25 | return IO80211Interface::inputPacket(packet, (UInt32)len, 0, param); 26 | } 27 | return IONetworkInterface::inputPacket(packet, length, options, param); 28 | } 29 | -------------------------------------------------------------------------------- /Black80211/Black80211Interface.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Black80211Interface.hpp 3 | // Black80211_Catalina 4 | // 5 | // Created by usrsse2 on 29.07.2020. 6 | // Copyright © 2020 Roman Peshkov. All rights reserved. 7 | // 8 | 9 | #ifndef Black80211Interface_hpp 10 | #define Black80211Interface_hpp 11 | 12 | #include "IO80211Controller.h" 13 | #include "IO80211Interface.h" 14 | 15 | class Black80211Interface : public IO80211Interface { 16 | OSDeclareDefaultStructors( Black80211Interface ); 17 | 18 | public: 19 | virtual UInt32 inputPacket(mbuf_t packet, UInt32 length = 0, IOOptionBits options = 0, void *param = 0) override; 20 | }; 21 | 22 | #endif /* Black80211Interface_hpp */ 23 | -------------------------------------------------------------------------------- /Black80211/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | KEXT 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | IOKitPersonalities 26 | 27 | Black80211 28 | 29 | CFBundleIdentifier 30 | net.rpeshkov.${PRODUCT_NAME:rfc1034identifier} 31 | IOClass 32 | Black80211Control 33 | IOProviderClass 34 | Black80211Device 35 | 36 | 37 | NSHumanReadableCopyright 38 | Copyright © 2018 Roman Peshkov. All rights reserved. 39 | OSBundleLibraries 40 | 41 | com.apple.iokit.IO80211Family 42 | 1200.12.2b1 43 | com.apple.iokit.IONetworkingFamily 44 | 3.2 45 | com.apple.iokit.IOPCIFamily 46 | 2.9 47 | com.apple.kpi.bsd 48 | 16.7 49 | com.apple.kpi.iokit 50 | 16.7 51 | com.apple.kpi.libkern 52 | 16.7 53 | com.apple.kpi.mach 54 | 16.7 55 | 56 | OSBundleRequired 57 | Network-Root 58 | 59 | 60 | -------------------------------------------------------------------------------- /Black80211/apple80211.h: -------------------------------------------------------------------------------- 1 | // 2 | // apple80211.h 3 | // Black80211 4 | // 5 | // Created by Roman Peshkov on 02/05/2018. 6 | // Copyright © 2018 Roman Peshkov. All rights reserved. 7 | // 8 | 9 | #ifndef apple80211_h 10 | #define apple80211_h 11 | 12 | #include "apple80211/catalina/IO80211Controller.h" 13 | #include "apple80211/catalina/IO80211WorkLoop.h" 14 | #include "apple80211/catalina/IO80211Interface.h" 15 | 16 | #endif /* apple80211_h */ 17 | -------------------------------------------------------------------------------- /Black80211/apple80211/catalina/IO80211Controller.h: -------------------------------------------------------------------------------- 1 | #ifndef _IO80211CONTROLLER_H 2 | #define _IO80211CONTROLLER_H 3 | 4 | #if defined(KERNEL) && defined(__cplusplus) 5 | 6 | #include 7 | 8 | #if VERSION_MAJOR > 8 9 | #define _MODERN_BPF 10 | #endif 11 | 12 | #include 13 | 14 | #include 15 | //#include "IOEthernetController.h" 16 | 17 | #include 18 | #include 19 | 20 | #include "apple80211_ioctl.h" 21 | #include "IO80211SkywalkInterface.h" 22 | #include "IO80211WorkLoop.h" 23 | 24 | #define AUTH_TIMEOUT 15 // seconds 25 | 26 | /*! @enum LinkSpeed. 27 | @abstract ???. 28 | @discussion ???. 29 | @constant LINK_SPEED_80211A 54 Mbps 30 | @constant LINK_SPEED_80211B 11 Mbps. 31 | @constant LINK_SPEED_80211G 54 Mbps. 32 | */ 33 | enum { 34 | LINK_SPEED_80211A = 54000000ul, // 54 Mbps 35 | LINK_SPEED_80211B = 11000000ul, // 11 Mbps 36 | LINK_SPEED_80211G = 54000000ul, // 54 Mbps 37 | LINK_SPEED_80211N = 300000000ul, // 300 Mbps (MCS index 15, 400ns GI, 40 MHz channel) 38 | }; 39 | 40 | enum IO80211CountryCodeOp 41 | { 42 | kIO80211CountryCodeReset, // Reset country code to world wide default, and start 43 | // searching for 802.11d beacon 44 | }; 45 | typedef enum IO80211CountryCodeOp IO80211CountryCodeOp; 46 | 47 | enum IO80211SystemPowerState 48 | { 49 | kIO80211SystemPowerStateUnknown, 50 | kIO80211SystemPowerStateAwake, 51 | kIO80211SystemPowerStateSleeping, 52 | }; 53 | typedef enum IO80211SystemPowerState IO80211SystemPowerState; 54 | 55 | enum IO80211FeatureCode 56 | { 57 | kIO80211Feature80211n = 1, 58 | }; 59 | typedef enum IO80211FeatureCode IO80211FeatureCode; 60 | 61 | 62 | class IOSkywalkInterface; 63 | class IO80211ScanManager; 64 | enum CCStreamLogLevel 65 | { 66 | LEVEL_1, 67 | }; 68 | 69 | enum scanSource 70 | { 71 | SOURCE_1, 72 | }; 73 | 74 | enum joinStatus 75 | { 76 | STATUS_1, 77 | }; 78 | 79 | class IO80211Controller; 80 | class IO80211Interface; 81 | class IO80211VirtualInterface; 82 | class IO80211ControllerMonitor; 83 | class CCLogPipe; 84 | class CCIOReporterLogStream; 85 | class CCLogStream; 86 | class IO80211VirtualInterface; 87 | class IO80211RangingManager; 88 | class IO80211FlowQueue; 89 | class IO80211FlowQueueLegacy; 90 | class FlowIdMetadata; 91 | class IOReporter; 92 | extern void IO80211VirtualInterfaceNamerRetain(); 93 | 94 | 95 | struct apple80211_hostap_state; 96 | 97 | struct apple80211_awdl_sync_channel_sequence; 98 | struct ieee80211_ht_capability_ie; 99 | struct apple80211_channel_switch_announcement; 100 | struct apple80211_beacon_period_data; 101 | struct apple80211_power_debug_sub_info; 102 | struct apple80211_stat_report; 103 | struct apple80211_frame_counters; 104 | struct apple80211_leaky_ap_event; 105 | struct apple80211_chip_stats; 106 | struct apple80211_extended_stats; 107 | struct apple80211_ampdu_stat_report; 108 | struct apple80211_btCoex_report; 109 | struct apple80211_cca_report; 110 | class CCPipe; 111 | struct apple80211_lteCoex_report; 112 | 113 | //typedef int scanSource; 114 | //typedef int joinStatus; 115 | //typedef int CCStreamLogLevel; 116 | typedef IOReturn (*IOCTL_FUNC)(IO80211Controller*, IO80211Interface*, IO80211VirtualInterface*, apple80211req*, bool); 117 | extern IOCTL_FUNC gGetHandlerTable[]; 118 | extern IOCTL_FUNC gSetHandlerTable[]; 119 | 120 | #define __int64 int 121 | #define ulong unsigned long 122 | #define _QWORD UInt64 123 | #define uint UInt 124 | 125 | class IO80211Controller : public IOEthernetController { 126 | OSDeclareAbstractStructors(IO80211Controller) 127 | 128 | public: 129 | virtual void free() override; 130 | virtual bool init(OSDictionary *) override; 131 | virtual IOReturn configureReport(IOReportChannelList *,uint,void *,void *) override; 132 | virtual IOReturn updateReport(IOReportChannelList *,uint,void *,void *) override; 133 | virtual bool start(IOService *) override; 134 | virtual void stop(IOService *) override; 135 | virtual IOService* getProvider(void) const override; 136 | virtual IOWorkLoop* getWorkLoop(void) const override; 137 | virtual const char* stringFromReturn(int) override; 138 | virtual int errnoFromReturn(int) override; 139 | virtual IOOutputQueue* getOutputQueue(void) const override; 140 | virtual bool createWorkLoop(void) override; 141 | virtual IOReturn enable(IONetworkInterface *) override; 142 | virtual IOReturn disable(IONetworkInterface *) override; 143 | virtual bool attachInterface(IONetworkInterface **, bool attach = true) override; 144 | virtual void detachInterface(IONetworkInterface *, bool sync = false) override; 145 | virtual IONetworkInterface* createInterface(void) override; 146 | virtual bool configureInterface(IONetworkInterface *) override; 147 | virtual IOReturn outputStart(IONetworkInterface *,uint); 148 | virtual IOReturn getHardwareAddress(IOEthernetAddress *) override; 149 | virtual void requestPacketTx(void*, uint); 150 | virtual IOReturn getHardwareAddressForInterface(IO80211Interface *,IOEthernetAddress *); 151 | virtual void inputMonitorPacket(mbuf_t,uint,void *,ulong); 152 | virtual int outputRaw80211Packet(IO80211Interface *,mbuf_t); 153 | virtual int outputActionFrame(IO80211Interface *,mbuf_t); 154 | virtual int bpfOutputPacket(OSObject *,uint,mbuf_t); 155 | virtual SInt32 monitorModeSetEnabled(IO80211Interface*, bool, uint); 156 | virtual IO80211Interface* getNetworkInterface(void); 157 | virtual IO80211SkywalkInterface* getPrimarySkywalkInterface(void); 158 | virtual SInt32 apple80211_ioctl(IO80211Interface *, IO80211VirtualInterface*, ifnet_t,ulong,void *); 159 | virtual SInt32 apple80211_ioctl(IO80211SkywalkInterface *,ulong,void *); 160 | virtual SInt32 apple80211_ioctl(IO80211Interface *, ifnet_t,ulong id,void *) { return 0; }; 161 | 162 | // WTF? 163 | virtual SInt32 apple80211Request(unsigned int, int, IO80211Interface*, void*) = 0; 164 | 165 | virtual SInt32 apple80211VirtualRequest(uint,int,IO80211VirtualInterface *,void *); 166 | virtual SInt32 apple80211SkywalkRequest(uint,int,IO80211SkywalkInterface *,void *); 167 | virtual SInt32 stopDMA() { return 0x66; }; 168 | virtual UInt32 hardwareOutputQueueDepth(IO80211Interface*) { return 0; }; 169 | virtual SInt32 performCountryCodeOperation(IO80211Interface*, IO80211CountryCodeOp) { return 0; }; 170 | virtual bool useAppleRSNSupplicant(IO80211Interface *); 171 | virtual bool useAppleRSNSupplicant(IO80211VirtualInterface *); 172 | virtual void dataLinkLayerAttachComplete(IO80211Interface *); 173 | virtual SInt32 enableFeature(IO80211FeatureCode, void*) { return 0; }; 174 | virtual SInt32 setVirtualHardwareAddress(IO80211VirtualInterface *,ether_addr *); 175 | virtual SInt32 enableVirtualInterface(IO80211VirtualInterface *); 176 | virtual SInt32 disableVirtualInterface(IO80211VirtualInterface *); 177 | virtual bool requiresExplicitMBufRelease() { return false; }; 178 | virtual bool flowIdSupported() { return false; }; 179 | virtual IO80211FlowQueueLegacy* requestFlowQueue(FlowIdMetadata const*); 180 | virtual void releaseFlowQueue(IO80211FlowQueue *); 181 | virtual void getLogPipes(CCPipe**, CCPipe**, CCPipe**) {}; 182 | virtual IOReturn enablePacketTimestamping(void) { 183 | return kIOReturnUnsupported; 184 | } 185 | virtual IOReturn disablePacketTimestamping(void) { 186 | return kIOReturnUnsupported; 187 | } 188 | virtual UInt32 selfDiagnosticsReport(int,char const*,uint); 189 | virtual UInt32 getDataQueueDepth(OSObject *); 190 | #ifdef BIG_SUR 191 | virtual bool isAssociatedToMovingNetwork(void) { return false; } 192 | #endif 193 | virtual mbuf_flags_t inputPacket(mbuf_t); 194 | virtual SInt32 apple80211_ioctl_get(IO80211Interface *,IO80211VirtualInterface *,ifnet_t,void *); 195 | virtual SInt32 apple80211_ioctl_get(IO80211SkywalkInterface *,void *); 196 | virtual SInt32 apple80211_ioctl_set(IO80211Interface *,IO80211VirtualInterface *,IO80211SkywalkInterface *,void *); 197 | virtual SInt32 apple80211_ioctl_set(IO80211SkywalkInterface *,void*); 198 | virtual bool attachInterface(IOSkywalkInterface *,IOService *); 199 | #ifdef BIG_SUR 200 | virtual bool detachInterface(IOSkywalkInterface *, bool); 201 | #endif 202 | virtual IO80211VirtualInterface* createVirtualInterface(ether_addr *,uint); 203 | virtual bool attachVirtualInterface(IO80211VirtualInterface **,ether_addr *,uint,bool); 204 | virtual bool detachVirtualInterface(IO80211VirtualInterface *,bool); 205 | virtual IOReturn enable(IO80211SkywalkInterface *); 206 | virtual IOReturn disable(IO80211SkywalkInterface *); 207 | 208 | IO80211SkywalkInterface* getInfraInterface(void); 209 | IO80211ScanManager* getPrimaryInterfaceScanManager(void); 210 | IO80211ControllerMonitor* getInterfaceMonitor(void); 211 | IOReturn addReporterLegend(IOService *,IOReporter *,char const*,char const*); 212 | IOReturn removeReporterFromLegend(IOService *,IOReporter *,char const*,char const*); 213 | IOReturn unlockIOReporterLegend(void); 214 | void lockIOReporterLegend(void);//怀疑对象,之前是返回int 215 | IOReturn logIOReportLogStreamSubscription(ulong long); 216 | IOReturn addIOReportLogStreamForProvider(IOService *,ulong long *); 217 | IOReturn addSubscriptionForThisReporterFetchedOnTimer(IOReporter *,char const*,char const*,IOService *) ; 218 | IOReturn addSubscriptionForProviderFetchedOnTimer(IOService *); 219 | void handleIOReporterTimer(IOTimerEventSource *); 220 | void setIOReportersStreamFlags(ulong long); 221 | void updateIOReportersStreamFrequency(void); //怀疑对象,之前是返回int 222 | void setIOReportersStreamLevel(CCStreamLogLevel); 223 | void powerChangeGated(OSObject *,void *,void *,void *,void *); 224 | int copyOut(void const*,ulong long,ulong); 225 | SInt32 getASSOCIATE_RESULT(IO80211Interface *,IO80211VirtualInterface *,IO80211SkywalkInterface *,apple80211_assoc_result_data * assoc_result); 226 | 227 | /* 228 | virtual IOReturn setChanNoiseFloorLTE(apple80211_stat_report *,int) { 229 | return kIOReturnSuccess; 230 | } 231 | virtual IOReturn setChanNoiseFloor(apple80211_stat_report *,int) { 232 | return kIOReturnSuccess; 233 | } 234 | virtual IOReturn setChanCCA(apple80211_stat_report *,int) { 235 | return kIOReturnSuccess; 236 | } 237 | virtual IOReturn setChanExtendedCCA(apple80211_stat_report *,apple80211_cca_report *) { 238 | return kIOReturnSuccess; 239 | } 240 | virtual bool setLTECoexstat(apple80211_stat_report *,apple80211_lteCoex_report *) { 241 | return false; 242 | } 243 | virtual bool setBTCoexstat(apple80211_stat_report *,apple80211_btCoex_report *) { 244 | return false; 245 | } 246 | virtual bool setAMPDUstat(apple80211_stat_report *,apple80211_ampdu_stat_report *,apple80211_channel *) { 247 | return false; 248 | } 249 | virtual UInt32 getCountryCode(apple80211_country_code_data *) { 250 | return 0; 251 | } 252 | virtual IOReturn setCountryCode(apple80211_country_code_data *) { 253 | return kIOReturnUnsupported; 254 | } 255 | virtual bool getInfraExtendedStats(apple80211_extended_stats *) { 256 | return false; 257 | } 258 | virtual bool getChipCounterStats(apple80211_chip_stats *) { 259 | return false; 260 | } 261 | virtual bool setExtendedChipCounterStats(apple80211_stat_report *,void *) { 262 | return false; 263 | } 264 | bool setChipCounterStats(apple80211_stat_report *,apple80211_chip_stats *,apple80211_channel *) { 265 | return false; 266 | } 267 | virtual bool setLeakyAPStats(apple80211_leaky_ap_event *) { 268 | return false; 269 | } 270 | bool setFrameStats(apple80211_stat_report *,apple80211_frame_counters *,apple80211_channel *) { 271 | return false; 272 | } 273 | bool setPowerStats(apple80211_stat_report *,apple80211_power_debug_sub_info *) { 274 | return false; 275 | } 276 | */ 277 | 278 | IOReturn copyIn(ulong long,void *,ulong); 279 | void logIOCTL(apple80211req *); 280 | bool isIOCTLLoggingRestricted(apple80211req *); 281 | bool getBeaconPeriod(apple80211_beacon_period_data *); 282 | SInt32 apple80211VirtualRequestIoctl(uint,int,IO80211VirtualInterface *,void *); 283 | bool getBSSIDData(OSObject *,apple80211_bssid_data *); 284 | bool getSSIDData(apple80211_ssid_data *); 285 | bool inputInfraPacket(mbuf_t); 286 | void notifyHostapState(apple80211_hostap_state *); 287 | bool isAwdlAssistedDiscoveryEnabled(void); 288 | void joinDone(scanSource,joinStatus); 289 | void joinStarted(scanSource,joinStatus); 290 | void handleChannelSwitchAnnouncement(apple80211_channel_switch_announcement *); 291 | void scanDone(scanSource,int); 292 | void scanStarted(scanSource,apple80211_scan_data *); 293 | void printChannels(void); 294 | void updateInterfaceCoexRiskPct(ulong long); 295 | SInt32 getInfraChannel(apple80211_channel_data *); 296 | void calculateInterfacesAvaiability(void);//怀疑对象,之前是返回int 297 | void setChannelSequenceList(apple80211_awdl_sync_channel_sequence *);//怀疑对象,之前是返回int 298 | void setPrimaryInterfaceDatapathState(bool); 299 | UInt32 getPrimaryInterfaceLinkState(void); 300 | void setCurrentChannel(apple80211_channel *);//怀疑对象,之前是返回int 301 | void setHtCapability(ieee80211_ht_capability_ie *); 302 | UInt32 getHtCapability(void); 303 | UInt32 getHtCapabilityLength(void); 304 | bool io80211isDebuggable(bool* enable); 305 | void logDebug(ulong long,char const*,...);//怀疑对象,之前是返回int 306 | void vlogDebug(ulong long,char const*,va_list);//怀疑对象,之前是返回char 307 | void logDebug(char const*,...);//怀疑对象,之前是返回int 308 | bool calculateInterfacesCoex(void); 309 | void setInfraChannel(apple80211_channel *); 310 | void configureAntennae(void); 311 | SInt32 apple80211RequestIoctl(uint,int,IO80211Interface *,void *); 312 | UInt32 radioCountForInterface(IO80211Interface *); 313 | void releaseIOReporters(void); 314 | bool findAndAttachToFaultReporter(void); 315 | UInt32 setupControlPathLogging(void); 316 | IOReturn createIOReporters(IOService *); 317 | IOReturn powerChangeHandler(void *,void *,uint,IOService *,void *,ulong); 318 | 319 | 320 | OSMetaClassDeclareReservedUnused( IO80211Controller, 0); 321 | OSMetaClassDeclareReservedUnused( IO80211Controller, 1); 322 | OSMetaClassDeclareReservedUnused( IO80211Controller, 2); 323 | OSMetaClassDeclareReservedUnused( IO80211Controller, 3); 324 | OSMetaClassDeclareReservedUnused( IO80211Controller, 4); 325 | OSMetaClassDeclareReservedUnused( IO80211Controller, 5); 326 | OSMetaClassDeclareReservedUnused( IO80211Controller, 6); 327 | OSMetaClassDeclareReservedUnused( IO80211Controller, 7); 328 | OSMetaClassDeclareReservedUnused( IO80211Controller, 8); 329 | OSMetaClassDeclareReservedUnused( IO80211Controller, 9); 330 | OSMetaClassDeclareReservedUnused( IO80211Controller, 10); 331 | OSMetaClassDeclareReservedUnused( IO80211Controller, 11); 332 | OSMetaClassDeclareReservedUnused( IO80211Controller, 12); 333 | OSMetaClassDeclareReservedUnused( IO80211Controller, 13); 334 | OSMetaClassDeclareReservedUnused( IO80211Controller, 14); 335 | OSMetaClassDeclareReservedUnused( IO80211Controller, 15); 336 | 337 | protected: 338 | static IORegistryPlane gIO80211Plane; 339 | static IORegistryEntry* kIO80211PlaneName; 340 | //0x118 341 | IOTimerEventSource * _report_gathering_timer; // 0x118 342 | OSArray * _reporter_num; // 0x120 OSArray of OSNumber 343 | UInt32 _var_128; // timeout ticks 344 | bool _wan_debug_enable; // 0x12c 345 | // 3 bytes padding 346 | UInt32 _debug_value; // 0x130 347 | IORecursiveLock * _recursive_lock; // 0x138 348 | UInt64 _ht_cap_0x0; // 0x140 349 | UInt64 _ht_cap_0x8; // 0x148 350 | UInt64 _ht_cap_0x10; // 0x150 351 | UInt32 _ht_cap_0x18; // 0x158 352 | UInt32 _ht_cap_len; // 0x15c 353 | IO80211ControllerMonitor * _fControllerMonitor; // 0x160 354 | CCLogPipe * _fControllerIOReporterPipe; // 0x168 355 | CCIOReporterLogStream * _fControllerIOReporterStream; // 0x170 356 | CCLogPipe * _controlPathLogPipe; // 0x180 357 | CCLogStream * _ioctlLogStream; // 0x188 358 | CCLogStream * _eventLogStream; // 0x190 359 | IO80211WorkLoop * _workLoop; // 0x198 360 | IO80211Interface * _interface; // 0x1a0 361 | IO80211VirtualInterface * _v_interface; // 0x1a8 362 | IO80211VirtualInterface (* _vir_interface)[4]; // 0x1b0 363 | 364 | UInt64 _vlog_debug ; // 0x1d0 vlogDebug ? 365 | UInt32 _unknown; // 0x1d8 366 | UInt32 _infra_channel; // 0x1dc compared with offset 8 of apple80211_stat_report IO80211Controller::setChanCCA(apple80211_stat_report*, int) 367 | UInt32 _infra_channel_flags; // 0x1e0 compared with offset 8 of apple80211_channel 368 | UInt32 _current_channel; // 0x1e8 loaded with offset 04 of apple80211_channel 369 | UInt32 _current_channel_flags; // 0x1ec loaded with offset 08 of apple80211_channel 370 | UInt8 _awdl_sync[0x190]; // 0x1f0, 0x190 bytes apple80211_awdl_sync_channel_sequence 371 | IONotifier * _powerDownNotifier; // 0x380 372 | IOService * _provider; // 0x388 373 | IO80211RangingManager * _ranger_manager; // 0x390 374 | bool _var_398; // 0x398 checked in IO80211Controller::disable(IONetworkInterface*) 375 | // 7 byte padding 376 | IONotifier * _notifier1; // 0x3a0 377 | bool _var_3a8; // 0x3a8 378 | // 7 byte padding 379 | UInt64 _last_pointer; // 0x3b0 unused 380 | uint8_t filler[0x2B2]; 381 | //0x3CA 382 | }; 383 | 384 | // 0x215: 1 byte, length of channel sequence, should be 16 385 | // 0x21c: channel sequence, should contain 16 elements of length 12, possibly apple80211_channel (but why 16?) 386 | // struct of three ints, last looks like flags, first unused 387 | 388 | /* 389 | void __thiscall 390 | setChannelSequenceList(IO80211Controller *this,apple80211_awdl_sync_channel_sequence *param_1) 391 | 392 | { 393 | _memcpy(this + 0x210,param_1,400); 394 | calculateInterfacesAvaiability(this); 395 | return; 396 | } 397 | */ 398 | 399 | 400 | #endif /* defined(KERNEL) && defined(__cplusplus) */ 401 | 402 | #endif /* !_IO80211CONTROLLER_H */ 403 | -------------------------------------------------------------------------------- /Black80211/apple80211/catalina/IO80211Interface.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _IO80211INTERFACE_H 3 | #define _IO80211INTERFACE_H 4 | 5 | /* 6 | * Kernel 7 | */ 8 | #if defined(KERNEL) && defined(__cplusplus) 9 | 10 | #include 11 | 12 | #if VERSION_MAJOR > 8 13 | #define _MODERN_BPF 14 | #endif 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | enum IO80211LinkState 21 | { 22 | kIO80211NetworkLinkUndefined, // Starting link state when an interface is created 23 | kIO80211NetworkLinkDown, // Interface not capable of transmitting packets 24 | kIO80211NetworkLinkUp, // Interface capable of transmitting packets 25 | }; 26 | typedef enum IO80211LinkState IO80211LinkState; 27 | 28 | /*! @defined kIO80211InterfaceClass 29 | @abstract The name of the IO80211Interface class. 30 | */ 31 | #define kIO80211InterfaceClass "IO80211Interface" 32 | 33 | typedef UInt64 IO80211FlowQueueHash; 34 | class RSNSupplicant; 35 | class IOTimerEventSource; 36 | class IOGatedOutputQueue; 37 | class IO80211Controller; 38 | class IO80211Workloop; 39 | class IO80211ScanManager; 40 | class IO80211PeerManager; 41 | class IO80211FlowQueueDatabase; 42 | class IO80211InterfaceMonitor; 43 | class IO80211AssociationJoinSnapshot; 44 | 45 | struct apple80211_debug_command; 46 | struct apple80211_txstats; 47 | struct apple80211_chip_counters_tx; 48 | struct apple80211_chip_error_counters_tx; 49 | struct apple80211_chip_counters_rx; 50 | struct apple80211_ManagementInformationBasedot11_counters; 51 | struct apple80211_leaky_ap_stats; 52 | struct apple80211_leaky_ap_ssid_metrics; 53 | struct apple80211_interface_availability; 54 | struct apple80211_pmk_cache_data; 55 | struct apple80211_ap_cmp_data; 56 | struct TxPacketRequest; 57 | struct AWSRequest; 58 | struct packet_info_tx; 59 | struct userPrintCtx; 60 | 61 | typedef int apple80211_postMessage_tlv_types; 62 | 63 | class IO80211Interface : public IOEthernetInterface 64 | { 65 | OSDeclareDefaultStructors( IO80211Interface ); 66 | 67 | public: 68 | virtual bool terminate(unsigned int) override; 69 | virtual bool attach(IOService*) override; 70 | virtual void detach(IOService*) override; 71 | virtual bool init(IONetworkController*) override; 72 | virtual IOReturn updateReport(IOReportChannelList *,uint,void *,void *) override; 73 | virtual IOReturn configureReport(IOReportChannelList *,uint,void *,void *) override; 74 | virtual UInt32 inputPacket(mbuf_t packet, 75 | UInt32 length = 0, 76 | IOOptionBits options = 0, 77 | void * param = 0) override; 78 | virtual bool inputEvent(unsigned int, void*) override; 79 | virtual IOReturn newUserClient(task_t, void*, UInt32 type, OSDictionary*, IOUserClient**) override; 80 | virtual SInt32 performCommand(IONetworkController*, unsigned long, void*, void*) override; 81 | virtual IOReturn attachToDataLinkLayer(IOOptionBits, void*) override; 82 | virtual void detachFromDataLinkLayer(unsigned int, void*) override; 83 | virtual int errnoFromReturn(int) override; 84 | virtual const char* stringFromReturn(int) override; 85 | 86 | virtual void setPoweredOnByUser(bool); 87 | virtual void setEnabledBySystem(bool); 88 | 89 | virtual bool setLinkState(IO80211LinkState, unsigned int); 90 | virtual bool setLinkState(IO80211LinkState, int, unsigned int); 91 | virtual UInt32 outputPacket(mbuf_t, void*); 92 | 93 | virtual bool setLinkQualityMetric(int); 94 | virtual void handleDebugCmd(apple80211_debug_command*); 95 | OSMetaClassDeclareReservedUnused( IO80211Interface, 0); 96 | OSMetaClassDeclareReservedUnused( IO80211Interface, 1); 97 | OSMetaClassDeclareReservedUnused( IO80211Interface, 2); 98 | OSMetaClassDeclareReservedUnused( IO80211Interface, 3); 99 | OSMetaClassDeclareReservedUnused( IO80211Interface, 4); 100 | OSMetaClassDeclareReservedUnused( IO80211Interface, 5); 101 | OSMetaClassDeclareReservedUnused( IO80211Interface, 6); 102 | OSMetaClassDeclareReservedUnused( IO80211Interface, 7); 103 | OSMetaClassDeclareReservedUnused( IO80211Interface, 8); 104 | OSMetaClassDeclareReservedUnused( IO80211Interface, 9); 105 | OSMetaClassDeclareReservedUnused( IO80211Interface, 10); 106 | OSMetaClassDeclareReservedUnused( IO80211Interface, 11); 107 | OSMetaClassDeclareReservedUnused( IO80211Interface, 12); 108 | OSMetaClassDeclareReservedUnused( IO80211Interface, 13); 109 | OSMetaClassDeclareReservedUnused( IO80211Interface, 14); 110 | OSMetaClassDeclareReservedUnused( IO80211Interface, 15); 111 | public: 112 | IO80211FlowQueue * findOrCreateFlowQueue(IO80211FlowQueueHash); 113 | void dropTxPacket(mbuf_t); 114 | void logDebug(unsigned long long, char const*, ...); 115 | void vlogDebug(unsigned long long, char const*, va_list); 116 | const char * getBSDName(); 117 | bool setLeakyAPStatsMode(unsigned int); 118 | void stopOutputQueues(); 119 | void startOutputQueues(); 120 | bool updateLinkSpeed(); 121 | bool reportDataTransferRatesStatic(void*); 122 | void logDebug(char const*, ...); 123 | void postMessage(unsigned int, void* data = NULL, unsigned long dataLen = 0); 124 | protected: 125 | u_int8_t dat[0x500]; 126 | }; 127 | 128 | #endif /* defined(KERNEL) && defined(__cplusplus) */ 129 | 130 | #endif /* ! _IO80211INTERFACE_H */ 131 | 132 | -------------------------------------------------------------------------------- /Black80211/apple80211/catalina/IO80211SkywalkInterface.h: -------------------------------------------------------------------------------- 1 | // 2 | // IO80211SkywalkInterface.h 3 | // AppleIntelWifiAdapter 4 | // 5 | // Created by 钟先耀 on 2019/10/18. 6 | // Copyright © 2019 钟先耀. All rights reserved. 7 | // 8 | 9 | #ifndef IO80211SkywalkInterface_h 10 | #define IO80211SkywalkInterface_h 11 | 12 | #include "IOSkywalkEthernetInterface.h" 13 | 14 | class IO80211SkywalkInterface : IOSkywalkEthernetInterface { 15 | OSDeclareAbstractStructors(IO80211SkywalkInterface) 16 | 17 | public: 18 | 19 | }; 20 | 21 | #endif /* IO80211SkywalkInterface_h */ 22 | -------------------------------------------------------------------------------- /Black80211/apple80211/catalina/IO80211WorkLoop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IO80211WorkLoop.h 3 | * Family 4 | * 5 | * Created by Pete on 5/31/06. 6 | * Copyright 2006 Apple Computer, Inc. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef _IO80211WORKLOOP_H 11 | #define _IO80211WORKLOOP_H 12 | #include 13 | 14 | class IO80211WorkLoop : public IOWorkLoop 15 | { 16 | OSDeclareDefaultStructors( IO80211WorkLoop ) 17 | 18 | public: 19 | 20 | static IO80211WorkLoop * workLoop(); 21 | 22 | virtual void openGate() override; 23 | virtual void closeGate() override; 24 | virtual int sleepGate( void * event, UInt32 interuptibleType ) override; 25 | virtual int sleepGateDeadline( void * event, UInt32 interuptibleType, AbsoluteTime deadline ); 26 | virtual void wakeupGate( void * event, bool oneThread ) override; 27 | 28 | }; 29 | #endif 30 | -------------------------------------------------------------------------------- /Black80211/apple80211/catalina/IOSkywalkEthernetInterface.h: -------------------------------------------------------------------------------- 1 | // 2 | // IOSkywalkEthernetInterface.h 3 | // AppleIntelWifiAdapter 4 | // 5 | // Created by 钟先耀 on 2019/10/18. 6 | // Copyright © 2019 钟先耀. All rights reserved. 7 | // 8 | 9 | #ifndef IOSkywalkEthernetInterface_h 10 | #define IOSkywalkEthernetInterface_h 11 | 12 | #include 13 | 14 | class IOSkywalkEthernetInterface : public IOEthernetController { 15 | OSDeclareAbstractStructors( IOSkywalkEthernetInterface ) 16 | 17 | public: 18 | 19 | }; 20 | 21 | #endif /* IOSkywalkEthernetInterface_h */ 22 | -------------------------------------------------------------------------------- /Black80211/apple80211/catalina/apple80211_ioctl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * The contents of this file constitute Original Code as defined in and 7 | * are subject to the Apple Public Source License Version 1.1 (the 8 | * "License"). You may not use this file except in compliance with the 9 | * License. Please obtain a copy of the License at 10 | * http://www.apple.com/publicsource and read it before using this file. 11 | * 12 | * This Original Code and all software distributed under the License are 13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER 14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the 17 | * License for the specific language governing rights and limitations 18 | * under the License. 19 | * 20 | * @APPLE_LICENSE_HEADER_END@ 21 | */ 22 | #ifndef _APPLE80211_IOCTL_H_ 23 | #define _APPLE80211_IOCTL_H_ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "apple80211_var.h" 32 | 33 | struct apple80211req 34 | { 35 | char req_if_name[IFNAMSIZ]; // 16 bytes 36 | int req_type; // 4 bytes 37 | int req_val; // 4 bytes 38 | u_int32_t req_len; // 4 bytes 39 | void *req_data; // 4 bytes 40 | }; 41 | 42 | #define SIOCSA80211 2150656456 43 | #define SIOCGA80211 3224398281 44 | 45 | // req_type 46 | 47 | 48 | #define APPLE80211_IOC_SSID 1 // req_type 49 | 50 | #define APPLE80211_IOC_AUTH_TYPE 2 // req_type 51 | #define APPLE80211_AUTH_TYPE_UNICAST 1 // req_val, SIOCGA80211 only 52 | #define APPLE80211_AUTH_TYPE_MULTICAST 2 // req_val, SIOCGA80211 only 53 | 54 | #define APPLE80211_IOC_CIPHER_KEY 3 // req_type 55 | #define APPLE80211_CIPHER_KEY_UNICAST 1 // req_val 56 | #define APPLE80211_CIPHER_KEY_MULICAST 2 // req_val 57 | 58 | #define APPLE80211_IOC_CHANNEL 4 // req_type 59 | 60 | #define APPLE80211_IOC_POWERSAVE 5 // req_type 61 | 62 | #define APPLE80211_IOC_PROTMODE 6 // req_type 63 | 64 | #define APPLE80211_IOC_TXPOWER 7 // req_type 65 | #define APPLE80211_IOC_RATE 8 // req_type 66 | #define APPLE80211_IOC_BSSID 9 // req_type 67 | 68 | #define APPLE80211_IOC_SCAN_REQ 10 // req_type 69 | 70 | #define APPLE80211_IOC_SCAN_RESULT 11 // req_type 71 | 72 | #define APPLE80211_IOC_CARD_CAPABILITIES 12 // req_type 73 | 74 | #define APPLE80211_IOC_STATE 13 // req_type (apple80211_state) 75 | #define APPLE80211_IOC_PHY_MODE 14 // req_type (apple80211_phymode) 76 | 77 | #define APPLE80211_IOC_OP_MODE 15 // req_type (apple80211_opmode) 78 | #define APPLE80211_IOC_RSSI 16 // req_type 79 | #define APPLE80211_IOC_NOISE 17 // req_type 80 | 81 | #define APPLE80211_IOC_INT_MIT 18 82 | #define APPLE80211_IOC_INT_MIT_OFF 1 // req_val 83 | #define APPLE80211_IOC_INT_MIT_ON 2 // req_val 84 | 85 | // card power 86 | #define APPLE80211_IOC_POWER 19 // req_type 87 | 88 | #define APPLE80211_IOC_ASSOCIATE 20 // req_type 89 | #define APPLE80211_IOC_ASSOCIATE_RESULT 21 // req_type 90 | #define APPLE80211_IOC_DISASSOCIATE 22 // req_type 91 | #define APPLE80211_IOC_STATUS_DEV_NAME 23 // req_type 92 | 93 | #define APPLE80211_IOC_IBSS_MODE 24 // req_type 94 | #define APPLE80211_IOC_IBSS_MODE_START 1 // req_val 95 | #define APPLE80211_IOC_IBSS_MODE_STOP 2 // req_val 96 | 97 | #define APPLE80211_IOC_HOST_AP_MODE 25 // req_type 98 | #define APPLE80211_IOC_HOST_AP_MODE_START 1 // req_val 99 | #define APPLE80211_IOC_HOST_AP_MODE_STOP 2 // req_val 100 | 101 | #define APPLE80211_IOC_AP_MODE 26 // req_type (apple80211_apmode) 102 | #define APPLE80211_IOC_SUPPORTED_CHANNELS 27 // req_type 103 | #define APPLE80211_IOC_LOCALE 28 // req_type 104 | #define APPLE80211_IOC_DEAUTH 29 // req_type 105 | #define APPLE80211_IOC_COUNTERMEASURES 30 // req_type 106 | #define APPLE80211_IOC_FRAG_THRESHOLD 31 // req_type 107 | #define APPLE80211_IOC_RATE_SET 32 // req_type 108 | #define APPLE80211_IOC_SHORT_SLOT 33 // req_type 109 | #define APPLE80211_IOC_MULTICAST_RATE 34 // req_type 110 | #define APPLE80211_IOC_SHORT_RETRY_LIMIT 35 // req_type 111 | #define APPLE80211_IOC_LONG_RETRY_LIMIT 36 // req_type 112 | #define APPLE80211_IOC_TX_ANTENNA 37 // req_type 113 | #define APPLE80211_IOC_RX_ANTENNA 38 // req_type 114 | #define APPLE80211_IOC_ANTENNA_DIVERSITY 39 // req_type 115 | #define APPLE80211_IOC_ROM 40 // req_type 116 | #define APPLE80211_IOC_DTIM_INT 41 // req_type 117 | #define APPLE80211_IOC_STATION_LIST 42 // req_type 118 | #define APPLE80211_IOC_DRIVER_VERSION 43 // req_type 119 | #define APPLE80211_IOC_HARDWARE_VERSION 44 // req_type 120 | #define APPLE80211_IOC_RAND 45 // req_type 121 | #define APPLE80211_IOC_RSN_IE 46 // req_type 122 | #define APPLE80211_IOC_BACKGROUND_SCAN 47 // req_type 123 | #define APPLE80211_IOC_AP_IE_LIST 48 // req_type 124 | #define APPLE80211_IOC_STATS 49 // req_type 125 | #define APPLE80211_IOC_ASSOCIATION_STATUS 50 // req_type 126 | #define APPLE80211_IOC_COUNTRY_CODE 51 // req_type 127 | #define APPLE80211_IOC_DEBUG_FLAGS 52 // req_type 128 | #define APPLE80211_IOC_LAST_RX_PKT_DATA 53 // req_type 129 | #define APPLE80211_IOC_RADIO_INFO 54 // req_type 130 | #define APPLE80211_IOC_GUARD_INTERVAL 55 // req_type 131 | #define APPLE80211_IOC_MIMO_POWERSAVE 56 // req_type 132 | #define APPLE80211_IOC_MCS 57 // req_type 133 | #define APPLE80211_IOC_RIFS 58 // req_type 134 | #define APPLE80211_IOC_LDPC 59 // req_type 135 | #define APPLE80211_IOC_MSDU 60 // req_type 136 | #define APPLE80211_IOC_MPDU 61 // req_type 137 | #define APPLE80211_IOC_BLOCK_ACK 62 // req_type 138 | #define APPLE80211_IOC_PLS 63 // req_type 139 | #define APPLE80211_IOC_PSMP 64 // req_type 140 | #define APPLE80211_IOC_PHY_SUB_MODE 65 // req_type 141 | #define APPLE80211_IOC_MCS_INDEX_SET 66 // req_type 142 | #define APPLE80211_IOC_CACHE_THRESH_BCAST 67 // req_type 143 | #define APPLE80211_IOC_CACHE_THRESH_DIRECT 68 // req_type 144 | #define APPLE80211_IOC_WOW_PARAMETERS 69 // req_type 145 | #define APPLE80211_IOC_WOW_ENABLED 70 // req_type 146 | #define APPLE80211_IOC_40MHZ_INTOLERANT 71 // req_type 147 | 148 | #define APPLE80211_IOC_PID_LOCK 72 149 | #define APPLE80211_IOC_STA_IE_LIST 73 150 | #define APPLE80211_IOC_STA_AUTHORIZE 74 151 | #define APPLE80211_IOC_STA_DISASSOCIATE 75 152 | #define APPLE80211_IOC_STA_DEAUTH 76 153 | #define APPLE80211_IOC_RSN_CONF 77 154 | #define APPLE80211_IOC_KEY_RSC 78 155 | #define APPLE80211_IOC_STA_STATS 79 156 | #define APPLE80211_IOC_ROAM_THRESH 80 157 | #define APPLE80211_IOC_VENDOR_DBG_FLAGS 81 158 | #define APPLE80211_IOC_CACHE_AGE_THRESH 82 159 | #define APPLE80211_IOC_PMK_CACHE 83 160 | #define APPLE80211_IOC_LINK_QUAL_EVENT_PARAMS 84 161 | #define APPLE80211_IOC_IE 85 162 | #define APPLE80211_IOC_SCAN_REQ_MULTIPLE 86 163 | #define APPLE80211_IOC_BTCOEX_MODE 87 164 | #define APPLE80211_IOC_WOW_TEST 88 165 | #define APPLE80211_IOC_CLEAR_PMK_CACHE 89 166 | #define APPLE80211_IOC_SCANCACHE_CLEAR 90 167 | #define APPLE80211_IOC_P2P_ENABLE 91 168 | #define APPLE80211_IOC_P2P_LISTEN 92 169 | #define APPLE80211_IOC_P2P_SCAN 93 170 | #define APPLE80211_IOC_VIRTUAL_IF_CREATE 94 171 | #define APPLE80211_IOC_VIRTUAL_IF_DELETE 95 172 | #define APPLE80211_IOC_VIRTUAL_IF_ROLE 96 173 | #define APPLE80211_IOC_VIRTUAL_IF_PARENT 97 174 | #define APPLE80211_IOC_P2P_GO_CONF 98 175 | #define APPLE80211_IOC_P2P_NOA_LIST 99 176 | #define APPLE80211_IOC_P2P_OPP_PS 100 177 | #define APPLE80211_IOC_P2P_CT_WINDOW 101 178 | #define APPLE80211_IOC_BT_COEX_FLAGS 102 179 | #define APPLE80211_IOC_CURRENT_NETWORK 103 180 | #define APPLE80211_IOC_BT_POWER 104 181 | #define APPLE80211_IOC_AVAILABILITY 105 182 | #define APPLE80211_IOC_RSSI_BOUNDS 106 183 | #define APPLE80211_IOC_ROAM 107 184 | #define APPLE80211_IOC_TX_CHAIN_POWER 108 185 | #define APPLE80211_IOC_CDD_MODE 109 186 | #define APPLE80211_IOC_LAST_BCAST_SCAN_TIME 110 187 | #define APPLE80211_IOC_THERMAL_THROTTLING 111 188 | #define APPLE80211_IOC_FACTORY_MODE 112 189 | #define APPLE80211_IOC_REASSOCIATE 113 190 | 191 | #define APPLE80211_IOC_POWER_DEBUG_INFO 115 192 | #define APPLE80211_IOC_AWDL_SYNC_PARAMS 116 193 | #define APPLE80211_IOC_AWDL_SYNC_ENABLED 117 194 | #define APPLE80211_IOC_AWDL_EXTENSION_STATE_MACHINE_PARAMETERS 118 195 | #define APPLE80211_IOC_AWDL_SERVICE_PARAMS 119 196 | #define APPLE80211_IOC_AWDL_PEER_SERVICE_REQUEST 120 197 | #define APPLE80211_IOC_AWDL_ELECTION_ALGORITHM_ENABLED 121 198 | #define APPLE80211_IOC_AWDL_ELECTION_ID 122 199 | #define APPLE80211_IOC_AWDL_MAX_TREE_DEPTH 123 200 | #define APPLE80211_IOC_AWDL_GUARD_TIME 124 201 | #define APPLE80211_IOC_AWDL_BSSID 125 202 | #define APPLE80211_IOC_AWDL_ELECTION_METRIC 126 203 | #define APPLE80211_IOC_AWDL_AVAILABILITY_WINDOW_AP_ALIGNMENT 127 204 | #define APPLE80211_IOC_AWDL_SYNC_FRAME_AP_BEACON_ALIGNMENT 128 205 | #define APPLE80211_IOC_AWDL_SYNCHRONIZATION_CHANNEL_SEQUENCE 129 206 | #define APPLE80211_IOC_PEER_CACHE_MAXIMUM_SIZE 130 207 | #define APPLE80211_IOC_AWDL_OUI 131 208 | #define APPLE80211_IOC_AWDL_MASTER_CHANNEL 132 209 | #define APPLE80211_IOC_AWDL_TOP_MASTER 133 210 | #define APPLE80211_IOC_AWDL_SYNC_STATE 134 211 | #define APPLE80211_IOC_AWDL_ELECTION_RSSI_THRESHOLDS 135 212 | #define APPLE80211_IOC_AWDL_PRESENCE_MODE 136 213 | #define APPLE80211_IOC_AWDL_ELECTION_MASTER_COUNTS 137 214 | #define APPLE80211_IOC_AWDL_PERIODIC_SYNC_FRAME_PACKET_LIFETIME 138 215 | #define APPLE80211_IOC_AWDL_MASTER_MODE_SYNC_FRAME_PERIOD 139 216 | #define APPLE80211_IOC_AWDL_NON_ELECTION_MASTER_MODE_SYNC_FRAME_PERIOD 140 217 | #define APPLE80211_IOC_AWDL_EXPLICIT_AVAILABILITY_WINDOW_EXTENSION_OPT_OUT 141 218 | #define APPLE80211_IOC_AWDL_GET_AWDL_MASTER_DATABASE 142 219 | #define APPLE80211_IOC_PEER_CACHE_CONTROL 143 220 | #define APPLE80211_IOC_AWDL_BATTERY_LEVEL 144 221 | #define APPLE80211_IOC_AWDL_BT_COEX_AW_PROTECTED_PERIOD_LENGTH 145 222 | #define APPLE80211_IOC_AWDL_BT_COEX_AGREEMENT 146 223 | #define APPLE80211_IOC_AWDL_BT_COEX_AGREEMENT_ENABLED 147 224 | #define APPLE80211_IOC_AWDL_STRATEGY 148 225 | #define APPLE80211_IOC_AWDL_OOB_REQUEST 149 226 | #define APPLE80211_IOC_AWDL_MAX_NO_MASTER_PERIODS 150 227 | #define APPLE80211_IOC_AWDL_SYNC_FRAME_TEMPLATE 151 228 | #define APPLE80211_IOC_LOG_FLAGS 152 229 | #define APPLE80211_IOC_PEER_STATS 153 230 | #define APPLE80211_IOC_HT_CAPABILITY 154 231 | #define APPLE80211_IOC_AWDL_ELECTION_PARAMS 155 232 | #define APPLE80211_IOC_LINK_CHANGED_EVENT_DATA 156 233 | #define APPLE80211_IOC_GET_DEBUG_INFO 157 234 | #define APPLE80211_IOC_AWDL_DEVICE_CAPABILITIES 158 235 | #define APPLE80211_IOC_AWDL_RSSI_MEASUREMENT_REQUEST 159 236 | #define APPLE80211_IOC_AWDL_AES_KEY 160 237 | #define APPLE80211_IOC_AWDL_SCAN_RESERVED_TIME 161 238 | #define APPLE80211_IOC_AWDL_CTL 162 239 | #define APPLE80211_IOC_AWDL_SOCIAL_TIME_SLOTS 163 240 | #define APPLE80211_IOC_AWDL_PEER_TRAFFIC_REGISTRATION 164 241 | #define APPLE80211_IOC_EXTENDED_STATS 165 242 | #define APPLE80211_IOC_BEACON_PERIOD 166 243 | #define APPLE80211_IOC_AWDL_FORCED_ROAM_CONFIG 167 244 | #define APPLE80211_IOC_AWDL_QUIET 168 245 | #define APPLE80211_IOC_ACL_POLICY 169 246 | #define APPLE80211_IOC_ACL_ADD 170 247 | #define APPLE80211_IOC_ACL_REMOVE 171 248 | #define APPLE80211_IOC_ACL_FLUSH 172 249 | #define APPLE80211_IOC_ACL_LIST 173 250 | #define APPLE80211_IOC_CHAIN_ACK 174 251 | #define APPLE80211_IOC_DESENSE 175 252 | #define APPLE80211_IOC_OFFLOAD_SCANNING 176 253 | #define APPLE80211_IOC_OFFLOAD_RSN 177 254 | #define APPLE80211_IOC_OFFLOAD_COUNTRY_CODE 178 255 | #define APPLE80211_IOC_OFFLOAD_KEEPALIVE_L2 179 256 | #define APPLE80211_IOC_OFFLOAD_ARP_NDP 180 257 | #define APPLE80211_IOC_VHT_MCS_INDEX_SET 181 258 | #define APPLE80211_IOC_DWDS 182 259 | #define APPLE80211_IOC_INTERRUPT_STATS 183 260 | #define APPLE80211_IOC_INTERRUPT_STATS_RESET 184 261 | #define APPLE80211_IOC_TIMER_STATS 185 262 | #define APPLE80211_IOC_TIMER_STATS_RESET 186 263 | #define APPLE80211_IOC_OFFLOAD_STATS 187 264 | #define APPLE80211_IOC_OFFLOAD_STATS_RESET 188 265 | #define APPLE80211_IOC_OFFLOAD_BEACONS 189 266 | #define APPLE80211_IOC_ROAMING 190 267 | #define APPLE80211_IOC_OFFLOAD_ARP 191 268 | #define APPLE80211_IOC_OFFLOAD_NDP 192 269 | #define APPLE80211_IOC_OFFLOAD_SCAN 193 270 | #define APPLE80211_IOC_DESENSE_LEVEL 194 271 | #define APPLE80211_IOC_MCS_VHT 195 272 | #define APPLE80211_IOC_TX_NSS 196 273 | #define APPLE80211_IOC_GAS_REQ 197 274 | #define APPLE80211_IOC_GAS_START 198 275 | #define APPLE80211_IOC_GAS_SET_PEER 199 276 | #define APPLE80211_IOC_GAS_RESULTS 200 277 | #define APPLE80211_IOC_AWDL_BTLE_PEER_INDICATION 201 278 | #define APPLE80211_IOC_AWDL_BTLE_STATE_PARAMS 202 279 | #define APPLE80211_IOC_AWDL_PEER_DATABASE 203 280 | #define APPLE80211_IOC_AWDL_BTLE_ENABLE_SYNC_WITH_PARAMS 204 281 | #define APPLE80211_IOC_AWDL_SECONDARY_MASTER_CHANNEL 205 282 | #define APPLE80211_IOC_PHY_STATS 206 283 | #define APPLE80211_IOC_CHANNELS_INFO 207 284 | #define APPLE80211_IOC_AWDL_AF_TX_MODE 208 285 | #define APPLE80211_IOC_ERROR_STRING 209 286 | #define APPLE80211_IOC_ERROR_NO 210 287 | #define APPLE80211_IOC_AWDL_PIGGYBACK_SCAN_REQ 211 288 | #define APPLE80211_IOC_AWDL_PRIVATE_ELECTION_ID 212 289 | #define APPLE80211_IOC_AWDL_MIN_RATE 213 290 | #define APPLE80211_IOC_VHT_CAPABILITY 214 291 | #define APPLE80211_IOC_BGSCAN_CACHE_RESULTS 215 292 | #define APPLE80211_IOC_ROAM_PROFILE 216 293 | #define APPLE80211_IOC_AWDL_OPER_MODE 217 294 | #define APPLE80211_IOC_RESTORE_DEFAULTS 218 295 | #define APPLE80211_IOC_AWDL_ENCRYPTION_KEYS 219 296 | #define APPLE80211_IOC_AWDL_ENCRYPTION_TYPE 220 297 | #define APPLE80211_IOC_BTCOEX_PROFILES 221 298 | #define APPLE80211_IOC_BTCOEX_CONFIG 222 299 | #define APPLE80211_IOC_AWDL_STATISTICS 223 300 | #define APPLE80211_IOC_AWDL_ENABLE_ROAMING 224 301 | #define APPLE80211_IOC_AWDL_OOB_AUTO_REQUEST 225 302 | #define APPLE80211_IOC_AWDL_TXCAL_PERIOD 226 303 | #define APPLE80211_IOC_CHIP_COUNTER_STATS 227 304 | #define APPLE80211_IOC_DBG_GUARD_TIME_PARAMS 228 305 | #define APPLE80211_IOC_AWDL_AWDL_ADVERTISERS 229 306 | #define APPLE80211_IOC_LEAKY_AP_STATS_MODE 230 307 | #define APPLE80211_IOC_CAPTURE 231 308 | #define APPLE80211_IOC_LEAKY_AP_STATS 232 309 | #define APPLE80211_IOC_AWDL_BLOCK_SET_COMMANDS 233 310 | #define APPLE80211_IOC_LEAKY_AP_AWD_MODE 234 311 | #define APPLE80211_IOC_BTCOEX_OPTIONS 235 312 | #define APPLE80211_IOC_FORCE_SYNC_TO_PEER 236 313 | #define APPLE80211_IOC_COUNTRY_CHANNELS 237 314 | #define APPLE80211_IOC_PRIVATE_MAC 238 315 | #define APPLE80211_IOC_RESET_CHIP 239 316 | #define APPLE80211_IOC_CRASH 240 317 | #define APPLE80211_IOC_RANGING_ENABLE 241 318 | #define APPLE80211_IOC_RANGING_START 242 319 | #define APPLE80211_IOC_RANGING_AUTHENTICATE 243 320 | #define APPLE80211_IOC_AWDL_PREFERRED_CHANNELS 244 321 | #define APPLE80211_IOC_LEAKY_AP_SSID_STATS 245 322 | #define APPLE80211_IOC_AWDL_RSDB_CAPS 246 323 | #define APPLE80211_IOC_AWDL_DEV_STATS 247 324 | #define APPLE80211_IOC_LAST_ASSOC_HISTORY 248 325 | #define APPLE80211_IOC_AWDL_COMMON_CHANNEL 249 326 | #define APPLE80211_IOC_AWDL_PEERS_INFO 250 327 | #define APPLE80211_IOC_TKO_PARAMS 251 328 | #define APPLE80211_IOC_TKO_DUMP 252 329 | #define APPLE80211_IOC_AWDL_NEARBY_LOG_TRIGGER 253 330 | #define APPLE80211_IOC_HW_SUPPORTED_CHANNELS 254 331 | #define APPLE80211_IOC_BTCOEX_PROFILE 255 332 | #define APPLE80211_IOC_BTCOEX_PROFILE_ACTIVE 256 333 | #define APPLE80211_IOC_TRAP_INFO 257 334 | #define APPLE80211_IOC_THERMAL_INDEX 258 335 | #define APPLE80211_IOC_MAX_NSS_FOR_AP 259 336 | #define APPLE80211_IOC_BTCOEX_2G_CHAIN_DISABLE 260 337 | #define APPLE80211_IOC_POWER_BUDGET 261 338 | #define APPLE80211_IOC_AWDL_DFSP_CONFIG 262 339 | #define APPLE80211_IOC_AWDL_DFSP_UCSA_CONFIG 263 340 | #define APPLE80211_IOC_SCAN_BACKOFF_REPORT 264 341 | #define APPLE80211_IOC_OFFLOAD_TCPKA_ENABLE 265 342 | #define APPLE80211_IOC_RANGING_CAPS 266 343 | #define APPLE80211_IOC_PER_CORE_RSSI_REPORT 267 344 | #define APPLE80211_IOC_NSS 353 345 | 346 | #define APPLE80211_IOC_CARD_SPECIFIC 0xffffffff // req_type 347 | 348 | // Kernel interface 349 | 350 | // Bump this value when structures change 351 | #define APPLE80211_VERSION 1 352 | 353 | struct apple80211_ssid_data 354 | { 355 | u_int32_t version; 356 | u_int32_t ssid_len; 357 | u_int8_t ssid_bytes[APPLE80211_MAX_SSID_LEN]; 358 | }; 359 | 360 | struct apple80211_channel_data 361 | { 362 | u_int32_t version; 363 | struct apple80211_channel channel; 364 | }; 365 | 366 | struct apple80211_bssid_data 367 | { 368 | u_int32_t version; 369 | struct ether_addr bssid; 370 | }; 371 | 372 | struct apple80211_capability_data 373 | { 374 | u_int32_t version; 375 | u_int8_t capabilities[APPLE80211_MAP_SIZE( APPLE80211_CAP_MAX + 1 )]; 376 | }; 377 | 378 | struct apple80211_state_data 379 | { 380 | u_int32_t version; 381 | u_int32_t state; 382 | }; 383 | 384 | struct apple80211_rssi_data 385 | { 386 | u_int32_t version; 387 | u_int32_t num_radios; 388 | u_int32_t rssi_unit; 389 | int32_t rssi[APPLE80211_MAX_RADIO]; // control channel 390 | int32_t aggregate_rssi; // aggregate control channel rssi 391 | int32_t rssi_ext[APPLE80211_MAX_RADIO]; // extension channel rssi 392 | int32_t aggregate_rssi_ext; // aggregate extension channel rssi 393 | }; 394 | 395 | struct apple80211_power_data 396 | { 397 | u_int32_t version; 398 | u_int32_t num_radios; 399 | u_int32_t power_state[APPLE80211_MAX_RADIO]; 400 | }; 401 | 402 | struct apple80211_assoc_result_data 403 | { 404 | u_int32_t version; 405 | u_int32_t result; 406 | }; 407 | 408 | struct apple80211_assoc_status_data 409 | { 410 | u_int32_t version; 411 | u_int32_t status; 412 | }; 413 | 414 | struct apple80211_rate_data 415 | { 416 | u_int32_t version; 417 | u_int32_t num_radios; 418 | u_int32_t rate[APPLE80211_MAX_RADIO]; 419 | }; 420 | 421 | struct apple80211_status_dev_data 422 | { 423 | u_int32_t version; 424 | u_int8_t dev_name[MAXPATHLEN]; 425 | }; 426 | 427 | struct apple80211_powersave_data 428 | { 429 | u_int32_t version; 430 | u_int32_t powersave_level; 431 | }; 432 | 433 | struct apple80211_protmode_data 434 | { 435 | u_int32_t version; 436 | u_int32_t protmode; 437 | u_int32_t threshold; // bytes 438 | }; 439 | 440 | struct apple80211_txpower_data 441 | { 442 | u_int32_t version; 443 | u_int32_t txpower_unit; 444 | int32_t txpower; 445 | }; 446 | 447 | struct apple80211_phymode_data 448 | { 449 | u_int32_t version; 450 | u_int32_t phy_mode; // vector of supported phy modes 451 | u_int32_t active_phy_mode; // current active phy mode 452 | }; 453 | 454 | struct apple80211_opmode_data 455 | { 456 | u_int32_t version; 457 | u_int32_t op_mode; 458 | }; 459 | 460 | struct apple80211_noise_data 461 | { 462 | u_int32_t version; 463 | u_int32_t num_radios; 464 | u_int32_t noise_unit; 465 | int32_t noise[APPLE80211_MAX_RADIO]; // control channel 466 | int32_t aggregate_noise; // aggregate control channel noise 467 | int32_t noise_ext[APPLE80211_MAX_RADIO]; // extension channel noise 468 | int32_t aggregate_noise_ext; // aggregate extension channel noise 469 | }; 470 | 471 | struct apple80211_intmit_data 472 | { 473 | u_int32_t version; 474 | u_int32_t int_mit; 475 | }; 476 | 477 | struct apple80211_authtype_data 478 | { 479 | u_int32_t version; 480 | u_int32_t authtype_lower; // apple80211_authtype_lower 481 | u_int32_t authtype_upper; // apple80211_authtype_upper 482 | }; 483 | 484 | struct apple80211_sup_channel_data 485 | { 486 | u_int32_t version; 487 | u_int32_t num_channels; 488 | struct apple80211_channel supported_channels[APPLE80211_MAX_CHANNELS]; 489 | }; 490 | 491 | 492 | struct apple80211_roam_threshold_data 493 | { 494 | u_int32_t threshold; 495 | u_int32_t count; 496 | }; 497 | 498 | struct apple80211_locale_data 499 | { 500 | u_int32_t version; 501 | u_int32_t locale; 502 | }; 503 | 504 | struct apple80211_scan_data 505 | { 506 | u_int32_t version; 507 | u_int32_t bss_type; // apple80211_apmode 508 | struct ether_addr bssid; // target BSSID 509 | u_int32_t ssid_len; // length of the SSID 510 | u_int8_t ssid[APPLE80211_MAX_SSID_LEN]; 511 | u_int32_t scan_type; // apple80211_scan_type 512 | u_int32_t phy_mode; // apple80211_phymode vector 513 | u_int16_t dwell_time; // time to spend on each channel (ms) 514 | u_int32_t rest_time; // time between scanning each channel (ms) 515 | u_int32_t num_channels; // 0 if not passing in channels 516 | struct apple80211_channel channels[APPLE80211_MAX_CHANNELS]; // channel list 517 | }; 518 | 519 | struct apple80211_scan_multiple_data 520 | { 521 | uint32_t version; 522 | uint32_t ap_mode; // apple80211_apmode 523 | uint32_t ssid_count; 524 | apple80211_ssid_data ssids[16]; 525 | uint32_t bssid_count; 526 | ether_addr bssids[16]; 527 | uint32_t scan_type; 528 | uint32_t phy_mode; 529 | uint32_t dwell_time; 530 | uint32_t rest_time; 531 | uint32_t num_channels; 532 | struct apple80211_channel channels[128]; 533 | uint16_t unk_2; 534 | }; 535 | 536 | struct apple80211_link_changed_event_data 537 | { 538 | bool isLinkDown; // 0 539 | uint32_t rssi; // 4 540 | uint16_t snr; // 8 541 | uint16_t nf; // 10 542 | char cca; // 12 543 | bool voluntary; // 16 544 | uint32_t reason; // 20 545 | }; 546 | 547 | struct apple80211_apmode_data 548 | { 549 | u_int32_t version; 550 | u_int32_t apmode; 551 | }; 552 | 553 | struct apple80211_assoc_data 554 | { 555 | u_int32_t version; 556 | u_int16_t ad_mode; // apple80211_apmode 557 | u_int16_t ad_auth_lower; // apple80211_authtype_lower 558 | u_int16_t ad_auth_upper; // apple80211_authtype_upper 559 | u_int32_t ad_ssid_len; 560 | u_int8_t ad_ssid[ APPLE80211_MAX_SSID_LEN ]; 561 | struct ether_addr ad_bssid; // prefer over ssid if not zeroed 562 | struct apple80211_key ad_key; 563 | u_int8_t unknown[82]; 564 | u_int8_t ad_rsn_ie[ APPLE80211_MAX_RSN_IE_LEN ]; 565 | u_int32_t ad_flags; // apple80211_assoc_flags 566 | }; 567 | 568 | static_assert(offsetof(apple80211_assoc_data, ad_rsn_ie) == 206, "offsetof(apple80211_assoc_data, ad_rsn_ie)"); 569 | 570 | struct apple80211_deauth_data 571 | { 572 | u_int32_t version; 573 | u_int32_t deauth_reason; // reason code 574 | struct ether_addr deauth_ea; // BSSID of AP 575 | }; 576 | 577 | struct apple80211_countermeasures_data 578 | { 579 | u_int32_t version; 580 | u_int32_t enabled; 581 | }; 582 | 583 | struct apple80211_frag_threshold_data 584 | { 585 | u_int32_t version; 586 | u_int32_t threshold; // bytes 587 | }; 588 | 589 | struct apple80211_rate_set_data 590 | { 591 | u_int32_t version; 592 | u_int16_t num_rates; 593 | struct apple80211_rate rates[APPLE80211_MAX_RATES]; 594 | }; 595 | 596 | struct apple80211_short_slot_data 597 | { 598 | u_int32_t version; 599 | u_int8_t mode; 600 | }; 601 | 602 | struct apple80211_retry_limit_data 603 | { 604 | u_int32_t version; 605 | u_int32_t limit; 606 | }; 607 | 608 | struct apple80211_antenna_data 609 | { 610 | u_int32_t version; 611 | u_int32_t num_radios; 612 | int32_t antenna_index[APPLE80211_MAX_RADIO]; 613 | }; 614 | 615 | struct apple80211_dtim_int_data 616 | { 617 | u_int32_t version; 618 | u_int32_t interval; 619 | }; 620 | 621 | struct apple80211_sta_data 622 | { 623 | u_int32_t version; 624 | u_int32_t num_stations; 625 | struct apple80211_station station_list[APPLE80211_MAX_STATIONS]; 626 | }; 627 | 628 | struct apple80211_version_data 629 | { 630 | u_int32_t version; 631 | u_int16_t string_len; 632 | char string[APPLE80211_MAX_VERSION_LEN]; 633 | }; 634 | 635 | struct apple80211_rom_data 636 | { 637 | u_int32_t version; 638 | u_int32_t rom_len; 639 | u_int8_t rom[1]; // variable length 640 | }; 641 | 642 | struct apple80211_rand_data 643 | { 644 | u_int32_t version; 645 | u_int32_t rand; 646 | }; 647 | 648 | struct apple80211_rsn_ie_data 649 | { 650 | u_int32_t version; 651 | u_int16_t len; 652 | u_int8_t ie[ APPLE80211_MAX_RSN_IE_LEN ]; 653 | }; 654 | 655 | struct apple80211_ap_ie_data 656 | { 657 | u_int32_t version; 658 | u_int32_t len; 659 | u_int8_t *ie_data; 660 | }; 661 | 662 | struct apple80211_stats_data 663 | { 664 | u_int32_t version; 665 | u_int32_t tx_frame_count; 666 | u_int32_t tx_errors; 667 | u_int32_t rx_frame_count; 668 | u_int32_t rx_errors; 669 | }; 670 | 671 | struct apple80211_country_code_data 672 | { 673 | u_int32_t version; 674 | u_int8_t cc[APPLE80211_MAX_CC_LEN]; 675 | }; 676 | 677 | struct apple80211_last_rx_pkt_data 678 | { 679 | u_int32_t version; 680 | u_int32_t rate; 681 | int32_t rssi; 682 | u_int32_t num_streams; // number of spatial streams 683 | struct ether_addr sa; // source address 684 | }; 685 | 686 | struct apple80211_radio_info_data 687 | { 688 | u_int32_t version; 689 | u_int32_t count; // number of rf chains 690 | }; 691 | 692 | struct apple80211_guard_interval_data 693 | { 694 | u_int32_t version; 695 | u_int32_t interval; // apple80211_guard_interval 696 | }; 697 | 698 | struct apple80211_mcs_data 699 | { 700 | u_int32_t version; 701 | u_int32_t index; // 0 to APPLE80211_MAX_MCS_INDEX 702 | }; 703 | 704 | struct apple80211_rifs_data 705 | { 706 | u_int32_t version; 707 | u_int32_t enabled; 708 | }; 709 | 710 | struct apple80211_ldpc_data 711 | { 712 | u_int32_t version; 713 | u_int32_t enabled; 714 | }; 715 | 716 | struct apple80211_msdu_data 717 | { 718 | u_int32_t version; 719 | u_int32_t max_length; // 3839 or 7935 bytes 720 | }; 721 | 722 | struct apple80211_mpdu_data 723 | { 724 | u_int32_t version; 725 | u_int32_t max_factor; // 0 - APPLE80211_MAX_MPDU_FACTOR 726 | u_int32_t max_density; // 0 - APPLE80211_MAX_MPDU_DENSITY 727 | }; 728 | 729 | struct apple80211_block_ack_data 730 | { 731 | u_int32_t version; 732 | u_int8_t ba_enabled; // block ack enabled 733 | u_int8_t immediate_ba_enabled; // immediate block ack enabled 734 | u_int8_t cbba_enabled; // compressed bitmap block ack enabled 735 | u_int8_t implicit_ba_enabled; // implicit block ack enabled 736 | }; 737 | 738 | struct apple80211_pls_data 739 | { 740 | u_int32_t version; 741 | u_int32_t enabled; // phy level spoofing enabled 742 | }; 743 | 744 | struct apple80211_psmp_data 745 | { 746 | u_int32_t version; 747 | u_int32_t enabled; 748 | }; 749 | 750 | struct apple80211_physubmode_data 751 | { 752 | u_int32_t version; 753 | u_int32_t phy_mode; // one apple80211_phymode 754 | u_int32_t phy_submode; // one apple80211_physubmode 755 | u_int32_t flags; // apple80211_channel_flag vector 756 | }; 757 | 758 | struct apple80211_mcs_index_set_data 759 | { 760 | u_int32_t version; 761 | u_int8_t mcs_set_map[APPLE80211_MAP_SIZE( APPLE80211_MAX_MCS_INDEX + 1 )]; 762 | }; 763 | 764 | struct apple80211_wow_parameter_data 765 | { 766 | u_int32_t version; 767 | u_int8_t wake_cond_map[APPLE80211_MAP_SIZE( APPLE80211_MAX_WAKE_COND + 1 )]; 768 | u_int32_t beacon_loss_time; 769 | u_int32_t pattern_count; 770 | struct apple80211_wow_pattern patterns[APPLE80211_MAX_WOW_PATTERNS]; 771 | }; 772 | 773 | struct apple80211_40mhz_intolerant_data 774 | { 775 | u_int32_t version; 776 | u_int32_t enabled; // bit enabled or not 777 | }; 778 | 779 | struct apple80211_nss_data 780 | { 781 | u_int32_t version; 782 | u_int32_t nss; 783 | }; 784 | 785 | #endif // _APPLE80211_IOCTL_H_ 786 | 787 | -------------------------------------------------------------------------------- /Black80211/apple80211/catalina/apple80211_var.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * The contents of this file constitute Original Code as defined in and 7 | * are subject to the Apple Public Source License Version 1.1 (the 8 | * "License"). You may not use this file except in compliance with the 9 | * License. Please obtain a copy of the License at 10 | * http://www.apple.com/publicsource and read it before using this file. 11 | * 12 | * This Original Code and all software distributed under the License are 13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER 14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the 17 | * License for the specific language governing rights and limitations 18 | * under the License. 19 | * 20 | * @APPLE_LICENSE_HEADER_END@ 21 | */ 22 | 23 | #ifndef _APPLE80211_VAR_H_ 24 | #define _APPLE80211_VAR_H_ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | // Sizes and limits 31 | #define APPLE80211_ADDR_LEN 6 32 | #define APPLE80211_MAX_RATES 15 33 | #define APPLE80211_MAX_SSID_LEN 32 34 | #define APPLE80211_MAX_ANTENNAE 4 35 | #define APPLE80211_MAX_RADIO 4 36 | #define APPLE80211_MAX_CHANNELS 64 37 | #define APPLE80211_MAX_STATIONS 128 38 | #define APPLE80211_MAX_VERSION_LEN 256 39 | #define APPLE80211_MAX_ROM_SIZE 32768 // 32 KB 40 | #define APPLE80211_MAX_RSN_IE_LEN 257 // 255 + type and length bytes 41 | #define APPLE80211_MAX_CC_LEN 3 42 | #define APPLE80211_MAX_MCS_INDEX 76 43 | #define APPLE80211_MAX_MPDU_FACTOR 3 44 | #define APPLE80211_MAX_MPDU_DENSITY 7 45 | #define APPLE80211_MAX_WOW_PAT_LEN 1500 // Max wake on wireless pattern length 46 | #define APPLE80211_MAX_WOW_PATTERNS 12 // Arbitrary..this can change 47 | 48 | #define APPLE80211_MAP_SIZE( _bits ) (roundup( _bits, NBBY )/NBBY) 49 | 50 | enum apple80211_phymode { 51 | APPLE80211_MODE_UNKNOWN = 0, 52 | APPLE80211_MODE_AUTO = 0x1, // autoselect 53 | APPLE80211_MODE_11A = 0x2, // 5GHz, OFDM 54 | APPLE80211_MODE_11B = 0x4, // 2GHz, CCK 55 | APPLE80211_MODE_11G = 0x8, // 2GHz, OFDM 56 | APPLE80211_MODE_11N = 0x10, // 2GHz/5GHz, OFDM 57 | APPLE80211_MODE_TURBO_A = 0x20, // 5GHz, OFDM, 2x clock 58 | APPLE80211_MODE_TURBO_G = 0x40, // 2GHz, OFDM, 2x clock 59 | APPLE80211_MODE_11AC = 0x80, 60 | }; 61 | 62 | enum apple80211_physubmode { 63 | APPLE80211_SUBMODE_UNKNOWN = 0x0, 64 | APPLE80211_SUBMODE_11N_AUTO = 0x1, // 11n mode determined by AP capabilities 65 | APPLE80211_SUBMODE_11N_LEGACY = 0x2, // legacy 66 | APPLE80211_SUBMODE_11N_LEGACY_DUP = 0x4, // legacy duplicate 67 | APPLE80211_SUBMODE_11N_HT = 0x8, // high throughput 68 | APPLE80211_SUBMODE_11N_HT_DUP = 0x10, // high throughput duplicate 69 | APPLE80211_SUBMODE_11N_GF = 0x20, // green field 70 | }; 71 | 72 | // flags 73 | enum apple80211_opmode { 74 | APPLE80211_M_NONE = 0x0, 75 | APPLE80211_M_STA = 0x1, // infrastructure station 76 | APPLE80211_M_IBSS = 0x2, // IBSS (adhoc) station 77 | APPLE80211_M_AHDEMO = 0x4, // Old lucent compatible adhoc demo 78 | APPLE80211_M_HOSTAP = 0x8, // Software Access Point 79 | APPLE80211_M_MONITOR = 0x10 // Monitor mode 80 | }; 81 | 82 | enum apple80211_apmode { 83 | APPLE80211_AP_MODE_UNKNOWN = 0, 84 | APPLE80211_AP_MODE_IBSS = 1, // IBSS (adhoc) station 85 | APPLE80211_AP_MODE_INFRA = 2, // Access Point 86 | APPLE80211_AP_MODE_ANY = 3, // Any supported mode 87 | }; 88 | 89 | // states are the same as in itlwm 90 | enum apple80211_state { 91 | APPLE80211_S_INIT = 0, // default state 92 | APPLE80211_S_SCAN = 1, // scanning 93 | APPLE80211_S_AUTH = 2, // try to authenticate 94 | APPLE80211_S_ASSOC = 3, // try to assoc 95 | APPLE80211_S_RUN = 4, // associated 96 | }; 97 | 98 | enum apple80211_protmode { 99 | APPLE80211_PROTMODE_OFF = 0, // no protection 100 | APPLE80211_PROTMODE_AUTO = 1, // auto 101 | APPLE80211_PROTMODE_CTS = 2, // CTS to self 102 | APPLE80211_PROTMODE_RTSCTS = 3, // RTS-CTS 103 | APPLE80211_PROTMODE_DUAL_CTS = 4, // dual CTS 104 | }; 105 | 106 | enum apple80211_cipher_type { 107 | APPLE80211_CIPHER_NONE = 0, // open network 108 | APPLE80211_CIPHER_WEP_40 = 1, // 40 bit WEP 109 | APPLE80211_CIPHER_WEP_104 = 2, // 104 bit WEP 110 | APPLE80211_CIPHER_TKIP = 3, // TKIP (WPA) 111 | APPLE80211_CIPHER_AES_OCB = 4, // AES (OCB) 112 | APPLE80211_CIPHER_AES_CCM = 5, // AES (CCM) 113 | APPLE80211_CIPHER_PMK = 6, // PMK 114 | APPLE80211_CIPHER_PMKSA = 7, // PMK obtained from pre-authentication 115 | }; 116 | 117 | enum apple80211_cipher_key_type 118 | { 119 | APPLE80211_CIPHER_KEY_TYPE_UNICAST = 0, // unicast cipher key 120 | APPLE80211_CIPHER_KEY_TYPE_MULTICAST = 1 // multicast cipher key 121 | }; 122 | 123 | // Low level 802.11 authentication types 124 | 125 | enum apple80211_authtype_lower 126 | { 127 | APPLE80211_AUTHTYPE_OPEN = 1, // open 128 | APPLE80211_AUTHTYPE_SHARED = 2, // shared key 129 | APPLE80211_AUTHTYPE_CISCO = 3, // cisco net eap 130 | }; 131 | 132 | // Higher level authentication used after 802.11 association complete 133 | 134 | enum apple80211_authtype_upper 135 | { 136 | APPLE80211_AUTHTYPE_NONE = 0, // No upper auth 137 | APPLE80211_AUTHTYPE_WPA = 1 << 0, // WPA 138 | APPLE80211_AUTHTYPE_WPA_PSK = 1 << 1, // WPA PSK 139 | APPLE80211_AUTHTYPE_WPA2 = 1 << 2, // WPA2 140 | APPLE80211_AUTHTYPE_WPA2_PSK = 1 << 3, // WPA2 PSK 141 | APPLE80211_AUTHTYPE_LEAP = 1 << 4, // LEAP 142 | APPLE80211_AUTHTYPE_8021X = 1 << 5, // 802.1x 143 | APPLE80211_AUTHTYPE_WPS = 1 << 6, // WiFi Protected Setup 144 | APPLE80211_AUTHTYPE_SHA256_PSK = 1 << 7, 145 | APPLE80211_AUTHTYPE_SHA256_8021X = 1 << 8, 146 | APPLE80211_AUTHTYPE_WPA3_SAE = 1 << 9 147 | }; 148 | 149 | // Unify association status code and deauth reason codes into a single enum describing 150 | // common error conditions 151 | enum apple80211_associate_result 152 | { 153 | APPLE80211_RESULT_UNAVAILABLE = 0, // No association/authentication result ready 154 | APPLE80211_RESULT_SUCCESS = 1, // APPLE80211_STATUS_SUCCESS and no deauth 155 | APPLE80211_RESULT_UNSPECIFIED_FAILURE = 2, // APPLE80211_STATUS_UNSPECIFIED_FAILURE 156 | APPLE80211_RESULT_UNSUPPORTED_CAPAPBILITIES = 3, // APPLE80211_STATUS_UNSUPPORTED_CAPABILITIES 157 | APPLE80211_RESULT_REASSOCIATION_DENIED = 4, // APPLE80211_STATUS_REASSOCIATION_DENIED 158 | APPLE80211_RESULT_ASSOCIATION_DENIED = 5, // APPLE80211_STATUS_ASSOCIATION_DENIED 159 | APPLE80211_RESULT_AUTH_ALG_UNSUPPORTED = 6, // APPLE80211_STATUS_AUTH_ALG_UNSUPPORTED 160 | APPLE80211_RESULT_INVALID_AUTH_SEQ_NUM = 7, // APPLE80211_STATUS_INVALID_AUTH_SEQ_NUM 161 | APPLE80211_RESULT_CHALLENGE_FAILURE = 8, // APPLE80211_STATUS_CHALLENGE_FAILURE 162 | APPLE80211_RESULT_TIMEOUT = 9, // APPLE80211_STATUS_TIMEOUT 163 | APPLE80211_RESULT_AP_FULL = 10, // APPLE80211_STATUS_AP_FULL 164 | APPLE80211_RESULT_UNSUPPORTED_RATE_SET = 11, // APPLE80211_STATUS_UNSUPPORTED_RATE_SET 165 | APPLE80211_RESULT_SHORT_SLOT_UNSUPPORTED = 12, // APPLE80211_STATUS_SHORT_SLOT_UNSUPPORTED 166 | APPLE80211_RESULT_DSSS_OFDM_UNSUPPORTED = 13, // APPLE80211_STATUS_DSSS_OFDM_UNSUPPORTED 167 | APPLE80211_RESULT_INVALID_IE = 14, // APPLE80211_STATUS_INVALID_IE 168 | APPLE80211_RESULT_INVALID_GROUP_CIPHER = 15, // APPLE80211_STATUS_INVALID_GROUP_CIPHER 169 | APPLE80211_RESULT_INVALID_PAIRWISE_CIPHER = 16, // APPLE80211_STATUS_INVALID_PAIRWISE_CIPHER 170 | APPLE80211_RESULT_INVALID_AKMP = 17, // APPLE80211_STATUS_INVALID_AKMP 171 | APPLE80211_RESULT_UNSUPPORTED_RSN_VERSION = 18, // APPLE80211_STATUS_UNSUPPORTED_RSN_VERSION 172 | APPLE80211_RESULT_INVALID_RSN_CAPABILITIES = 19, // APPLE80211_STATUS_INVALID_RSN_CAPABILITIES 173 | APPLE80211_RESULT_CIPHER_SUITE_REJECTED = 20, // APPLE80211_STATUS_CIPHER_SUIT_REJECTED 174 | APPLE80211_RESULT_INVALID_PMK = 21, // APPLE80211_REASON_PREV_AUTH_EXPIRED received 175 | APPLE80211_RESULT_SUPPLICANT_TIMEOUT = 22, // RSNSupplicant did not finish handshake 176 | APPLE80211_RESULT_UNKNOWN = 0xffff // Unrecognized error condition 177 | }; 178 | 179 | enum apple80211_link_down_reason 180 | { 181 | APPLE80211_LINK_DOWN_REASON_INTERNAL_ERROR = 0, 182 | APPLE80211_LINK_DOWN_REASON_BEACONLOST = 1, 183 | APPLE80211_LINK_DOWN_REASON_DEAUTH = 2, 184 | APPLE80211_LINK_DOWN_REASON_INTERNAL_ERROR_2 = 3 185 | }; 186 | 187 | enum apple80211_unit 188 | { 189 | APPLE80211_UNIT_DBM = 0, // dBm 190 | APPLE80211_UNIT_MW = 1, // milliwatts 191 | APPLE80211_UNIT_PERCENT = 2, // value expressed as a percentage 192 | }; 193 | 194 | enum apple80211_power_state 195 | { 196 | APPLE80211_POWER_OFF = 0, // Chain disabled 197 | APPLE80211_POWER_ON = 1, // Chain powered on for tx and rx 198 | APPLE80211_POWER_TX = 2, // Chain powered on for tx only 199 | APPLE80211_POWER_RX = 3, // Chain powered on for rx only 200 | }; 201 | 202 | enum apple80211_locale 203 | { 204 | APPLE80211_LOCALE_UNKNOWN = 0, 205 | APPLE80211_LOCALE_FCC = 1, 206 | APPLE80211_LOCALE_ETSI = 2, 207 | APPLE80211_LOCALE_JAPAN = 3, 208 | APPLE80211_LOCALE_KOREA = 4, 209 | APPLE80211_LOCALE_APAC = 5, 210 | APPLE80211_LOCALE_ROW = 6, 211 | APPLE80211_LOCALE_INDONESIA = 7 212 | }; 213 | 214 | enum apple80211_scan_type 215 | { 216 | APPLE80211_SCAN_TYPE_NONE = 0, 217 | APPLE80211_SCAN_TYPE_ACTIVE = 1, 218 | APPLE80211_SCAN_TYPE_PASSIVE = 2, 219 | APPLE80211_SCAN_TYPE_FAST = 3, // Ok to return cached scan results 220 | APPLE80211_SCAN_TYPE_BACKGROUND = 4, // Initiate background scanning 221 | }; 222 | 223 | enum apple80211_int_mit { 224 | APPLE80211_INT_MIT_OFF = 0, 225 | APPLE80211_INT_MIT_AUTO = 1, 226 | }; 227 | 228 | enum apple80211_channel_flag 229 | { 230 | APPLE80211_C_FLAG_NONE = 0x0, // no flags 231 | APPLE80211_C_FLAG_10MHZ = 0x1, // 10 MHz wide 232 | APPLE80211_C_FLAG_20MHZ = 0x2, // 20 MHz wide 233 | APPLE80211_C_FLAG_40MHZ = 0x4, // 40 MHz wide 234 | APPLE80211_C_FLAG_2GHZ = 0x8, // 2.4 GHz 235 | APPLE80211_C_FLAG_5GHZ = 0x10, // 5 GHz 236 | APPLE80211_C_FLAG_IBSS = 0x20, // IBSS supported 237 | APPLE80211_C_FLAG_HOST_AP = 0x40, // HOST AP mode supported 238 | APPLE80211_C_FLAG_ACTIVE = 0x80, // active scanning supported 239 | APPLE80211_C_FLAG_DFS = 0x100, // DFS required 240 | APPLE80211_C_FLAG_EXT_ABV = 0x200, // If 40 Mhz, extension channel above. 241 | // If this flag is not set, then the 242 | // extension channel is below. 243 | APPLE80211_C_FLAG_80MHZ = 0x400 // name made up - set if channelWidth == 80 && 5ghz && AC 244 | }; 245 | 246 | enum apple80211_rate_flag 247 | { 248 | APPLE80211_RATE_FLAG_NONE = 0x0, // no flags 249 | APPLE80211_RATE_FLAG_BASIC = 0x1, // basic rate 250 | APPLE80211_RATE_FLAG_HT = 0x2, // HT rate computed from MCS index 251 | }; 252 | 253 | enum apple80211_short_slot_mode 254 | { 255 | APPLE80211_SHORT_SLOT_MODE_AUTO = 1, // Default behavior 256 | APPLE80211_SHORT_SLOT_MODE_LONG = 2, // long - short slot timing mode 257 | APPLE80211_SHORT_SLOT_MODE_SHORT = 3, // short - short slot timing mode 258 | }; 259 | 260 | enum apple80211_powersave_mode 261 | { 262 | // Standard modes 263 | APPLE80211_POWERSAVE_MODE_DISABLED = 0, 264 | APPLE80211_POWERSAVE_MODE_80211 = 1, 265 | APPLE80211_POWERSAVE_MODE_VENDOR = 2, // Vendor specific mode, there should be 266 | // more general apple modes in the future. 267 | // Vendor modes also likely require more info. 268 | // Mimo modes 269 | APPLE80211_POWERSAVE_MODE_MIMO_STATIC = 3, 270 | APPLE80211_POWERSAVE_MODE_MIMO_DYNAMIC = 4, 271 | APPLE80211_POWERSAVE_MODE_MIMO_MIMO = 5, 272 | 273 | // WOW 274 | APPLE80211_POWERSAVE_MODE_WOW = 6, 275 | 276 | // Vendor specific powersave mode, throughput is maximized 277 | APPLE80211_POWERSAVE_MODE_MAX_THROUGHPUT = 7, 278 | 279 | // Vendor specific powersave mode, power savings are maximized, possibly 280 | // at the expense of throughput/latency. 281 | APPLE80211_POWERSAVE_MODE_MAX_POWERSAVE = 8, 282 | }; 283 | 284 | enum apple80211_debug_flag 285 | { 286 | APPLE80211_DEBUG_FLAG_NONE = 0x0, // No logging 287 | APPLE80211_DEBUG_FLAG_INFORMATIVE = 0x1, // Log "interesting" events 288 | APPLE80211_DEBUG_FLAG_ERROR = 0x2, // Log errors 289 | APPLE80211_DEBUG_FLAG_RSN = 0x4, // Full RSN supplicant logging 290 | APPLE80211_DEBUG_FLAG_SCAN = 0x8, // Scan events and information 291 | }; 292 | 293 | enum apple80211_guard_interval 294 | { 295 | APPLE80211_GI_SHORT = 400, // ns 296 | APPLE80211_GI_LONG = 800, // ns 297 | }; 298 | 299 | #define APPLE80211_RSC_LEN 8 300 | #define APPLE80211_KEY_BUFF_LEN 32 301 | 302 | #define APPLE80211_KEY_FLAG_UNICAST 0x1 303 | #define APPLE80211_KEY_FLAG_MULTICAST 0x2 304 | #define APPLE80211_KEY_FLAG_TX 0x4 305 | #define APPLE80211_KEY_FLAG_RX 0x8 306 | 307 | struct apple80211_key 308 | { 309 | u_int32_t version; 310 | u_int32_t key_len; 311 | u_int32_t key_cipher_type; // apple80211_cipher_type 312 | u_int16_t key_flags; 313 | u_int16_t key_index; 314 | u_int8_t key[ APPLE80211_KEY_BUFF_LEN ]; 315 | u_int32_t key_rsc_len; 316 | u_int8_t key_rsc[ APPLE80211_RSC_LEN ]; // receive sequence counter 317 | struct ether_addr key_ea; // key applies to this bssid 318 | }; 319 | 320 | // Changing this affects any structure that contains a channel 321 | struct apple80211_channel 322 | { 323 | u_int32_t version; 324 | u_int32_t channel; // channel number 325 | u_int32_t flags; // apple80211_channel_flag vector 326 | }; 327 | 328 | struct apple80211_rate 329 | { 330 | u_int32_t version; 331 | u_int32_t rate; // rate mbps 332 | u_int32_t flags; // apple80211_rate_flag vector 333 | }; 334 | 335 | // Probe response capability flags, IEEE 7.3.1.4 336 | #define APPLE80211_CAPINFO_ESS 0x0001 337 | #define APPLE80211_CAPINFO_IBSS 0x0002 338 | #define APPLE80211_CAPINFO_CF_POLLABLE 0x0004 339 | #define APPLE80211_CAPINFO_CF_POLLREQ 0x0008 340 | #define APPLE80211_CAPINFO_PRIVACY 0x0010 341 | #define APPLE80211_CAPINFO_SHORT_PREAMBLE 0x0020 342 | #define APPLE80211_CAPINFO_PBCC 0x0040 343 | #define APPLE80211_CAPINFO_AGILITY 0x0080 344 | // 0x0100, 0x0200 reserved 345 | #define APPLE80211_CAPINFO_SHORT_SLOT_TIME 0x0400 346 | // 0x0800, 0x1000 reserved 347 | #define APPLE80211_CAPINFO_DSSS_OFDM 0x2000 348 | // 0x4000, 0x8000 reserved 349 | 350 | // Reason codes IEEE 7.3.1.7 351 | #define APPLE80211_REASON_UNSPECIFIED 1 352 | #define APPLE80211_REASON_PREV_AUTH_EXPIRED 2 353 | #define APPLE80211_REASON_AUTH_LEAVING 3 354 | #define APPLE80211_REASON_INACTIVE 4 355 | #define APPLE80211_REASON_AP_OVERLOAD 5 356 | #define APPLE80211_REASON_NOT_AUTHED 6 357 | #define APPLE80211_REASON_NOT_ASSOCED 7 358 | #define APPLE80211_REASON_ASSOC_LEAVING 8 359 | #define APPLE80211_REASON_ASSOC_NOT_AUTHED 9 360 | #define APPLE80211_REASON_POWER_CAP 10 361 | #define APPLE80211_REASON_SUPPORTED_CHANS 11 362 | 363 | #define APPLE80211_REASON_INVALID_IE 13 364 | #define APPLE80211_REASON_MIC_FAILURE 14 365 | #define APPLE80211_REASON_4_WAY_TIMEOUT 15 366 | #define APPLE80211_REASON_GROUP_KEY_TIMEOUT 16 367 | #define APPLE80211_REASON_DIFF_IE 17 368 | #define APPLE80211_REASON_INVALID_GROUP_KEY 18 369 | #define APPLE80211_REASON_INVALID_PAIR_KEY 19 370 | #define APPLE80211_REASON_INVALID_AKMP 20 371 | #define APPLE80211_REASON_UNSUPP_RSN_VER 21 372 | #define APPLE80211_REASON_INVALID_RSN_CAPS 22 373 | #define APPLE80211_REASON_8021X_AUTH_FAILED 23 374 | 375 | // Status codes IEEE 7.3.1.9 376 | #define APPLE80211_STATUS_SUCCESS 0 377 | #define APPLE80211_STATUS_UNSPECIFIED_FAILURE 1 378 | // 2-9 reserved 379 | #define APPLE80211_STATUS_UNSUPPORTED_CAPABILITIES 10 380 | #define APPLE80211_STATUS_REASSOCIATION_DENIED 11 381 | #define APPLE80211_STATUS_ASSOCIATION_DENIED 12 382 | #define APPLE80211_STATUS_AUTH_ALG_UNSUPPORTED 13 383 | #define APPLE80211_STATUS_INVALID_AUTH_SEQ_NUM 14 384 | #define APPLE80211_STATUS_CHALLENGE_FAILURE 15 385 | #define APPLE80211_STATUS_TIMEOUT 16 386 | #define APPLE80211_STATUS_AP_FULL 17 387 | #define APPLE80211_STATUS_UNSUPPORTED_RATE_SET 18 388 | // 22-24 reserved 389 | #define APPLE80211_STATUS_SHORT_SLOT_UNSUPPORTED 25 390 | #define APPLE80211_STATUS_DSSS_OFDM_UNSUPPORTED 26 391 | // 27-39 reserved 392 | #define APPLE80211_STATUS_INVALID_IE 40 393 | #define APPLE80211_STATUS_INVALID_GROUP_CIPHER 41 394 | #define APPLE80211_STATUS_INVALID_PAIRWISE_CIPHER 42 395 | #define APPLE80211_STATUS_INVALID_AKMP 43 396 | #define APPLE80211_STATUS_UNSUPPORTED_RSN_VERSION 44 397 | #define APPLE80211_STATUS_INVALID_RSN_CAPABILITIES 45 398 | #define APPLE80211_STATUS_CIPHER_SUITE_REJECTED 46 399 | // 47 - 65535 reserved 400 | #define APPLE80211_STATUS_UNAVAILABLE 0xffff 401 | 402 | // If mcs index is set to APPLE80211_MCS_INDEX_AUTO, the interface 403 | // should go to auto rate selection, and abandon any previously 404 | // configured static MCS indices 405 | #define APPLE80211_MCS_INDEX_AUTO 0xffffffff 406 | 407 | /* 408 | DSCP TOS/Traffic class values for WME access categories taken from 409 | WiFi WMM Test Plan v 1.3.1 Appendix C. 410 | 411 | TOS/Traffic class field looks like: 412 | 413 | 0 1 2 3 4 5 6 7 414 | +---+---+---+---+---+---+---+---+ 415 | | DSCP | ECN | 416 | +---+---+---+---+---+---+---+---+ 417 | 418 | These bits are numbered according to rfc 2474, but might be misleading. 419 | It looks like bit 0 is actually the high order bit. 420 | */ 421 | 422 | #define APPLE80211_DSCP_WME_BE 0x00 423 | #define APPLE80211_DSCP_WME_BK 0x08 424 | #define APPLE80211_DSCP_WME_VI 0x28 425 | #define APPLE80211_DSCP_WME_VO 0x38 426 | 427 | // Access category values set in the mbuf 428 | #define APPLE80211_WME_AC_BE 0 429 | #define APPLE80211_WME_AC_BK 1 430 | #define APPLE80211_WME_AC_VI 2 431 | #define APPLE80211_WME_AC_VO 3 432 | 433 | // Working within the limitations of the kpi mbuf routines, the receive interface pointer 434 | // is the best place to put this for now since it is not used on the output path. The mbuf 435 | // kpi doesn't allow us to access unused flags, or I would put the WME AC in there like 436 | // everyone else. 437 | 438 | #define APPLE80211_MBUF_SET_WME_AC( m, ac ) mbuf_pkthdr_setrcvif( m, (ifnet_t)ac ) 439 | #define APPLE80211_MBUF_WME_AC( m ) (int)mbuf_pkthdr_rcvif( m ) 440 | 441 | // FIXME: seems that rates array starts at 0x24, immediately after 442 | struct apple80211_scan_result 443 | { 444 | u_int32_t version; // 0x00 - 0x03 445 | apple80211_channel asr_channel; // 0x04 - 0x0f 446 | 447 | int16_t asr_unk; // 0x10 - 0x11 448 | 449 | int16_t asr_noise; // 0x12 - 0x13 450 | int16_t asr_snr; // 0x14 - 0x15 451 | int16_t asr_rssi; // 0x16 - 0x17 452 | int16_t asr_beacon_int; // 0x18 - 0x19 453 | 454 | int16_t asr_cap; // capabilities // 0x1a 0x1b 455 | 456 | u_int8_t asr_bssid[ APPLE80211_ADDR_LEN ]; // 0x1c 0x1d 0x1e 0x1f 0x20 0x21 457 | u_int8_t asr_nrates; // 0x22 458 | u_int8_t asr_nr_unk; // 0x23 459 | u_int32_t asr_rates[ APPLE80211_MAX_RATES ]; // 0x24 - 0x5f 460 | u_int8_t asr_ssid_len; // 0x60 461 | u_int8_t asr_ssid[ APPLE80211_MAX_SSID_LEN ]; // 0x61 - 0x80 462 | __attribute__((packed)) __attribute__((aligned(1))) int16_t unk; 463 | uint8_t unk2; 464 | u_int32_t asr_age; // (ms) non-zero for cached scan result // 0x84 465 | 466 | u_int16_t unk3; 467 | int16_t asr_ie_len; 468 | uint32_t asr_unk3; 469 | void* asr_ie_data; 470 | }; 471 | 472 | 473 | struct apple80211_network_data 474 | { 475 | u_int32_t version; 476 | u_int16_t nd_mode; // apple80211_apmode 477 | u_int16_t nd_auth_lower; // apple80211_authtype_lower 478 | u_int16_t nd_auth_upper; // apple80211_authtype_upper 479 | struct apple80211_channel nd_channel; 480 | u_int32_t nd_ssid_len; 481 | u_int8_t nd_ssid[ APPLE80211_MAX_SSID_LEN ]; 482 | struct apple80211_key nd_key; 483 | u_int32_t nd_ie_len; 484 | void *nd_ie_data; 485 | }; 486 | 487 | #define APPLE80211_NETWORK_DATA_MAX_IE_LEN 1024 488 | 489 | // As hostap support improves, this will grow 490 | struct apple80211_station 491 | { 492 | u_int32_t version; 493 | struct ether_addr sta_mac; 494 | int32_t sta_rssi; 495 | }; 496 | 497 | // WOW structures and defines 498 | 499 | struct apple80211_wow_pattern 500 | { 501 | size_t len; 502 | u_int8_t * pattern; 503 | }; 504 | 505 | enum apple80211_wake_condition 506 | { 507 | APPLE80211_WAKE_COND_MAGIC_PATTERN = 0, 508 | APPLE80211_WAKE_COND_NET_PATTERN = 1, 509 | APPLE80211_WAKE_COND_DISASSOCIATED = 2, 510 | APPLE80211_WAKE_COND_DEAUTHED = 3, 511 | APPLE80211_WAKE_COND_RETROGRADE_TSF = 4, 512 | APPLE80211_WAKE_COND_BEACON_LOSS = 5, 513 | }; 514 | 515 | #define APPLE80211_MAX_WAKE_COND 5 516 | 517 | enum apple80211_card_capability 518 | { 519 | APPLE80211_CAP_WEP = 0, // CAPABILITY: WEP available 520 | APPLE80211_CAP_TKIP = 1, // CAPABILITY: TKIP available 521 | APPLE80211_CAP_AES = 2, // CAPABILITY: AES OCB avail 522 | APPLE80211_CAP_AES_CCM = 3, // CAPABILITY: AES CCM avail 523 | APPLE80211_CAP_CKIP = 4, // CAPABILITY: CKIP available 524 | APPLE80211_CAP_IBSS = 5, // CAPABILITY: IBSS available 525 | APPLE80211_CAP_PMGT = 6, // CAPABILITY: Power mgmt 526 | APPLE80211_CAP_HOSTAP = 7, // CAPABILITY: HOSTAP avail 527 | APPLE80211_CAP_TXPMGT = 8, // CAPABILITY: tx power mgmt 528 | APPLE80211_CAP_SHSLOT = 9, // CAPABILITY: short slottime 529 | APPLE80211_CAP_SHPREAMBLE = 10, // CAPABILITY: short preamble 530 | APPLE80211_CAP_MONITOR = 11, // CAPABILITY: monitor mode 531 | APPLE80211_CAP_TKIPMIC = 12, // CAPABILITY: TKIP MIC avail 532 | APPLE80211_CAP_WPA1 = 13, // CAPABILITY: WPA1 avail 533 | APPLE80211_CAP_WPA2 = 14, // CAPABILITY: WPA2 avail 534 | APPLE80211_CAP_WPA = 15, // CAPABILITY: WPA1+WPA2 avail 535 | APPLE80211_CAP_BURST = 16, // CAPABILITY: frame bursting 536 | APPLE80211_CAP_WME = 17, // CAPABILITY: WME avail 537 | APPLE80211_CAP_SHORT_GI_40MHZ = 18, // CAPABILITY: Short guard interval in 40 MHz 538 | APPLE80211_CAP_SHORT_GI_20MHZ = 19, // CAPABILITY: Short guard interval in 20 MHz 539 | APPLE80211_CAP_WOW = 20, // CAPABILITY: Wake on wireless 540 | APPLE80211_CAP_TSN = 21, // CAPABILITY: WPA with WEP group key 541 | }; 542 | #define APPLE80211_CAP_MAX 63 543 | 544 | enum apple80211_assoc_flags { 545 | APPLE80211_ASSOC_F_CLOSED = 1, // flag: scan was directed, needed to remember closed networks 546 | }; 547 | 548 | // Kernel messages 549 | 550 | struct apple80211_status_msg_hdr 551 | { 552 | u_int32_t msg_type; // type of message 553 | u_int32_t msg_len; // length of data (not including msg_type and msg_len) 554 | 555 | // data follows 556 | }; 557 | 558 | #define APPLE80211_M_MAX_LEN 2048 559 | 560 | #define APPLE80211_M_POWER_CHANGED 1 561 | #define APPLE80211_M_SSID_CHANGED 2 562 | #define APPLE80211_M_BSSID_CHANGED 3 563 | #define APPLE80211_M_LINK_CHANGED 4 564 | #define APPLE80211_M_MIC_ERROR_UCAST 5 565 | #define APPLE80211_M_MIC_ERROR_MCAST 6 566 | #define APPLE80211_M_INT_MIT_CHANGED 7 567 | #define APPLE80211_M_MODE_CHANGED 8 568 | #define APPLE80211_M_ASSOC_DONE 9 569 | #define APPLE80211_M_SCAN_DONE 10 570 | #define APPLE80211_M_COUNTRY_CODE_CHANGED 11 571 | #define APPLE80211_M_STA_ARRIVE 12 572 | #define APPLE80211_M_STA_LEAVE 13 573 | #define APPLE80211_M_DECRYPTION_FAILURE 14 574 | #define APPLE80211_M_SCAN_CACHE_UPDATED 15 575 | #define APPLE80211_M_INTERNAL_SCAN_DONE 16 576 | #define APPLE80211_M_LINK_QUALITY 17 577 | #define APPLE80211_M_IBSS_PEER_ARRIVED 18 578 | #define APPLE80211_M_IBSS_PEER_LEFT 19 579 | #define APPLE80211_M_RSN_HANDSHAKE_DONE 20 580 | #define APPLE80211_M_BT_COEX_CHANGED 21 581 | #define APPLE80211_M_P2P_PEER_DETECTED 22 582 | #define APPLE80211_M_P2P_LISTEN_COMPLETE 23 583 | #define APPLE80211_M_P2P_SCAN_COMPLETE 24 584 | #define APPLE80211_M_P2P_LISTEN_STARTED 25 585 | #define APPLE80211_M_P2P_SCAN_STARTED 26 586 | #define APPLE80211_M_P2P_INTERFACE_CREATED 27 587 | #define APPLE80211_M_P2P_GROUP_STARTED 28 588 | #define APPLE80211_M_BGSCAN_NET_DISCOVERED 29 589 | #define APPLE80211_M_ROAMED 30 590 | #define APPLE80211_M_ACT_FRM_TX_COMPLETE 31 591 | #define APPLE80211_M_DEAUTH_RECEIVED 32 592 | 593 | #define APPLE80211_M_MAX 32 594 | #define APPLE80211_M_BUFF_SIZE APPLE80211_MAP_SIZE( APPLE80211_M_MAX ) 595 | 596 | // Registry Information 597 | #define APPLE80211_REGKEY_HARDWARE_VERSION "IO80211HardwareVersion" 598 | //#define APPLE80211_REG_FIRMWARE_VERSION "IO80211FirmwareVersion" 599 | #define APPLE80211_REGKEY_DRIVER_VERSION "IO80211DriverVersion" 600 | #define APPLE80211_REGKEY_LOCALE "IO80211Locale" 601 | #define APPLE80211_REGKEY_SSID "IO80211SSID" 602 | #define APPLE80211_REGKEY_CHANNEL "IO80211Channel" 603 | #define APPLE80211_REGKEY_EXT_CHANNEL "IO80211ExtensionChannel" 604 | #define APPLE80211_REGKEY_BAND "IO80211Band" 605 | #define APPLE80211_BAND_2GHZ "2 GHz" 606 | #define APPLE80211_BAND_5GHZ "5 GHz" 607 | #define APPLE80211_REGKEY_COUNTRY_CODE "IO80211CountryCode" 608 | 609 | // Userland messages 610 | #define APPLE80211_M_RSN_AUTH_SUCCESS 254 611 | #define APPLE80211_M_RSN_AUTH_SUCCESS_TEMPLATE "com.apple.rsn.%s.auth.success" // string is interface name 612 | 613 | #define APPLE80211_M_RSN_AUTH_TIMEOUT 255 614 | #define APPLE80211_M_RSN_AUTH_TIMEOUT_TEMPLATE "com.apple.rsn.%s.auth.timeout" // string is interface name 615 | 616 | #define APPLE80211_M_RSN_MSG_MAX 2 617 | 618 | #endif // _APPLE80211_VAR_H_ 619 | 620 | -------------------------------------------------------------------------------- /Black80211/apple80211/catalina/apple80211_wps.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wps_eap.h 3 | * Family 4 | * 5 | * Created by Pete on 6/20/06. 6 | * Copyright 2006 Apple Computer, Inc. All rights reserved. 7 | * 8 | */ 9 | 10 | #include 11 | #include 12 | //#include "eap_defs.h" 13 | 14 | #ifndef WPS_EAP_H 15 | #define WPS_EAP_H 16 | 17 | #define WPS_HANDSHAKE_TIMEOUT 120 /* seconds */ 18 | #define WPS_RETRANSMIT_TIMEOUT 5 19 | #define WPS_MAX_RETRIES 3 20 | 21 | #define WPS_IDENTITY_STR "WFA-SimpleConfig-Enrollee-1-0" 22 | #define WPS_IDENTITY_STR_LEN 29 23 | #define WPS_PERSONALIZATION_STRING "Wi-Fi Easy and Secure Key Derivation" 24 | #define WPS_PERSONALIZATION_STRING_LEN ( sizeof( WPS_PERSONALIZATION_STRING ) - 1 ) 25 | #define WPS_KDF_KEY_BITS 640 26 | 27 | #define WPS_DISPLAY_PIN_LEN 8 28 | 29 | #define EAP_TYPE_ID 1 30 | #define WPS_EAP_METHOD_TYPE 254 31 | 32 | #define WPS_VENDOR_ID_BYTES 0x00, 0x37, 0x2A 33 | #define WPS_VENDOR_TYPE 0x00000001 34 | 35 | #define WPS_OP_START 0x01 36 | #define WPS_OP_ACK 0x02 37 | #define WPS_OP_NACK 0x03 38 | #define WPS_OP_MSG 0x04 39 | #define WPS_OP_DONE 0x05 40 | 41 | #define WPS_FLAG_MF 0x01 /* more fragments */ 42 | #define WPS_FLAG_LF 0x02 /* length field in use */ 43 | 44 | #define WPS_MAX_MSG_LEN UINT16_MAX /* max frag len, my limit */ 45 | 46 | #define PACKED __attribute__((packed)) 47 | 48 | struct wps_eap_hdr 49 | { 50 | u_int8_t code; 51 | u_int8_t identifier; 52 | u_int16_t length; 53 | u_int8_t type; 54 | u_int8_t vendor_id[3]; 55 | u_int32_t vendor_type; 56 | u_int8_t op_code; 57 | u_int8_t flags; 58 | u_int16_t msg_length; 59 | // u_int8_t msg[1]; /* data follows */ 60 | }PACKED; 61 | #define WPS_EAP_HDR_LEN( _whdr ) ( ( _whdr->flags & WPS_FLAG_LF ) ? sizeof( struct wps_eap_hdr ) : sizeof( struct wps_eap_hdr ) - sizeof( u_int16_t ) ) 62 | 63 | // Messages elements 64 | 65 | #define BUF_SIZE_64_BITS 8 66 | #define BUF_SIZE_128_BITS 16 67 | #define BUF_SIZE_160_BITS 20 68 | #define BUF_SIZE_256_BITS 32 69 | #define BUF_SIZE_512_BITS 64 70 | #define BUF_SIZE_1024_BITS 128 71 | #define BUF_SIZE_1536_BITS 192 72 | 73 | struct wps_msg_elem_hdr 74 | { 75 | u_int16_t elem_id; 76 | u_int16_t elem_len; 77 | }PACKED; 78 | 79 | #define WPS_ELEM_SET_HEADER( elem, id, len ) (elem)->hdr.elem_id = htons( id ); (elem)->hdr.elem_len = htons( len ) 80 | 81 | struct wps_dev_type 82 | { 83 | u_int16_t category; 84 | u_int8_t oui[4]; 85 | u_int16_t sub_category; 86 | }PACKED; 87 | 88 | #define WIFI_DEV_TYPE_OUI_BYTES 0x00, 0x50, 0xf2, 0x04 89 | 90 | #define DEFINE_WPS_ELEMENT( name, param ) typedef struct { \ 91 | struct wps_msg_elem_hdr hdr; \ 92 | param; \ 93 | }PACKED name 94 | 95 | 96 | #define WPS_VERSION 0x10 97 | DEFINE_WPS_ELEMENT( wps_elem_ap_channel_t, u_int16_t channel ); 98 | DEFINE_WPS_ELEMENT( wps_elem_assoc_state_t, u_int16_t assoc_state ); 99 | DEFINE_WPS_ELEMENT( wps_elem_auth_type_t, u_int16_t auth_type ); 100 | DEFINE_WPS_ELEMENT( wps_elem_auth_type_flags_t, u_int16_t auth_flags ); 101 | #define AUTHENTICATOR_MSG_SIZE ( sizeof( struct wps_msg_elem_hdr ) + 8 ) 102 | DEFINE_WPS_ELEMENT( wps_elem_authenticator_t, u_int8_t authenticator[8] ); 103 | DEFINE_WPS_ELEMENT( wps_elem_config_methods_t, u_int16_t config_methods ); 104 | DEFINE_WPS_ELEMENT( wps_elem_config_error_t, u_int16_t error ); 105 | DEFINE_WPS_ELEMENT( wps_elem_confirm_url4_t, u_int16_t url4[1] ); // <= 64B 106 | DEFINE_WPS_ELEMENT( wps_elem_confirm_url6_t, u_int16_t url6[1] ); // <= 76B 107 | DEFINE_WPS_ELEMENT( wps_elem_conn_type_t, u_int8_t conn_type ); 108 | DEFINE_WPS_ELEMENT( wps_elem_conn_type_flags_t, u_int8_t conn_type_flags ); 109 | DEFINE_WPS_ELEMENT( wps_elem_credential_t, u_int8_t cred[1] ); // <= ??? 110 | DEFINE_WPS_ELEMENT( wps_elem_dev_name_t, u_int8_t dev_name[1] ); // <= 32B 111 | DEFINE_WPS_ELEMENT( wps_elem_dev_pw_id_t, u_int16_t dev_pw_id ); 112 | DEFINE_WPS_ELEMENT( wps_elem_e_hash1_t, u_int8_t e_hash1[BUF_SIZE_256_BITS] ); 113 | DEFINE_WPS_ELEMENT( wps_elem_e_hash2_t, u_int8_t e_hash2[BUF_SIZE_256_BITS] ); 114 | DEFINE_WPS_ELEMENT( wps_elem_e_snonce1_t, u_int8_t e_snonce1[BUF_SIZE_128_BITS] ); 115 | DEFINE_WPS_ELEMENT( wps_elem_e_snonce2_t, u_int8_t e_snonce2[BUF_SIZE_128_BITS] ); 116 | DEFINE_WPS_ELEMENT( wps_elem_ecrypt_settings_t, u_int8_t settings[1] ); // no limit defined 117 | DEFINE_WPS_ELEMENT( wps_elem_encrypt_type_t, u_int16_t encrypt_type ); 118 | DEFINE_WPS_ELEMENT( wps_elem_encrypt_type_flags_t, u_int16_t encrypt_type_flags ); 119 | DEFINE_WPS_ELEMENT( wps_elem_enrl_nonce_t, u_int8_t nonce[BUF_SIZE_128_BITS] ); 120 | DEFINE_WPS_ELEMENT( wps_elem_feature_id_t, u_int32_t feature_id ); 121 | DEFINE_WPS_ELEMENT( wps_elem_identity_t, u_int8_t identity[1] ); // <= 80 122 | // identity proof? 123 | DEFINE_WPS_ELEMENT( wps_elem_iv_t, u_int8_t iv[BUF_SIZE_256_BITS] ); 124 | DEFINE_WPS_ELEMENT( wps_elem_key_wrap_authenticator_t, u_int8_t key_wrap_authenticator[8] ); 125 | DEFINE_WPS_ELEMENT( wps_elem_key_id_t, u_int8_t key_id[16] ); 126 | DEFINE_WPS_ELEMENT( wps_elem_mac_addr_t, u_int8_t mac[ETHER_ADDR_LEN] ); 127 | DEFINE_WPS_ELEMENT( wps_elem_manufacturer_t, u_int8_t manufacturer[1] ); // <= 64 128 | DEFINE_WPS_ELEMENT( wps_elem_msg_type_t, u_int8_t msg_type ); 129 | DEFINE_WPS_ELEMENT( wps_elem_model_name_t, u_int8_t model_name[1] ); // <= 32B 130 | DEFINE_WPS_ELEMENT( wps_elem_model_number_t, u_int8_t model_number[1] ); // <= 32B 131 | DEFINE_WPS_ELEMENT( wps_elem_network_index_t, u_int8_t network_index ); 132 | DEFINE_WPS_ELEMENT( wps_elem_network_key_t, u_int8_t network_key[1] ); // <= 64B 133 | DEFINE_WPS_ELEMENT( wps_elem_network_key_index_t, u_int8_t network_key_index ); 134 | DEFINE_WPS_ELEMENT( wps_elem_new_dev_name_t, u_int8_t new_dev_name[1] ); // <= 32B 135 | DEFINE_WPS_ELEMENT( wps_elem_new_pw_t, u_int8_t new_pw[1] ); // <= 64 136 | // oob device password? 137 | DEFINE_WPS_ELEMENT( wps_elem_os_version_t, u_int32_t os_version ); 138 | DEFINE_WPS_ELEMENT( wps_elem_power_level_t, u_int8_t power_level ); 139 | DEFINE_WPS_ELEMENT( wps_elem_psk_current_t, u_int8_t psk_current ); 140 | DEFINE_WPS_ELEMENT( wps_elem_psk_max_t, u_int8_t psk_max ); 141 | DEFINE_WPS_ELEMENT( wps_elem_public_key_t, u_int8_t key[BUF_SIZE_1536_BITS] ); 142 | DEFINE_WPS_ELEMENT( wps_elem_radio_enabled_t, u_int8_t radio_enabled ); // bool? 143 | DEFINE_WPS_ELEMENT( wps_elem_reboot_t, u_int8_t reboot ); // bool? 144 | DEFINE_WPS_ELEMENT( wps_elem_reg_current_t, u_int8_t reg_current ); 145 | DEFINE_WPS_ELEMENT( wps_elem_reg_established_t, u_int8_t reg_established ); // bool? 146 | DEFINE_WPS_ELEMENT( wps_elem_reg_list_t, u_int8_t reg_list[1] ); // <= 512B 147 | DEFINE_WPS_ELEMENT( wps_elem_reg_max_t, u_int8_t reg_max ); 148 | DEFINE_WPS_ELEMENT( wps_elem_reg_nonce_t, u_int8_t nonce[BUF_SIZE_128_BITS] ); 149 | DEFINE_WPS_ELEMENT( wps_elem_req_type_t, u_int8_t req_type ); 150 | DEFINE_WPS_ELEMENT( wps_elem_resp_type_t, u_int8_t resp_type ); 151 | DEFINE_WPS_ELEMENT( wps_elem_rf_band_t, u_int8_t rf_band ); 152 | DEFINE_WPS_ELEMENT( wps_elem_r_hash1, u_int8_t r_hash1[BUF_SIZE_256_BITS] ); 153 | DEFINE_WPS_ELEMENT( wps_elem_r_hash2, u_int8_t r_hash2[BUF_SIZE_256_BITS] ); 154 | DEFINE_WPS_ELEMENT( wps_elem_r_snonce1, u_int8_t r_snonce1[BUF_SIZE_128_BITS] ); 155 | DEFINE_WPS_ELEMENT( wps_elem_r_snonce2, u_int8_t r_snonce2[BUF_SIZE_128_BITS] ); 156 | DEFINE_WPS_ELEMENT( wps_elem_selected_reg_t, u_int8_t selected_reg ); // bool? 157 | DEFINE_WPS_ELEMENT( wps_elem_serial_number_t, u_int8_t serial_number[1] ); // <= 32B 158 | DEFINE_WPS_ELEMENT( wps_elem_simple_config_state_t, u_int8_t simple_config_state ); 159 | DEFINE_WPS_ELEMENT( wps_elem_ssid_t, u_int8_t ssid[32] ); 160 | DEFINE_WPS_ELEMENT( wps_elem_total_networks_t, u_int8_t total_networks ); 161 | DEFINE_WPS_ELEMENT( wps_elem_uuid_e_t, u_int8_t uuid_e[16] ); 162 | DEFINE_WPS_ELEMENT( wps_elem_uuid_r_t, u_int8_t uuid_r[16] ); 163 | DEFINE_WPS_ELEMENT( wps_elem_vendor_ext_t, u_int8_t vendor_ext[1] ); // <= 1024 164 | DEFINE_WPS_ELEMENT( wps_elem_version_t, u_int8_t version ); // int? 165 | DEFINE_WPS_ELEMENT( wps_elem_x_509_cert_req_t, u_int8_t cert_req[1] ); // limit? 166 | DEFINE_WPS_ELEMENT( wps_elem_x_509_cert_t, u_int8_t cert[1] ); // limit? 167 | DEFINE_WPS_ELEMENT( wps_elem_eap_id_t, u_int8_t eap_id[1] ); // <= 64 168 | DEFINE_WPS_ELEMENT( wps_elem_msg_counter_t, u_int8_t msg_counter[8] ); 169 | DEFINE_WPS_ELEMENT( wps_elem_public_key_hash_t, u_int8_t public_key_hash[BUF_SIZE_160_BITS] ); 170 | DEFINE_WPS_ELEMENT( wps_elem_rekey_key_t, u_int8_t rekey_key[32] ); 171 | DEFINE_WPS_ELEMENT( wps_elem_key_lifetime_t, u_int32_t key_lifetime ); 172 | DEFINE_WPS_ELEMENT( wps_elem_permitted_config_methods_t, u_int16_t permitted_config_methods ); 173 | DEFINE_WPS_ELEMENT( wps_elem_sel_reg_config_methods_t, u_int8_t sel_reg_config_methods ); 174 | DEFINE_WPS_ELEMENT( wps_elem_primary_dev_type_t, struct wps_dev_type prime_dev_type ); 175 | DEFINE_WPS_ELEMENT( wps_elem_secondary_dev_type_list_t, u_int8_t secondary_dev_type_list[1] ); // <= 128B 176 | DEFINE_WPS_ELEMENT( wps_elem_portable_dev_t, u_int8_t portable_dev ); // bool? 177 | DEFINE_WPS_ELEMENT( wps_elem_ap_setup_locked_t, u_int8_t ap_setup_locked ); // bool? 178 | DEFINE_WPS_ELEMENT( wps_elem_app_list_t, u_int8_t app_list[1] ); // <= 512B 179 | DEFINE_WPS_ELEMENT( wps_elem_eap_type_t, u_int8_t eap_type[1] ); // <= 8B 180 | 181 | #define WPS_NEXT_ELEMENT( cast, cur_elm, len ) (cast)( (UInt8 *)(cur_elm) + sizeof( struct wps_msg_elem_hdr ) + ntohs( cur_elm->hdr.elem_len ) ); \ 182 | len+=( sizeof( struct wps_msg_elem_hdr ) + ntohs( cur_elm->hdr.elem_len ) ) 183 | #define WPS_NEXT_ELEMENT_IE( cast, cur_elm, len ) (cast)( (UInt8 *)(cur_elm) + sizeof( struct wps_msg_elem_hdr ) + ntohs( cur_elm->hdr.elem_len ) ); \ 184 | len-=( sizeof( struct wps_msg_elem_hdr ) + ntohs( cur_elm->hdr.elem_len ) ); 185 | #define WPS_ELEMENT_IS( elem, id ) ( ntohs( elem->hdr.elem_id ) == id ) 186 | #define WPS_ELEMENT_LEN_VAR( elem ) ( sizeof( struct wps_msg_elem_hdr ) + ntohs( elem->hdr.elem_len ) ) 187 | #define WPS_ELEMENT_LEN_FIXED( fixed ) ( sizeof( struct wps_msg_elem_hdr ) + sizeof( fixed ) ) 188 | #define WPS_ELEMENT_PARAM_LEN( elem ) ( ntohs( elem->hdr.elem_len ) ) 189 | 190 | // Messages 191 | #define WPS_MBUF_GET_MSG_PTR( m, type ) (type *)( (UInt8 *)mbuf_data( m ) + sizeof( struct ether_header ) + sizeof( struct wps_eap_hdr ) ) 192 | 193 | struct wps_msg_nack 194 | { 195 | wps_elem_version_t version; 196 | wps_elem_msg_type_t msg_type; 197 | wps_elem_enrl_nonce_t enrl_nonce; 198 | wps_elem_reg_nonce_t reg_nonce; 199 | wps_elem_config_error_t error; 200 | }PACKED; 201 | 202 | struct wps_msg_ack 203 | { 204 | wps_elem_version_t version; 205 | wps_elem_msg_type_t msg_type; 206 | wps_elem_enrl_nonce_t enrl_nonce; 207 | wps_elem_reg_nonce_t reg_nonce; 208 | }PACKED; 209 | 210 | struct wps_msg_done 211 | { 212 | wps_elem_version_t version; 213 | wps_elem_msg_type_t msg_type; 214 | }; 215 | 216 | // From RFC 3748 section 4.1 for identity 217 | struct wps_identity_msg 218 | { 219 | u_int8_t code; 220 | u_int8_t id; 221 | u_int16_t length; 222 | u_int8_t type; 223 | // u_int8_t type_data[1]; /* data follows */ 224 | }__attribute__((packed)); 225 | 226 | #define WPS_EAP_TYPE_IDENTITY 1 227 | 228 | // Data Element Definitions 229 | #define WPS_ID_AP_CHANNEL 0x1001 230 | #define WPS_ID_ASSOC_STATE 0x1002 231 | #define WPS_ID_AUTH_TYPE 0x1003 232 | #define WPS_ID_AUTH_TYPE_FLAGS 0x1004 233 | #define WPS_ID_AUTHENTICATOR 0x1005 234 | #define WPS_ID_CONFIG_METHODS 0x1008 235 | #define WPS_ID_CONFIG_ERROR 0x1009 236 | #define WPS_ID_CONF_URL4 0x100A 237 | #define WPS_ID_CONF_URL6 0x100B 238 | #define WPS_ID_CONN_TYPE 0x100C 239 | #define WPS_ID_CONN_TYPE_FLAGS 0x100D 240 | #define WPS_ID_CREDENTIAL 0x100E 241 | #define WPS_ID_DEVICE_NAME 0x1011 242 | #define WPS_ID_DEVICE_PWD_ID 0x1012 243 | #define WPS_ID_E_HASH1 0x1014 244 | #define WPS_ID_E_HASH2 0x1015 245 | #define WPS_ID_E_SNONCE1 0x1016 246 | #define WPS_ID_E_SNONCE2 0x1017 247 | #define WPS_ID_ENCR_SETTINGS 0x1018 248 | #define WPS_ID_ENCR_TYPE 0x100F 249 | #define WPS_ID_ENCR_TYPE_FLAGS 0x1010 250 | #define WPS_ID_ENROLLEE_NONCE 0x101A 251 | #define WPS_ID_FEATURE_ID 0x101B 252 | #define WPS_ID_IDENTITY 0x101C 253 | #define WPS_ID_IDENTITY_PROOF 0x101D 254 | #define WPS_ID_INIT_VECTOR 0x104B //this becomes 0x1060 later 255 | //#define WPS_ID_KEY_WRAP_AUTH WPS_ID_AUTHENTICATOR //this becomes 0x101E later 256 | #define WPS_ID_KEY_WRAP_AUTH 0x101E // HH changed for MS beta 2 testing 257 | #define WPS_ID_KEY_IDENTIFIER 0x101F 258 | #define WPS_ID_MAC_ADDR 0x1020 259 | #define WPS_ID_MANUFACTURER 0x1021 260 | #define WPS_ID_MSG_TYPE 0x1022 261 | #define WPS_ID_MODEL_NAME 0x1023 262 | #define WPS_ID_MODEL_NUMBER 0x1024 263 | #define WPS_ID_NW_INDEX 0x1026 264 | #define WPS_ID_NW_KEY 0x1027 265 | #define WPS_ID_NW_KEY_INDEX 0x1028 266 | #define WPS_ID_NEW_DEVICE_NAME 0x1029 267 | #define WPS_ID_NEW_PWD 0x102A 268 | #define WPS_ID_OOB_DEV_PWD 0x102C 269 | #define WPS_ID_OS_VERSION 0x102D 270 | #define WPS_ID_POWER_LEVEL 0x102F 271 | #define WPS_ID_PSK_CURRENT 0x1030 272 | #define WPS_ID_PSK_MAX 0x1031 273 | #define WPS_ID_PUBLIC_KEY 0x1032 274 | #define WPS_ID_RADIO_ENABLED 0x1033 275 | #define WPS_ID_REBOOT 0x1034 276 | #define WPS_ID_REGISTRAR_CURRENT 0x1035 277 | #define WPS_ID_REGISTRAR_ESTBLSHD 0x1036 278 | #define WPS_ID_REGISTRAR_LIST 0x1037 279 | #define WPS_ID_REGISTRAR_MAX 0x1038 280 | #define WPS_ID_REGISTRAR_NONCE 0x1039 281 | #define WPS_ID_REQ_TYPE 0x103A 282 | #define WPS_ID_RESP_TYPE 0x103B 283 | #define WPS_ID_RF_BAND 0x103C 284 | #define WPS_ID_R_HASH1 0x103D 285 | #define WPS_ID_R_HASH2 0x103E 286 | #define WPS_ID_R_SNONCE1 0x103F 287 | #define WPS_ID_R_SNONCE2 0x1040 288 | #define WPS_ID_SEL_REGISTRAR 0x1041 289 | #define WPS_ID_SERIAL_NUM 0x1042 290 | #define WPS_ID_SC_STATE 0x1044 291 | #define WPS_ID_SSID 0x1045 292 | #define WPS_ID_TOT_NETWORKS 0x1046 293 | #define WPS_ID_UUID_E 0x1047 294 | #define WPS_ID_UUID_R 0x1048 295 | #define WPS_ID_VENDOR_EXT 0x1049 296 | #define WPS_ID_VERSION 0x104A 297 | #define WPS_ID_X509_CERT_REQ 0x104B 298 | #define WPS_ID_X509_CERT 0x104C 299 | #define WPS_ID_EAP_IDENTITY 0x104D 300 | #define WPS_ID_MSG_COUNTER 0x104E 301 | #define WPS_ID_PUBKEY_HASH 0x104F 302 | #define WPS_ID_REKEY_KEY 0x1050 303 | #define WPS_ID_KEY_LIFETIME 0x1051 304 | #define WPS_ID_PERM_CFG_METHODS 0x1052 305 | #define WPS_ID_SEL_REG_CFG_METHODS_ORIGINAL 0x0153 // This was the original val in the spec, we must support both 306 | #define WPS_ID_SEL_REG_CFG_METHODS 0x1053 307 | #define WPS_ID_PRIM_DEV_TYPE 0x1054 308 | #define WPS_ID_SEC_DEV_TYPE_LIST 0x1055 309 | #define WPS_ID_PORTABLE_DEVICE 0x1056 310 | #define WPS_ID_AP_SETUP_LOCKED 0x1057 311 | #define WPS_ID_APP_LIST 0x1058 312 | #define WPS_ID_EAP_TYPE 0x1059 313 | 314 | // Association states 315 | #define WPS_ASSOC_NOT_ASSOCIATED 0 316 | #define WPS_ASSOC_CONN_SUCCESS 1 317 | #define WPS_ASSOC_CONFIG_FAIL 2 318 | #define WPS_ASSOC_ASSOC_FAIL 3 319 | #define WPS_ASSOC_IP_FAIL 4 320 | 321 | // Authentication types 322 | #define WPS_AUTHTYPE_OPEN 0x0001 323 | #define WPS_AUTHTYPE_WPAPSK 0x0002 324 | #define WPS_AUTHTYPE_SHARED 0x0004 325 | #define WPS_AUTHTYPE_WPA 0x0008 326 | #define WPS_AUTHTYPE_WPA2 0x0010 327 | #define WPS_AUTHTYPE_WPA2PSK 0x0020 328 | 329 | // Config methods 330 | #define WPS_CONFMET_USBA 0x0001 331 | #define WPS_CONFMET_ETHERNET 0x0002 332 | #define WPS_CONFMET_LABEL 0x0004 333 | #define WPS_CONFMET_DISPLAY 0x0008 334 | #define WPS_CONFMET_EXT_NFC_TOK 0x0010 335 | #define WPS_CONFMET_INT_NFC_TOK 0x0020 336 | #define WPS_CONFMET_NFC_INTF 0x0040 337 | #define WPS_CONFMET_PBC 0x0080 338 | #define WPS_CONFMET_KEYPAD 0x0100 339 | 340 | // WPS error messages 341 | #define WPS_ERROR_NO_ERROR 0 342 | #define WPS_ERROR_OOB_INT_READ_ERR 1 343 | #define WPS_ERROR_DECRYPT_CRC_FAIL 2 344 | #define WPS_ERROR_CHAN24_NOT_SUPP 3 345 | #define WPS_ERROR_CHAN50_NOT_SUPP 4 346 | #define WPS_ERROR_SIGNAL_WEAK 5 347 | #define WPS_ERROR_NW_AUTH_FAIL 6 348 | #define WPS_ERROR_NW_ASSOC_FAIL 7 349 | #define WPS_ERROR_NO_DHCP_RESP 8 350 | #define WPS_ERROR_FAILED_DHCP_CONF 9 351 | #define WPS_ERROR_IP_ADDR_CONFLICT 10 352 | #define WPS_ERROR_FAIL_CONN_REGISTRAR 11 353 | #define WPS_ERROR_MULTI_PBC_DETECTED 12 354 | #define WPS_ERROR_ROGUE_SUSPECTED 13 355 | #define WPS_ERROR_DEVICE_BUSY 14 356 | #define WPS_ERROR_SETUP_LOCKED 15 357 | #define WPS_ERROR_MSG_TIMEOUT 16 358 | #define WPS_ERROR_REG_SESSION_TIMEOUT 17 359 | #define WPS_ERROR_DEV_PWD_AUTH_FAIL 18 360 | 361 | #define WPS_ERROR_MAX WPS_ERROR_DEV_PWD_AUTH_FAIL 362 | 363 | // Connection types 364 | #define WPS_CONNTYPE_ESS 0x01 365 | #define WPS_CONNTYPE_IBSS 0x02 366 | 367 | // Device password ID 368 | #define WPS_DEVICEPWDID_DEFAULT 0x0000 369 | #define WPS_DEVICEPWDID_USER_SPEC 0x0001 370 | #define WPS_DEVICEPWDID_MACHINE_SPEC 0x0002 371 | #define WPS_DEVICEPWDID_REKEY 0x0003 372 | #define WPS_DEVICEPWDID_PUSH_BTN 0x0004 373 | #define WPS_DEVICEPWDID_REG_SPEC 0x0005 374 | 375 | /* 376 | // Device type 377 | #define WPS_DEVICETYPE_COMPUTER "Computer" 378 | #define WPS_DEVICETYPE_AP "Access_Point" 379 | #define WPS_DEVICETYPE_ROUTER_AP "Router_AP" 380 | #define WPS_DEVICETYPE_PRINTER "Printer" 381 | #define WPS_DEVICETYPE_PRINTER_BRIDGE "Printer_Brigde" 382 | #define WPS_DEVICETYPE_ELECT_PIC_FRAME "Electronic_Picture_Frame" 383 | #define WPS_DEVICETYPE_DIG_AUDIO_RECV "Digital_Audio_Receiver" 384 | #define WPS_DEVICETYPE_WIN_MCE "Windows_Media_Center_Extender" 385 | #define WPS_DEVICETYPE_WIN_MOBILE "Windows_Mobile" 386 | #define WPS_DEVICETYPE_PVR "Personal_Video_Recorder" 387 | #define WPS_DEVICETYPE_VIDEO_STB "Video_STB" 388 | #define WPS_DEVICETYPE_PROJECTOR "Projector" 389 | #define WPS_DEVICETYPE_IP_TV "IP_TV" 390 | #define WPS_DEVICETYPE_DIG_STILL_CAM "Digital_Still_Camera" 391 | #define WPS_DEVICETYPE_PHONE "Phone" 392 | #define WPS_DEVICETYPE_VOID_PHONE "VoIP_Phone" 393 | #define WPS_DEVICETYPE_GAME_CONSOLE "Game_console" 394 | #define WPS_DEVICETYPE_OTHER "Other" 395 | */ 396 | 397 | // Encryption type 398 | #define WPS_ENCRTYPE_NONE 0x0001 399 | #define WPS_ENCRTYPE_WEP 0x0002 400 | #define WPS_ENCRTYPE_TKIP 0x0004 401 | #define WPS_ENCRTYPE_AES 0x0008 402 | 403 | 404 | // WPS Message Types 405 | #define WPS_ID_BEACON 0x01 406 | #define WPS_ID_PROBE_REQ 0x02 407 | #define WPS_ID_PROBE_RESP 0x03 408 | #define WPS_ID_MESSAGE_M1 0x04 409 | #define WPS_ID_MESSAGE_M2 0x05 410 | #define WPS_ID_MESSAGE_M2D 0x06 411 | #define WPS_ID_MESSAGE_M3 0x07 412 | #define WPS_ID_MESSAGE_M4 0x08 413 | #define WPS_ID_MESSAGE_M5 0x09 414 | #define WPS_ID_MESSAGE_M6 0x0A 415 | #define WPS_ID_MESSAGE_M7 0x0B 416 | #define WPS_ID_MESSAGE_M8 0x0C 417 | #define WPS_ID_MESSAGE_ACK 0x0D 418 | #define WPS_ID_MESSAGE_NACK 0x0E 419 | #define WPS_ID_MESSAGE_DONE 0x0F 420 | 421 | //Device Type categories for primary and secondary device types 422 | #define WPS_DEVICE_TYPE_CAT_COMPUTER 1 423 | #define WPS_DEVICE_TYPE_CAT_INPUT_DEVICE 2 424 | #define WPS_DEVICE_TYPE_CAT_PRINTER 3 425 | #define WPS_DEVICE_TYPE_CAT_CAMERA 4 426 | #define WPS_DEVICE_TYPE_CAT_STORAGE 5 427 | #define WPS_DEVICE_TYPE_CAT_NW_INFRA 6 428 | #define WPS_DEVICE_TYPE_CAT_DISPLAYS 7 429 | #define WPS_DEVICE_TYPE_CAT_MM_DEVICES 8 430 | #define WPS_DEVICE_TYPE_CAT_GAME_DEVICES 9 431 | #define WPS_DEVICE_TYPE_CAT_TELEPHONE 10 432 | 433 | //Device Type sub categories for primary and secondary device types 434 | #define WPS_DEVICE_TYPE_SUB_CAT_COMP_PC 1 435 | #define WPS_DEVICE_TYPE_SUB_CAT_COMP_SERVER 2 436 | #define WPS_DEVICE_TYPE_SUB_CAT_COMP_MEDIA_CTR 3 437 | #define WPS_DEVICE_TYPE_SUB_CAT_PRTR_PRINTER 1 438 | #define WPS_DEVICE_TYPE_SUB_CAT_PRTR_SCANNER 2 439 | #define WPS_DEVICE_TYPE_SUB_CAT_CAM_DGTL_STILL 1 440 | #define WPS_DEVICE_TYPE_SUB_CAT_STOR_NAS 1 441 | #define WPS_DEVICE_TYPE_SUB_CAT_NW_AP 1 442 | #define WPS_DEVICE_TYPE_SUB_CAT_NW_ROUTER 2 443 | #define WPS_DEVICE_TYPE_SUB_CAT_NW_SWITCH 3 444 | #define WPS_DEVICE_TYPE_SUB_CAT_DISP_TV 1 445 | #define WPS_DEVICE_TYPE_SUB_CAT_DISP_PIC_FRAME 2 446 | #define WPS_DEVICE_TYPE_SUB_CAT_DISP_PROJECTOR 3 447 | #define WPS_DEVICE_TYPE_SUB_CAT_MM_DAR 1 448 | #define WPS_DEVICE_TYPE_SUB_CAT_MM_PVR 2 449 | #define WPS_DEVICE_TYPE_SUB_CAT_MM_MCX 3 450 | #define WPS_DEVICE_TYPE_SUB_CAT_GAM_XBOX 1 451 | #define WPS_DEVICE_TYPE_SUB_CAT_GAM_XBOX_360 2 452 | #define WPS_DEVICE_TYPE_SUB_CAT_GAM_PS 3 453 | #define WPS_DEVICE_TYPE_SUB_CAT_PHONE_WM 1 454 | 455 | // Device request/response type 456 | #define WPS_MSGTYPE_ENROLLEE_INFO_ONLY 0x00 457 | #define WPS_MSGTYPE_ENROLLEE_OPEN_8021X 0x01 458 | #define WPS_MSGTYPE_REGISTRAR 0x02 459 | #define WPS_MSGTYPE_AP_WLAN_MGR 0x03 460 | 461 | // RF Band 462 | #define WPS_RFBAND_24GHZ 0x01 463 | #define WPS_RFBAND_50GHZ 0x02 464 | 465 | // Simple Config state 466 | #define WPS_SCSTATE_UNCONFIGURED 0x01 467 | #define WPS_SCSTATE_CONFIGURED 0x02 468 | 469 | // State business 470 | #define WPS_RETRY_INTERVAL 5 /* seconds */ 471 | #define WPS_PACKET_TIMEOUT 15 /* seconds */ 472 | 473 | #define WPS_TIMEOUT_SECS 1 474 | 475 | enum WPSSupplicantState 476 | { 477 | WPS_S_INIT, 478 | WPS_S_EAPOL_START_TX, 479 | WPS_S_EAPOL_START_RX, 480 | WPS_S_IDENT_REQ_TX, 481 | WPS_S_IDENT_REQ_RX, 482 | WPS_S_IDENT_RESP_TX, 483 | WPS_S_IDENT_RESP_RX, 484 | WPS_S_START_TX, 485 | WPS_S_START_RX, 486 | WPS_S_M1_TX, 487 | WPS_S_M1_RX, 488 | WPS_S_M2_TX, 489 | WPS_S_M2_RX, 490 | WPS_S_M3_TX, 491 | WPS_S_M3_RX, 492 | WPS_S_M4_TX, 493 | WPS_S_M4_RX, 494 | WPS_S_M5_TX, 495 | WPS_S_M5_RX, 496 | WPS_S_M6_TX, 497 | WPS_S_M6_RX, 498 | WPS_S_M7_TX, 499 | WPS_S_M7_RX, 500 | WPS_S_M8_TX, 501 | WPS_S_M8_RX, 502 | WPS_S_DONE_TX, 503 | WPS_S_DONE_RX, 504 | WPS_S_FAIL_TX, 505 | WPS_S_FAIL_RX, 506 | WPS_S_MSG_TIMEOUT, 507 | WPS_S_SESSION_TIMEOUT, 508 | }; 509 | typedef enum WPSSupplicantState WPSSupplicantState; 510 | 511 | // Apple specific error codes 512 | 513 | #define WPSE_NOERR 0 // no error 514 | #define WPSE_ERR -1 // general error code 515 | #define WPSE_PROTO_ERR -2 // Problem with EAPOL handshake 516 | #define WPSE_IE_NOT_PRESENT -3 // No WPS IE present in IE list for ssid 517 | #define WPSE_IE_MALFORMED -4 // WPS IS missing required (for Apple) fields 518 | #define WPSE_SCAN_ERR -5 // Scan failed 519 | #define WPSE_NO_PIN_AT_REG -6 // No PIN configured at registrar 520 | #define WPSE_NO_PIN_AT_CLIENT -7 // No PIN configured at client 521 | #define WPSE_SSID_NOT_FOUND -8 // Scan did not find SSID 522 | #define WPSE_UNSUPPORTED_PW_ID -9 // Registrar reports that it is using an unsupported PW ID 523 | #define WPSE_ASSOC_FAILED -10 // Association attempt failed 524 | #define WPSE_API_REQ -11 // An apple80211 ioctl request failed 525 | #define WPSE_NOMEM -12 // memory error 526 | #define WPSE_WPA_RSN_NOT_SUP -13 // WPA/RSN not supported 527 | #define WPSE_TIMEOUT -14 // EAPOL timed out 528 | #define WPSE_NACKED -15 // NACKED by registrar 529 | #define WPSE_FAIL -16 // unexpected EAP-FAIL received 530 | 531 | #endif /* WPS_EAP_H */ 532 | 533 | -------------------------------------------------------------------------------- /Black80211/apple80211/ioctl: -------------------------------------------------------------------------------- 1 | #define APPLE80211_IOC_PID_LOCK 0 2 | #define APPLE80211_IOC_STA_IE_LIST 0 3 | #define APPLE80211_IOC_STA_AUTHORIZE 0 4 | #define APPLE80211_IOC_STA_DISASSOCIATE 0 5 | #define APPLE80211_IOC_STA_DEAUTH 0 6 | #define APPLE80211_IOC_RSN_CONF 0 7 | #define APPLE80211_IOC_KEY_RSC 0 8 | #define APPLE80211_IOC_STA_STATS 0 9 | #define APPLE80211_IOC_ROAM_THRESH 0 10 | #define APPLE80211_IOC_VENDOR_DBG_FLAGS 0 11 | #define APPLE80211_IOC_CACHE_AGE_THRESH 0 12 | #define APPLE80211_IOC_PMK_CACHE 0 13 | #define APPLE80211_IOC_LINK_QUAL_EVENT_PARAMS 0 14 | #define APPLE80211_IOC_IE 0 15 | #define APPLE80211_IOC_SCAN_REQ_MULTIPLE 0 16 | #define APPLE80211_IOC_BTCOEX_MODE 0 17 | #define APPLE80211_IOC_WOW_TEST 0 18 | #define APPLE80211_IOC_CLEAR_PMK_CACHE 0 19 | #define APPLE80211_IOC_SCANCACHE_CLEAR 0 20 | #define APPLE80211_IOC_P2P_ENABLE 0 21 | #define APPLE80211_IOC_P2P_LISTEN 0 22 | #define APPLE80211_IOC_P2P_SCAN 0 23 | #define APPLE80211_IOC_VIRTUAL_IF_CREATE 0 24 | #define APPLE80211_IOC_VIRTUAL_IF_DELETE 0 25 | #define APPLE80211_IOC_VIRTUAL_IF_ROLE 0 26 | #define APPLE80211_IOC_VIRTUAL_IF_PARENT 0 27 | #define APPLE80211_IOC_P2P_GO_CONF 0 28 | #define APPLE80211_IOC_P2P_NOA_LIST 0 29 | #define APPLE80211_IOC_P2P_OPP_PS 0 30 | #define APPLE80211_IOC_P2P_CT_WINDOW 0 31 | #define APPLE80211_IOC_BT_COEX_FLAGS 0 32 | #define APPLE80211_IOC_CURRENT_NETWORK 0 33 | #define APPLE80211_IOC_BT_POWER 0 34 | #define APPLE80211_IOC_AVAILABILITY 0 35 | #define APPLE80211_IOC_RSSI_BOUNDS 0 36 | #define APPLE80211_IOC_ROAM 0 37 | #define APPLE80211_IOC_TX_CHAIN_POWER 0 38 | #define APPLE80211_IOC_CDD_MODE 0 39 | #define APPLE80211_IOC_LAST_BCAST_SCAN_TIME 0 40 | #define APPLE80211_IOC_THERMAL_THROTTLING 0 41 | #define APPLE80211_IOC_FACTORY_MODE 0 42 | #define APPLE80211_IOC_REASSOCIATE 0 43 | #define APPLE80211_IOC_POWER_DEBUG_INFO 0 44 | #define APPLE80211_IOC_AWDL_SYNC_PARAMS 0 45 | #define APPLE80211_IOC_AWDL_SYNC_ENABLED 0 46 | #define APPLE80211_IOC_AWDL_EXTENSION_STATE_MACHINE_PARAMETERS 0 47 | #define APPLE80211_IOC_AWDL_SERVICE_PARAMS 0 48 | #define APPLE80211_IOC_AWDL_PEER_SERVICE_REQUEST 0 49 | #define APPLE80211_IOC_AWDL_ELECTION_ALGORITHM_ENABLED 0 50 | #define APPLE80211_IOC_AWDL_ELECTION_ID 0 51 | #define APPLE80211_IOC_AWDL_MAX_TREE_DEPTH 0 52 | #define APPLE80211_IOC_AWDL_GUARD_TIME 0 53 | #define APPLE80211_IOC_AWDL_BSSID 0 54 | #define APPLE80211_IOC_AWDL_ELECTION_METRIC 0 55 | #define APPLE80211_IOC_AWDL_AVAILABILITY_WINDOW_AP_ALIGNMENT 0 56 | #define APPLE80211_IOC_AWDL_SYNC_FRAME_AP_BEACON_ALIGNMENT 0 57 | #define APPLE80211_IOC_AWDL_SYNCHRONIZATION_CHANNEL_SEQUENCE 0 58 | #define APPLE80211_IOC_PEER_CACHE_MAXIMUM_SIZE 0 59 | #define APPLE80211_IOC_AWDL_OUI 0 60 | #define APPLE80211_IOC_AWDL_MASTER_CHANNEL 0 61 | #define APPLE80211_IOC_AWDL_TOP_MASTER 0 62 | #define APPLE80211_IOC_AWDL_SYNC_STATE 0 63 | #define APPLE80211_IOC_AWDL_ELECTION_RSSI_THRESHOLDS 0 64 | #define APPLE80211_IOC_AWDL_PRESENCE_MODE 0 65 | #define APPLE80211_IOC_AWDL_ELECTION_MASTER_COUNTS 0 66 | #define APPLE80211_IOC_AWDL_PERIODIC_SYNC_FRAME_PACKET_LIFETIME 0 67 | #define APPLE80211_IOC_AWDL_MASTER_MODE_SYNC_FRAME_PERIOD 0 68 | #define APPLE80211_IOC_AWDL_NON_ELECTION_MASTER_MODE_SYNC_FRAME_PERIOD 0 69 | #define APPLE80211_IOC_AWDL_EXPLICIT_AVAILABILITY_WINDOW_EXTENSION_OPT_OUT 0 70 | #define APPLE80211_IOC_AWDL_GET_AWDL_MASTER_DATABASE 0 71 | #define APPLE80211_IOC_PEER_CACHE_CONTROL 0 72 | #define APPLE80211_IOC_AWDL_BATTERY_LEVEL 0 73 | #define APPLE80211_IOC_AWDL_BT_COEX_AW_PROTECTED_PERIOD_LENGTH 0 74 | #define APPLE80211_IOC_AWDL_BT_COEX_AGREEMENT 0 75 | #define APPLE80211_IOC_AWDL_BT_COEX_AGREEMENT_ENABLED 0 76 | #define APPLE80211_IOC_AWDL_STRATEGY 0 77 | #define APPLE80211_IOC_AWDL_OOB_REQUEST 0 78 | #define APPLE80211_IOC_AWDL_MAX_NO_MASTER_PERIODS 0 79 | #define APPLE80211_IOC_AWDL_SYNC_FRAME_TEMPLATE 0 80 | #define APPLE80211_IOC_LOG_FLAGS 0 81 | #define APPLE80211_IOC_PEER_STATS 0 82 | #define APPLE80211_IOC_HT_CAPABILITY 0 83 | #define APPLE80211_IOC_AWDL_ELECTION_PARAMS 0 84 | #define APPLE80211_IOC_LINK_CHANGED_EVENT_DATA 0 85 | #define APPLE80211_IOC_GET_DEBUG_INFO 0 86 | #define APPLE80211_IOC_AWDL_DEVICE_CAPABILITIES 0 87 | #define APPLE80211_IOC_AWDL_RSSI_MEASUREMENT_REQUEST 0 88 | #define APPLE80211_IOC_AWDL_AES_KEY 0 89 | #define APPLE80211_IOC_AWDL_SCAN_RESERVED_TIME 0 90 | #define APPLE80211_IOC_AWDL_CTL 0 91 | #define APPLE80211_IOC_AWDL_SOCIAL_TIME_SLOTS 0 92 | #define APPLE80211_IOC_AWDL_PEER_TRAFFIC_REGISTRATION 0 93 | #define APPLE80211_IOC_EXTENDED_STATS 0 94 | #define APPLE80211_IOC_BEACON_PERIOD 0 95 | #define APPLE80211_IOC_AWDL_FORCED_ROAM_CONFIG 0 96 | #define APPLE80211_IOC_AWDL_QUIET 0 97 | #define APPLE80211_IOC_ACL_POLICY 0 98 | #define APPLE80211_IOC_ACL_ADD 0 99 | #define APPLE80211_IOC_ACL_REMOVE 0 100 | #define APPLE80211_IOC_ACL_FLUSH 0 101 | #define APPLE80211_IOC_ACL_LIST 0 102 | #define APPLE80211_IOC_CHAIN_ACK 0 103 | #define APPLE80211_IOC_DESENSE 0 104 | #define APPLE80211_IOC_OFFLOAD_SCANNING 0 105 | #define APPLE80211_IOC_OFFLOAD_RSN 0 106 | #define APPLE80211_IOC_OFFLOAD_COUNTRY_CODE 0 107 | #define APPLE80211_IOC_OFFLOAD_KEEPALIVE_L2 0 108 | #define APPLE80211_IOC_OFFLOAD_ARP_NDP 0 109 | #define APPLE80211_IOC_VHT_MCS_INDEX_SET 0 110 | #define APPLE80211_IOC_DWDS 0 111 | #define APPLE80211_IOC_INTERRUPT_STATS 0 112 | #define APPLE80211_IOC_INTERRUPT_STATS_RESET 0 113 | #define APPLE80211_IOC_TIMER_STATS 0 114 | #define APPLE80211_IOC_TIMER_STATS_RESET 0 115 | #define APPLE80211_IOC_OFFLOAD_STATS 0 116 | #define APPLE80211_IOC_OFFLOAD_STATS_RESET 0 117 | #define APPLE80211_IOC_OFFLOAD_BEACONS 0 118 | #define APPLE80211_IOC_ROAMING 0 119 | #define APPLE80211_IOC_OFFLOAD_ARP 0 120 | #define APPLE80211_IOC_OFFLOAD_NDP 0 121 | #define APPLE80211_IOC_OFFLOAD_SCAN 0 122 | #define APPLE80211_IOC_DESENSE_LEVEL 0 123 | #define APPLE80211_IOC_MCS_VHT 0 124 | #define APPLE80211_IOC_TX_NSS 0 125 | #define APPLE80211_IOC_GAS_REQ 0 126 | #define APPLE80211_IOC_GAS_START 0 127 | #define APPLE80211_IOC_GAS_SET_PEER 0 128 | #define APPLE80211_IOC_GAS_RESULTS 0 129 | #define APPLE80211_IOC_AWDL_BTLE_PEER_INDICATION 0 130 | #define APPLE80211_IOC_AWDL_BTLE_STATE_PARAMS 0 131 | #define APPLE80211_IOC_AWDL_PEER_DATABASE 0 132 | #define APPLE80211_IOC_AWDL_BTLE_ENABLE_SYNC_WITH_PARAMS 0 133 | #define APPLE80211_IOC_AWDL_SECONDARY_MASTER_CHANNEL 0 134 | #define APPLE80211_IOC_PHY_STATS 0 135 | #define APPLE80211_IOC_CHANNELS_INFO 0 136 | #define APPLE80211_IOC_AWDL_AF_TX_MODE 0 137 | #define APPLE80211_IOC_ERROR_STRING 0 138 | #define APPLE80211_IOC_ERROR_NO 0 139 | #define APPLE80211_IOC_AWDL_PIGGYBACK_SCAN_REQ 0 140 | #define APPLE80211_IOC_AWDL_PRIVATE_ELECTION_ID 0 141 | #define APPLE80211_IOC_AWDL_MIN_RATE 0 142 | #define APPLE80211_IOC_VHT_CAPABILITY 0 143 | #define APPLE80211_IOC_BGSCAN_CACHE_RESULTS 0 144 | #define APPLE80211_IOC_ROAM_PROFILE 0 145 | #define APPLE80211_IOC_AWDL_OPER_MODE 0 146 | #define APPLE80211_IOC_RESTORE_DEFAULTS 0 147 | #define APPLE80211_IOC_AWDL_ENCRYPTION_KEYS 0 148 | #define APPLE80211_IOC_AWDL_ENCRYPTION_TYPE 0 149 | #define APPLE80211_IOC_BTCOEX_PROFILES 0 150 | #define APPLE80211_IOC_BTCOEX_CONFIG 0 151 | #define APPLE80211_IOC_AWDL_STATISTICS 0 152 | #define APPLE80211_IOC_AWDL_ENABLE_ROAMING 0 153 | #define APPLE80211_IOC_AWDL_OOB_AUTO_REQUEST 0 154 | #define APPLE80211_IOC_AWDL_TXCAL_PERIOD 0 155 | #define APPLE80211_IOC_CHIP_COUNTER_STATS 0 156 | #define APPLE80211_IOC_DBG_GUARD_TIME_PARAMS 0 157 | #define APPLE80211_IOC_AWDL_AWDL_ADVERTISERS 0 158 | #define APPLE80211_IOC_LEAKY_AP_STATS_MODE 0 159 | #define APPLE80211_IOC_CAPTURE 0 160 | #define APPLE80211_IOC_LEAKY_AP_STATS 0 161 | #define APPLE80211_IOC_AWDL_BLOCK_SET_COMMANDS 0 162 | #define APPLE80211_IOC_LEAKY_AP_AWD_MODE 0 163 | #define APPLE80211_IOC_BTCOEX_OPTIONS 0 164 | #define APPLE80211_IOC_FORCE_SYNC_TO_PEER 0 165 | #define APPLE80211_IOC_COUNTRY_CHANNELS 0 166 | #define APPLE80211_IOC_PRIVATE_MAC 0 167 | #define APPLE80211_IOC_RESET_CHIP 0 168 | #define APPLE80211_IOC_CRASH 0 169 | #define APPLE80211_IOC_RANGING_ENABLE 0 170 | #define APPLE80211_IOC_RANGING_START 0 171 | #define APPLE80211_IOC_RANGING_AUTHENTICATE 0 172 | #define APPLE80211_IOC_AWDL_PREFERRED_CHANNELS 0 173 | #define APPLE80211_IOC_LEAKY_AP_SSID_STATS 0 174 | #define APPLE80211_IOC_AWDL_RSDB_CAPS 0 175 | #define APPLE80211_IOC_AWDL_DEV_STATS 0 176 | #define APPLE80211_IOC_LAST_ASSOC_HISTORY 0 177 | #define APPLE80211_IOC_AWDL_COMMON_CHANNEL 0 178 | #define APPLE80211_IOC_AWDL_PEERS_INFO 0 179 | #define APPLE80211_IOC_TKO_PARAMS 0 180 | #define APPLE80211_IOC_TKO_DUMP 0 181 | #define APPLE80211_IOC_AWDL_NEARBY_LOG_TRIGGER 0 182 | #define APPLE80211_IOC_HW_SUPPORTED_CHANNELS 0 183 | #define APPLE80211_IOC_BTCOEX_PROFILE 0 184 | #define APPLE80211_IOC_BTCOEX_PROFILE_ACTIVE 0 185 | #define APPLE80211_IOC_TRAP_INFO 0 186 | #define APPLE80211_IOC_THERMAL_INDEX 0 187 | #define APPLE80211_IOC_MAX_NSS_FOR_AP 0 188 | #define APPLE80211_IOC_BTCOEX_2G_CHAIN_DISABLE 0 189 | #define APPLE80211_IOC_POWER_BUDGET 0 190 | #define APPLE80211_IOC_AWDL_DFSP_CONFIG 0 191 | #define APPLE80211_IOC_AWDL_DFSP_UCSA_CONFIG 0 192 | #define APPLE80211_IOC_SCAN_BACKOFF_REPORT 0 193 | #define APPLE80211_IOC_OFFLOAD_TCPKA_ENABLE 0 194 | #define APPLE80211_IOC_RANGING_CAPS 0 195 | #define APPLE80211_IOC_PER_CORE_RSSI_REPORT 0 196 | -------------------------------------------------------------------------------- /Black80211/debug.h: -------------------------------------------------------------------------------- 1 | // 2 | // debug.h 3 | // Black80211_HighSierra 4 | // 5 | // Created by Roman Peshkov on 05/07/2018. 6 | // Copyright © 2018 Roman Peshkov. All rights reserved. 7 | // 8 | 9 | #ifndef debug_h 10 | #define debug_h 11 | 12 | const char* IOCTL_NAMES[354] = { 13 | "UNKNOWN", 14 | "SSID", 15 | "AUTH_TYPE", 16 | "CIPHER_KEY", 17 | "CHANNEL", 18 | "POWERSAVE", 19 | "PROTMODE", 20 | "TXPOWER", 21 | "RATE", 22 | "BSSID", 23 | "SCAN_REQ", 24 | "SCAN_RESULT", 25 | "CARD_CAPABILITIES", 26 | "STATE", 27 | "PHY_MODE", 28 | "OP_MODE", 29 | "RSSI", 30 | "NOISE", 31 | "INT_MIT", 32 | "POWER", 33 | "ASSOCIATE", 34 | "ASSOCIATE_RESULT", 35 | "DISASSOCIATE", 36 | "STATUS_DEV_NAME", 37 | "IBSS_MODE", 38 | "HOST_AP_MODE", 39 | "AP_MODE", 40 | "SUPPORTED_CHANNELS", 41 | "LOCALE", 42 | "DEAUTH", 43 | "COUNTERMEASURES", 44 | "FRAG_THRESHOLD", 45 | "RATE_SET", 46 | "SHORT_SLOT", 47 | "MULTICAST_RATE", 48 | "SHORT_RETRY_LIMIT", 49 | "LONG_RETRY_LIMIT", 50 | "TX_ANTENNA", 51 | "RX_ANTENNA", 52 | "ANTENNA_DIVERSITY", 53 | "ROM", 54 | "DTIM_INT", 55 | "STATION_LIST", 56 | "DRIVER_VERSION", 57 | "HARDWARE_VERSION", 58 | "RAND", 59 | "RSN_IE", 60 | "BACKGROUND_SCAN", 61 | "AP_IE_LIST", 62 | "STATS", 63 | "ASSOCIATION_STATUS", 64 | "COUNTRY_CODE", 65 | "DEBUG_FLAGS", 66 | "LAST_RX_PKT_DATA", 67 | "RADIO_INFO", 68 | "GUARD_INTERVAL", 69 | "MIMO_POWERSAVE", 70 | "MCS", 71 | "RIFS", 72 | "LDPC", 73 | "MSDU", 74 | "MPDU", 75 | "BLOCK_ACK", 76 | "PLS", 77 | "PSMP", 78 | "PHY_SUB_MODE", 79 | "MCS_INDEX_SET", 80 | "CACHE_THRESH_BCAST", 81 | "CACHE_THRESH_DIRECT", 82 | "WOW_PARAMETERS", 83 | "WOW_ENABLED", 84 | "40MHZ_INTOLERANT", 85 | "PID_LOCK", 86 | "STA_IE_LIST", 87 | "STA_AUTHORIZE", 88 | "STA_DISASSOCIATE", 89 | "STA_DEAUTH", 90 | "RSN_CONF", 91 | "KEY_RSC", 92 | "STA_STATS", 93 | "ROAM_THRESH", 94 | "VENDOR_DBG_FLAGS", 95 | "CACHE_AGE_THRESH", 96 | "PMK_CACHE", 97 | "LINK_QUAL_EVENT_PARAMS", 98 | "IE", 99 | "SCAN_REQ_MULTIPLE", 100 | "BTCOEX_MODE", 101 | "WOW_TEST", 102 | "CLEAR_PMK_CACHE", 103 | "SCANCACHE_CLEAR", 104 | "P2P_ENABLE", 105 | "P2P_LISTEN", 106 | "P2P_SCAN", 107 | "VIRTUAL_IF_CREATE", 108 | "VIRTUAL_IF_DELETE", 109 | "VIRTUAL_IF_ROLE", 110 | "VIRTUAL_IF_PARENT", 111 | "P2P_GO_CONF", 112 | "P2P_NOA_LIST", 113 | "P2P_OPP_PS", 114 | "P2P_CT_WINDOW", 115 | "BT_COEX_FLAGS", 116 | "CURRENT_NETWORK", 117 | "BT_POWER", 118 | "AVAILABILITY", 119 | "RSSI_BOUNDS", 120 | "ROAM", 121 | "TX_CHAIN_POWER", 122 | "CDD_MODE", 123 | "LAST_BCAST_SCAN_TIME", 124 | "THERMAL_THROTTLING", 125 | "FACTORY_MODE", 126 | "REASSOCIATE", 127 | "???MISSING???", 128 | "POWER_DEBUG_INFO", 129 | "AWDL_SYNC_PARAMS", 130 | "AWDL_SYNC_ENABLED", 131 | "AWDL_EXTENSION_STATE_MACHINE_PARAMETERS", 132 | "AWDL_SERVICE_PARAMS", 133 | "AWDL_PEER_SERVICE_REQUEST", 134 | "AWDL_ELECTION_ALGORITHM_ENABLED", 135 | "AWDL_ELECTION_ID", 136 | "AWDL_MAX_TREE_DEPTH", 137 | "AWDL_GUARD_TIME", 138 | "AWDL_BSSID", 139 | "AWDL_ELECTION_METRIC", 140 | "AWDL_AVAILABILITY_WINDOW_AP_ALIGNMENT", 141 | "AWDL_SYNC_FRAME_AP_BEACON_ALIGNMENT", 142 | "AWDL_SYNCHRONIZATION_CHANNEL_SEQUENCE", 143 | "PEER_CACHE_MAXIMUM_SIZE", 144 | "AWDL_OUI", 145 | "AWDL_MASTER_CHANNEL", 146 | "AWDL_TOP_MASTER", 147 | "AWDL_SYNC_STATE", 148 | "AWDL_ELECTION_RSSI_THRESHOLDS", 149 | "AWDL_PRESENCE_MODE", 150 | "AWDL_ELECTION_MASTER_COUNTS", 151 | "AWDL_PERIODIC_SYNC_FRAME_PACKET_LIFETIME", 152 | "AWDL_MASTER_MODE_SYNC_FRAME_PERIOD", 153 | "AWDL_NON_ELECTION_MASTER_MODE_SYNC_FRAME_PERIOD", 154 | "AWDL_EXPLICIT_AVAILABILITY_WINDOW_EXTENSION_OPT_OUT", 155 | "AWDL_GET_AWDL_MASTER_DATABASE", 156 | "PEER_CACHE_CONTROL", 157 | "AWDL_BATTERY_LEVEL", 158 | "AWDL_BT_COEX_AW_PROTECTED_PERIOD_LENGTH", 159 | "AWDL_BT_COEX_AGREEMENT", 160 | "AWDL_BT_COEX_AGREEMENT_ENABLED", 161 | "AWDL_STRATEGY", 162 | "AWDL_OOB_REQUEST", 163 | "AWDL_MAX_NO_MASTER_PERIODS", 164 | "AWDL_SYNC_FRAME_TEMPLATE", 165 | "LOG_FLAGS", 166 | "PEER_STATS", 167 | "HT_CAPABILITY", 168 | "AWDL_ELECTION_PARAMS", 169 | "LINK_CHANGED_EVENT_DATA", 170 | "GET_DEBUG_INFO", 171 | "AWDL_DEVICE_CAPABILITIES", 172 | "AWDL_RSSI_MEASUREMENT_REQUEST", 173 | "AWDL_AES_KEY", 174 | "AWDL_SCAN_RESERVED_TIME", 175 | "AWDL_CTL", 176 | "AWDL_SOCIAL_TIME_SLOTS", 177 | "AWDL_PEER_TRAFFIC_REGISTRATION", 178 | "EXTENDED_STATS", 179 | "BEACON_PERIOD", 180 | "AWDL_FORCED_ROAM_CONFIG", 181 | "AWDL_QUIET", 182 | "ACL_POLICY", 183 | "ACL_ADD", 184 | "ACL_REMOVE", 185 | "ACL_FLUSH", 186 | "ACL_LIST", 187 | "CHAIN_ACK", 188 | "DESENSE", 189 | "OFFLOAD_SCANNING", 190 | "OFFLOAD_RSN", 191 | "OFFLOAD_COUNTRY_CODE", 192 | "OFFLOAD_KEEPALIVE_L2", 193 | "OFFLOAD_ARP_NDP", 194 | "VHT_MCS_INDEX_SET", 195 | "DWDS", 196 | "INTERRUPT_STATS", 197 | "INTERRUPT_STATS_RESET", 198 | "TIMER_STATS", 199 | "TIMER_STATS_RESET", 200 | "OFFLOAD_STATS", 201 | "OFFLOAD_STATS_RESET", 202 | "OFFLOAD_BEACONS", 203 | "ROAMING", 204 | "OFFLOAD_ARP", 205 | "OFFLOAD_NDP", 206 | "OFFLOAD_SCAN", 207 | "DESENSE_LEVEL", 208 | "MCS_VHT", 209 | "TX_NSS", 210 | "GAS_REQ", 211 | "GAS_START", 212 | "GAS_SET_PEER", 213 | "GAS_RESULTS", 214 | "AWDL_BTLE_PEER_INDICATION", 215 | "AWDL_BTLE_STATE_PARAMS", 216 | "AWDL_PEER_DATABASE", 217 | "AWDL_BTLE_ENABLE_SYNC_WITH_PARAMS", 218 | "AWDL_SECONDARY_MASTER_CHANNEL", 219 | "PHY_STATS", 220 | "CHANNELS_INFO", 221 | "AWDL_AF_TX_MODE", 222 | "ERROR_STRING", 223 | "ERROR_NO", 224 | "AWDL_PIGGYBACK_SCAN_REQ", 225 | "AWDL_PRIVATE_ELECTION_ID", 226 | "AWDL_MIN_RATE", 227 | "VHT_CAPABILITY", 228 | "BGSCAN_CACHE_RESULTS", 229 | "ROAM_PROFILE", 230 | "AWDL_OPER_MODE", 231 | "RESTORE_DEFAULTS", 232 | "AWDL_ENCRYPTION_KEYS", 233 | "AWDL_ENCRYPTION_TYPE", 234 | "BTCOEX_PROFILES", 235 | "BTCOEX_CONFIG", 236 | "AWDL_STATISTICS", 237 | "AWDL_ENABLE_ROAMING", 238 | "AWDL_OOB_AUTO_REQUEST", 239 | "AWDL_TXCAL_PERIOD", 240 | "CHIP_COUNTER_STATS", 241 | "DBG_GUARD_TIME_PARAMS", 242 | "AWDL_AWDL_ADVERTISERS", 243 | "LEAKY_AP_STATS_MODE", 244 | "CAPTURE", 245 | "LEAKY_AP_STATS", 246 | "AWDL_BLOCK_SET_COMMANDS", 247 | "LEAKY_AP_AWD_MODE", 248 | "BTCOEX_OPTIONS", 249 | "FORCE_SYNC_TO_PEER", 250 | "COUNTRY_CHANNELS", 251 | "PRIVATE_MAC", 252 | "RESET_CHIP", 253 | "CRASH", 254 | "RANGING_ENABLE", 255 | "RANGING_START", 256 | "RANGING_AUTHENTICATE", 257 | "AWDL_PREFERRED_CHANNELS", 258 | "LEAKY_AP_SSID_STATS", 259 | "AWDL_RSDB_CAPS", 260 | "AWDL_DEV_STATS", 261 | "LAST_ASSOC_HISTORY", 262 | "AWDL_COMMON_CHANNEL", 263 | "AWDL_PEERS_INFO", 264 | "TKO_PARAMS", 265 | "TKO_DUMP", 266 | "AWDL_NEARBY_LOG_TRIGGER", 267 | "HW_SUPPORTED_CHANNELS", 268 | "BTCOEX_PROFILE", 269 | "BTCOEX_PROFILE_ACTIVE", 270 | "TRAP_INFO", 271 | "THERMAL_INDEX", 272 | "MAX_NSS_FOR_AP", 273 | "BTCOEX_2G_CHAIN_DISABLE", 274 | "POWER_BUDGET", 275 | "AWDL_DFSP_CONFIG", 276 | "AWDL_DFSP_UCSA_CONFIG", 277 | "SCAN_BACKOFF_REPORT", 278 | "OFFLOAD_TCPKA_ENABLE", 279 | "RANGING_CAPS", 280 | "PER_CORE_RSSI_REPORT", 281 | }; 282 | 283 | 284 | #endif /* debug_h */ 285 | -------------------------------------------------------------------------------- /Black80211/ieee80211_ioctl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 钟先耀 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | */ 14 | /* $OpenBSD: ieee80211_ioctl.h,v 1.40 2020/04/29 13:13:30 stsp Exp $ */ 15 | /* $NetBSD: ieee80211_ioctl.h,v 1.7 2004/04/30 22:51:04 dyoung Exp $ */ 16 | 17 | /*- 18 | * Copyright (c) 2001 Atsushi Onoe 19 | * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting 20 | * All rights reserved. 21 | * 22 | * Redistribution and use in source and binary forms, with or without 23 | * modification, are permitted provided that the following conditions 24 | * are met: 25 | * 1. Redistributions of source code must retain the above copyright 26 | * notice, this list of conditions and the following disclaimer. 27 | * 2. Redistributions in binary form must reproduce the above copyright 28 | * notice, this list of conditions and the following disclaimer in the 29 | * documentation and/or other materials provided with the distribution. 30 | * 3. The name of the author may not be used to endorse or promote products 31 | * derived from this software without specific prior written permission. 32 | * 33 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 34 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 35 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 36 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 37 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 38 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 39 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 40 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 41 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 42 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | * 44 | * $FreeBSD: src/sys/net80211/ieee80211_ioctl.h,v 1.5 2004/03/30 22:57:57 sam Exp $ 45 | */ 46 | #ifndef _NET80211_IEEE80211_IOCTL_H_ 47 | #define _NET80211_IEEE80211_IOCTL_H_ 48 | 49 | #define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ 50 | #define IEEE80211_NWID_LEN 32 51 | #define IEEE80211_WEP_NKID 4 /* number of key ids */ 52 | #define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */ 53 | 54 | 55 | /* 56 | * IEEE 802.11 ioctls. 57 | */ 58 | 59 | /* per-interface statistics */ 60 | struct ieee80211_stats { 61 | u_int32_t is_rx_badversion; /* rx frame with bad version */ 62 | u_int32_t is_rx_tooshort; /* rx frame too short */ 63 | u_int32_t is_rx_wrongbss; /* rx from wrong bssid */ 64 | u_int32_t is_rx_dup; /* rx discard 'cuz dup */ 65 | u_int32_t is_rx_wrongdir; /* rx w/ wrong direction */ 66 | u_int32_t is_rx_mcastecho; /* rx discard 'cuz mcast echo */ 67 | u_int32_t is_rx_notassoc; /* rx discard 'cuz sta !assoc */ 68 | u_int32_t is_rx_nowep; /* rx w/ wep but wep !config */ 69 | u_int32_t is_rx_unencrypted; /* rx w/o wep but wep config */ 70 | u_int32_t is_rx_wepfail; /* rx wep processing failed */ 71 | u_int32_t is_rx_decap; /* rx decapsulation failed */ 72 | u_int32_t is_rx_mgtdiscard; /* rx discard mgt frames */ 73 | u_int32_t is_rx_ctl; /* rx discard ctrl frames */ 74 | u_int32_t is_rx_rstoobig; /* rx rate set truncated */ 75 | u_int32_t is_rx_elem_missing; /* rx required element missing*/ 76 | u_int32_t is_rx_elem_toobig; /* rx element too big */ 77 | u_int32_t is_rx_elem_toosmall; /* rx element too small */ 78 | u_int32_t is_rx_badchan; /* rx frame w/ invalid chan */ 79 | u_int32_t is_rx_chanmismatch; /* rx frame chan mismatch */ 80 | u_int32_t is_rx_nodealloc; /* rx frame dropped */ 81 | u_int32_t is_rx_ssidmismatch; /* rx frame ssid mismatch */ 82 | u_int32_t is_rx_auth_unsupported; /* rx w/ unsupported auth alg */ 83 | u_int32_t is_rx_auth_fail; /* rx sta auth failure */ 84 | u_int32_t is_rx_assoc_bss; /* rx assoc from wrong bssid */ 85 | u_int32_t is_rx_assoc_notauth; /* rx assoc w/o auth */ 86 | u_int32_t is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */ 87 | u_int32_t is_rx_assoc_norate; /* rx assoc w/ no rate match */ 88 | u_int32_t is_rx_deauth; /* rx deauthentication */ 89 | u_int32_t is_rx_disassoc; /* rx disassociation */ 90 | u_int32_t is_rx_badsubtype; /* rx frame w/ unknown subtype*/ 91 | u_int32_t is_rx_nombuf; /* rx failed for lack of mbuf */ 92 | u_int32_t is_rx_decryptcrc; /* rx decrypt failed on crc */ 93 | u_int32_t is_rx_ahdemo_mgt; /* rx discard ahdemo mgt frame*/ 94 | u_int32_t is_rx_bad_auth; /* rx bad auth request */ 95 | u_int32_t is_tx_nombuf; /* tx failed for lack of mbuf */ 96 | u_int32_t is_tx_nonode; /* tx failed for no node */ 97 | u_int32_t is_tx_unknownmgt; /* tx of unknown mgt frame */ 98 | u_int32_t is_scan_active; /* active scans started */ 99 | u_int32_t is_scan_passive; /* passive scans started */ 100 | u_int32_t is_node_timeout; /* nodes timed out inactivity */ 101 | u_int32_t is_crypto_nomem; /* no memory for crypto ctx */ 102 | u_int32_t is_rx_assoc_badrsnie; /* rx assoc w/ bad RSN IE */ 103 | u_int32_t is_rx_unauth; /* rx port not valid */ 104 | u_int32_t is_tx_noauth; /* tx port not valid */ 105 | u_int32_t is_rx_eapol_key; /* rx eapol-key frames */ 106 | u_int32_t is_rx_eapol_replay; /* rx replayed eapol frames */ 107 | u_int32_t is_rx_eapol_badmic; /* rx eapol frames w/ bad mic */ 108 | u_int32_t is_rx_remmicfail; /* rx tkip remote mic fails */ 109 | u_int32_t is_rx_locmicfail; /* rx tkip local mic fails */ 110 | u_int32_t is_tkip_replays; 111 | u_int32_t is_tkip_icv_errs; 112 | u_int32_t is_ccmp_replays; 113 | u_int32_t is_ccmp_dec_errs; 114 | u_int32_t is_cmac_replays; 115 | u_int32_t is_cmac_icv_errs; 116 | u_int32_t is_pbac_errs; 117 | u_int32_t is_ht_nego_no_mandatory_mcs; 118 | u_int32_t is_ht_nego_no_basic_mcs; 119 | u_int32_t is_ht_nego_bad_crypto; 120 | u_int32_t is_ht_prot_change; 121 | u_int32_t is_ht_rx_ba_agreements; 122 | u_int32_t is_ht_tx_ba_agreements; 123 | u_int32_t is_ht_rx_frame_below_ba_winstart; 124 | u_int32_t is_ht_rx_frame_above_ba_winend; 125 | u_int32_t is_ht_rx_ba_window_slide; 126 | u_int32_t is_ht_rx_ba_window_jump; 127 | u_int32_t is_ht_rx_ba_no_buf; 128 | u_int32_t is_ht_rx_ba_frame_lost; 129 | u_int32_t is_ht_rx_ba_window_gap_timeout; 130 | u_int32_t is_ht_rx_ba_timeout; 131 | u_int32_t is_ht_tx_ba_timeout; 132 | }; 133 | 134 | #define SIOCG80211STATS _IOWR('i', 242, struct ifreq) 135 | 136 | /* network identifier (ESSID), nwid is pointed at by ifr.ifr_data */ 137 | struct ieee80211_nwid { 138 | u_int8_t i_len; 139 | u_int8_t i_nwid[IEEE80211_NWID_LEN]; 140 | }; 141 | 142 | #define SIOCS80211NWID _IOWR('i', 230, struct ifreq) 143 | #define SIOCG80211NWID _IOWR('i', 231, struct ifreq) 144 | 145 | /* network key (WEP), the first member must be matched with struct ifreq */ 146 | struct ieee80211_nwkey { 147 | char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 148 | int i_wepon; /* wep enabled flag */ 149 | int i_defkid; /* default encrypt key id */ 150 | struct { 151 | int i_keylen; 152 | u_int8_t *i_keydat; 153 | } i_key[IEEE80211_WEP_NKID]; 154 | }; 155 | 156 | #define IEEE80211_NWKEY_OPEN 0 /* No privacy */ 157 | #define IEEE80211_NWKEY_WEP 1 /* WEP enabled */ 158 | #define IEEE80211_NWKEY_EAP 2 /* EAP enabled */ 159 | #define IEEE80211_NWKEY_PERSIST 0x100 /* designate persist keyset */ 160 | 161 | #define SIOCS80211NWKEY _IOW('i', 232, struct ieee80211_nwkey) 162 | #define SIOCG80211NWKEY _IOWR('i', 233, struct ieee80211_nwkey) 163 | 164 | /* power management parameters */ 165 | struct ieee80211_power { 166 | char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 167 | int i_enabled; /* 1 == on, 0 == off */ 168 | int i_maxsleep; /* max sleep in ms */ 169 | }; 170 | #define SIOCS80211POWER _IOW('i', 234, struct ieee80211_power) 171 | #define SIOCG80211POWER _IOWR('i', 235, struct ieee80211_power) 172 | 173 | #define IEEE80211_AUTH_NONE 0 174 | #define IEEE80211_AUTH_OPEN 1 175 | #define IEEE80211_AUTH_SHARED 2 176 | 177 | /* channel request */ 178 | struct ieee80211chanreq { 179 | char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 180 | u_int16_t i_channel; 181 | }; 182 | 183 | #ifndef _KERNEL 184 | /* 185 | * Channels are specified by frequency and attributes. 186 | */ 187 | struct ieee80211_channel { 188 | u_int16_t ic_freq; /* setting in MHz */ 189 | u_int16_t ic_flags; /* see below */ 190 | }; 191 | 192 | /* 193 | * Channel attributes (XXX must keep in sync with radiotap flags). 194 | */ 195 | #define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ 196 | #define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ 197 | #define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel */ 198 | #define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ 199 | #define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ 200 | #define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ 201 | #define IEEE80211_CHAN_XR 0x1000 /* Extended range OFDM channel */ 202 | #define IEEE80211_CHAN_HT 0x2000 /* 11n/HT channel */ 203 | #endif /* !_KERNEL */ 204 | 205 | struct ieee80211_chanreq_all { 206 | char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 207 | struct ieee80211_channel *i_chans; 208 | }; 209 | 210 | #ifndef IEEE80211_CHAN_ANY 211 | #define IEEE80211_CHAN_ANY 0xffff 212 | #endif 213 | 214 | #define SIOCS80211CHANNEL _IOW('i', 238, struct ieee80211chanreq) 215 | #define SIOCG80211CHANNEL _IOWR('i', 239, struct ieee80211chanreq) 216 | #define SIOCG80211ALLCHANS _IOWR('i', 215, struct ieee80211_chanreq_all) 217 | 218 | /* BSS identifier */ 219 | struct ieee80211_bssid { 220 | char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 221 | u_int8_t i_bssid[IEEE80211_ADDR_LEN]; 222 | }; 223 | 224 | #define SIOCS80211BSSID _IOW('i', 240, struct ieee80211_bssid) 225 | #define SIOCG80211BSSID _IOWR('i', 241, struct ieee80211_bssid) 226 | 227 | /* transmit power */ 228 | struct ieee80211_txpower { 229 | char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 230 | int i_mode; /* auto, manual */ 231 | int16_t i_val; /* dBm */ 232 | }; 233 | 234 | #define SIOCS80211TXPOWER _IOW('i', 243, struct ieee80211_txpower) 235 | #define SIOCG80211TXPOWER _IOWR('i', 244, struct ieee80211_txpower) 236 | 237 | #define IEEE80211_TXPOWER_MODE_FIXED 0 /* fixed tx power value */ 238 | #define IEEE80211_TXPOWER_MODE_AUTO 1 /* auto level control */ 239 | 240 | struct ieee80211_wpapsk { 241 | char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 242 | int i_enabled; 243 | u_int8_t i_psk[32]; 244 | }; 245 | 246 | #define SIOCS80211WPAPSK _IOW('i', 245, struct ieee80211_wpapsk) 247 | #define SIOCG80211WPAPSK _IOWR('i', 246, struct ieee80211_wpapsk) 248 | 249 | #define IEEE80211_WPA_PROTO_WPA1 0x01 250 | #define IEEE80211_WPA_PROTO_WPA2 0x02 251 | 252 | #define IEEE80211_WPA_CIPHER_NONE 0x00 253 | #define IEEE80211_WPA_CIPHER_USEGROUP 0x01 254 | #define IEEE80211_WPA_CIPHER_WEP40 0x02 255 | #define IEEE80211_WPA_CIPHER_TKIP 0x04 256 | #define IEEE80211_WPA_CIPHER_CCMP 0x08 257 | #define IEEE80211_WPA_CIPHER_WEP104 0x10 258 | #define IEEE80211_WPA_CIPHER_BIP 0x20 259 | 260 | #define IEEE80211_WPA_AKM_PSK 0x01 261 | #define IEEE80211_WPA_AKM_8021X 0x02 262 | #define IEEE80211_WPA_AKM_SHA256_PSK 0x04 263 | #define IEEE80211_WPA_AKM_SHA256_8021X 0x08 264 | 265 | struct ieee80211_wpaparams { 266 | char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 267 | int i_enabled; 268 | u_int i_protos; 269 | u_int i_akms; 270 | u_int i_ciphers; 271 | u_int i_groupcipher; 272 | }; 273 | 274 | #define SIOCS80211WPAPARMS _IOW('i', 247, struct ieee80211_wpaparams) 275 | #define SIOCG80211WPAPARMS _IOWR('i', 248, struct ieee80211_wpaparams) 276 | 277 | struct ieee80211_keyavail { 278 | char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 279 | u_int8_t i_macaddr[IEEE80211_ADDR_LEN]; 280 | u_int8_t i_key[32]; 281 | u_int32_t i_lifetime; 282 | }; 283 | 284 | struct ieee80211_keyrun { 285 | char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ 286 | u_int8_t i_macaddr[IEEE80211_ADDR_LEN]; 287 | }; 288 | 289 | #define SIOCS80211KEYAVAIL _IOW('i', 251, struct ieee80211_keyavail) 290 | #define SIOCS80211KEYRUN _IOW('i', 252, struct ieee80211_keyrun) 291 | 292 | /* scan request (will block) */ 293 | #define IEEE80211_SCAN_TIMEOUT 30 /* timeout in seconds */ 294 | 295 | #define SIOCS80211SCAN _IOW('i', 210, struct ifreq) 296 | 297 | #define SIOCG80211JOINALL _IOWR('i', 218, struct ieee80211_joinreq_all) 298 | #define SIOCS80211JOIN _IOWR('i', 255, struct ifreq) 299 | #define SIOCG80211JOIN _IOWR('i', 256, struct ifreq) 300 | 301 | /* join is pointed at by ifr.ifr_data */ 302 | struct ieee80211_join { 303 | u_int8_t i_len; /* length of i_nwid */ 304 | u_int8_t i_nwid[IEEE80211_NWID_LEN]; 305 | u_int32_t i_flags; 306 | 307 | struct ieee80211_wpaparams i_wpaparams; 308 | struct ieee80211_wpapsk i_wpapsk; 309 | struct ieee80211_nwkey i_nwkey; 310 | }; 311 | 312 | struct ieee80211_joinreq_all { 313 | char ja_ifname[IFNAMSIZ]; 314 | int ja_nodes; /* returned count */ 315 | size_t ja_size; /* size of node buffer */ 316 | struct ieee80211_join *ja_node; /* allocated node buffer */ 317 | }; 318 | 319 | 320 | #define IEEE80211_JOIN_SHOW 0x01 321 | #define IEEE80211_JOIN_FOUND 0x02 322 | #define IEEE80211_JOIN_DEL 0x04 323 | #define IEEE80211_JOIN_NWKEY 0x08 324 | #define IEEE80211_JOIN_WPA 0x10 325 | #define IEEE80211_JOIN_WPAPSK 0x20 326 | #define IEEE80211_JOIN_8021X 0x40 327 | #define IEEE80211_JOIN_ANY 0x80 328 | #define IEEE80211_JOIN_DEL_ALL 0x100 329 | 330 | /* node and requests */ 331 | struct ieee80211_nodereq { 332 | char nr_ifname[IFNAMSIZ]; /* e.g. "ath0" */ 333 | 334 | /* Node address and name information */ 335 | u_int8_t nr_macaddr[IEEE80211_ADDR_LEN]; /* node lladdr */ 336 | u_int8_t nr_bssid[IEEE80211_ADDR_LEN]; /* bssid */ 337 | u_int8_t nr_nwid_len; /* ESSID length */ 338 | u_int8_t nr_nwid[IEEE80211_NWID_LEN]; /* ESSID */ 339 | 340 | /* Channel and rates */ 341 | u_int16_t nr_channel; /* last channel */ 342 | u_int16_t nr_chan_flags; /* channel flags */ 343 | u_int8_t nr_nrates; /* rate count */ 344 | u_int8_t nr_rates[IEEE80211_RATE_MAXSIZE]; /* rate set */ 345 | 346 | /* Node status information */ 347 | int8_t nr_rssi; /* received signal strength */ 348 | int8_t nr_max_rssi; /* maximum rssi */ 349 | u_int8_t nr_tstamp[8]; /* from last received beacon */ 350 | u_int16_t nr_intval; /* beacon interval */ 351 | u_int16_t nr_capinfo; /* capabilities */ 352 | u_int8_t nr_erp; /* 11g only */ 353 | u_int8_t nr_pwrsave; /* power saving mode */ 354 | u_int16_t nr_associd; /* assoc response */ 355 | u_int16_t nr_txseq; /* seq to be transmitted */ 356 | u_int16_t nr_rxseq; /* seq previous received */ 357 | u_int32_t nr_fails; /* failure count to associate */ 358 | u_int32_t nr_inact; /* inactivity mark count */ 359 | u_int8_t nr_txrate; /* index to nr_rates[] */ 360 | u_int16_t nr_state; /* node state in the cache */ 361 | 362 | /* RSN */ 363 | u_int nr_rsnprotos; 364 | u_int nr_rsnciphers; 365 | u_int nr_rsnakms; 366 | 367 | /* Node flags */ 368 | u_int8_t nr_flags; 369 | 370 | /* HT */ 371 | uint16_t nr_htcaps; 372 | uint8_t nr_rxmcs[howmany(80,NBBY)]; 373 | uint16_t nr_max_rxrate; /* in Mb/s, 0 <= rate <= 1023 */ 374 | uint8_t nr_tx_mcs_set; 375 | 376 | /* HT / VHT */ 377 | uint8_t nr_txmcs; 378 | 379 | /* VHT */ 380 | uint8_t nr_vht_ss; 381 | 382 | u_int32_t nr_assoc_fail; /* association failure reasons */ 383 | }; 384 | 385 | #define IEEE80211_NODEREQ_STATE(_s) (1 << _s) 386 | #define IEEE80211_NODEREQ_STATE_BITS \ 387 | "\20\01CACHE\02BSS\03AUTH\04ASSOC\05COLLECT" 388 | 389 | #define IEEE80211_NODEREQ_RSSI(_nr) \ 390 | ((u_int)(((float)(_nr)->nr_rssi / (_nr)->nr_max_rssi) * 100)) 391 | 392 | #define IEEE80211_NODEREQ_STA 0x00 /* station */ 393 | #define IEEE80211_NODEREQ_AP 0x01 /* access point */ 394 | #define IEEE80211_NODEREQ_AP_BSS 0x02 /* current bss access point */ 395 | #define IEEE80211_NODEREQ_COPY 0x04 /* add node with flags */ 396 | #define IEEE80211_NODEREQ_HT 0x08 /* HT negotiated */ 397 | #define IEEE80211_NODEREQ_VHT 0x10 /* VHT negotiated */ 398 | 399 | #define SIOCG80211NODE _IOWR('i', 211, struct ieee80211_nodereq) 400 | #define SIOCS80211NODE _IOW('i', 212, struct ieee80211_nodereq) 401 | #define SIOCS80211DELNODE _IOW('i', 213, struct ieee80211_nodereq) 402 | 403 | #define IEEE80211_NODEREQ_ASSOCFAIL_CHAN 0x01 404 | #define IEEE80211_NODEREQ_ASSOCFAIL_IBSS 0x02 405 | #define IEEE80211_NODEREQ_ASSOCFAIL_PRIVACY 0x04 406 | #define IEEE80211_NODEREQ_ASSOCFAIL_BASIC_RATE 0x08 407 | #define IEEE80211_NODEREQ_ASSOCFAIL_ESSID 0x10 408 | #define IEEE80211_NODEREQ_ASSOCFAIL_BSSID 0x20 409 | #define IEEE80211_NODEREQ_ASSOCFAIL_WPA_PROTO 0x40 410 | #define IEEE80211_NODEREQ_ASSOCFAIL_WPA_KEY 0x80 411 | #define IEEE80211_NODEREQ_ASSOCFAIL_BITS \ 412 | "\20\1!CHAN\2!IBSS\3!PRIVACY\4!BASICRATE\5!ESSID\6!BSSID\7!WPAPROTO" \ 413 | "\10!WPAKEY" 414 | 415 | /* get the entire node cache */ 416 | struct ieee80211_nodereq_all { 417 | char na_ifname[IFNAMSIZ]; /* e.g. "ath0" */ 418 | 419 | int na_nodes; /* returned count */ 420 | size_t na_size; /* size of node buffer */ 421 | struct ieee80211_nodereq *na_node; /* allocated node buffer */ 422 | 423 | /* Match nodes by flag */ 424 | u_int8_t na_flags; /* IEEE80211_NODEREQ_* */ 425 | }; 426 | 427 | #define SIOCG80211ALLNODES _IOWR('i', 214, struct ieee80211_nodereq_all) 428 | 429 | /* net80211 specific interface flags */ 430 | #define IEEE80211_F_HIDENWID 0x00000001 /* CONF: hidden ssid mode */ 431 | #define IEEE80211_F_NOBRIDGE 0x00000002 /* CONF: no internal bridging */ 432 | #define IEEE80211_F_HOSTAPMASK 0x00000003 433 | #define IEEE80211_F_STAYAUTH 0x00000004 /* CONF: ignore deauth */ 434 | #define IEEE80211_F_NOMIMO 0x00000008 /* CONF: disable MIMO */ 435 | #define IEEE80211_F_USERBITS "\20\01HIDENWID\02NOBRIDGE\03STAYAUTH\04NOMIMO" 436 | 437 | struct ieee80211_flags { 438 | const char *f_name; 439 | u_int f_flag; 440 | }; 441 | 442 | #define IEEE80211_FLAGS { \ 443 | { "hidenwid", IEEE80211_F_HIDENWID }, \ 444 | { "nobridge", IEEE80211_F_NOBRIDGE }, \ 445 | { "stayauth", IEEE80211_F_STAYAUTH }, \ 446 | { "nomimo", IEEE80211_F_NOMIMO } \ 447 | } 448 | 449 | #define SIOCG80211FLAGS _IOWR('i', 216, struct ifreq) 450 | #define SIOCS80211FLAGS _IOW('i', 217, struct ifreq) 451 | 452 | int 453 | ieee80211_ioctl_setnwkeys(struct ieee80211com *ic, 454 | const struct ieee80211_nwkey *nwkey); 455 | 456 | int 457 | ieee80211_ioctl_setwpaparms(struct ieee80211com *ic, 458 | const struct ieee80211_wpaparams *wpa); 459 | 460 | int 461 | ieee80211_ioctl_getwpaparms(struct ieee80211com *ic, 462 | struct ieee80211_wpaparams *wpa); 463 | 464 | void 465 | ieee80211_ess_getwpaparms(struct ieee80211_ess *ess, 466 | struct ieee80211_wpaparams *wpa); 467 | 468 | #endif /* _NET80211_IEEE80211_IOCTL_H_ */ 469 | -------------------------------------------------------------------------------- /Black80211/interop.h: -------------------------------------------------------------------------------- 1 | // 2 | // interop.hpp 3 | // itlwm 4 | // 5 | // Created by usrsse2 on 30.07.2020. 6 | // Copyright © 2020 钟先耀. All rights reserved. 7 | // 8 | 9 | #ifndef interop_hpp 10 | #define interop_hpp 11 | 12 | #include 13 | 14 | struct NetworkInformation { 15 | u_int8_t essid[32]; 16 | u_int8_t bssid[6]; 17 | u_int8_t rssi; 18 | u_int16_t capabilities; 19 | u_int16_t beacon_interval; 20 | u_int32_t timestamp; 21 | u_int8_t *rsn_ie; 22 | u_int32_t ie_len; 23 | int channel; 24 | }; 25 | 26 | 27 | class ScanResult : public OSObject { 28 | OSDeclareDefaultStructors(ScanResult) 29 | 30 | public: 31 | virtual bool init() override; 32 | virtual void free() override; 33 | 34 | static ScanResult* scanResult(); 35 | 36 | size_t count; 37 | NetworkInformation *networks; 38 | }; 39 | 40 | 41 | #define APPLE80211_MAX_CHANNELS 64 42 | 43 | struct channel_desc { 44 | uint8_t channel_num; 45 | uint32_t channel_flags; 46 | }; 47 | 48 | class Black80211Device : public IOService { 49 | OSDeclareDefaultStructors(Black80211Device) 50 | 51 | public: 52 | virtual IOReturn getMACAddress(IOEthernetAddress* address) = 0; 53 | virtual void setController(IOEthernetController* io80211controller) = 0; 54 | virtual void setInterface(IOEthernetInterface* interface) = 0; 55 | virtual void enable() = 0; 56 | virtual void disable() = 0; 57 | virtual ScanResult* getScanResult() = 0; 58 | virtual void disassociate() = 0; 59 | virtual IOReturn bgscan(uint8_t* channels, uint32_t length, const char* ssid, uint32_t ssid_len) = 0; 60 | virtual void getESSID(uint8_t essid[32], uint32_t* len) = 0; 61 | virtual void getBSSID(u_int8_t bssid[6]) = 0; 62 | virtual int getChannel() = 0; 63 | virtual int getRate() = 0; 64 | virtual int getMCS() = 0; 65 | virtual int getRSSI() = 0; 66 | virtual int getNoise() = 0; 67 | virtual int getState() = 0; 68 | virtual bool isScanning() = 0; 69 | virtual void getRSNIE(uint16_t &ie_len, uint8_t ie_buf[257]) = 0; 70 | virtual void getSupportedChannels(uint32_t &channels_count, struct channel_desc channel_desc[APPLE80211_MAX_CHANNELS]) = 0; 71 | virtual UInt32 outputPacket(mbuf_t m, void *param) = 0; 72 | virtual IOCommandGate *getCommandGate() const = 0; 73 | virtual const OSString * newVendorString() const = 0; 74 | virtual const OSString * newModelString() const = 0; 75 | virtual void getFirmwareVersion(char version[256], uint16_t &version_len) = 0; 76 | virtual uint32_t getPHYMode() = 0; 77 | virtual uint32_t getSupportedPHYModes() = 0; 78 | virtual uint32_t getOpMode() = 0; 79 | virtual void getCountryCode(char countryCode[3]) = 0; 80 | virtual void getAP_IE_LIST(uint32_t &ie_list_len, uint8_t *ie_buf) = 0; 81 | virtual void setPTK(const u_int8_t *key, size_t key_len) = 0; 82 | virtual void setGTK(const u_int8_t *key, size_t key_len, u_int8_t kid, u_int8_t *rsc) = 0; 83 | virtual void setPMKSA(const u_int8_t *key, size_t key_len) = 0; 84 | virtual void associate(uint8_t *ssid, uint32_t ssid_len, const struct ether_addr& bssid, uint32_t authtype_lower, uint32_t authtype_upper, uint8_t *key, uint32_t key_len, int key_index) = 0; 85 | virtual void setRSN_IE(const u_int8_t *ie) = 0; 86 | }; 87 | 88 | #endif /* interop_hpp */ 89 | -------------------------------------------------------------------------------- /IPSettings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usr-sse2/Black80211-Catalina/b8111411de43540b7d1633f5c8bf8b0b5d94caf9/IPSettings.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /Maps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usr-sse2/Black80211-Catalina/b8111411de43540b7d1633f5c8bf8b0b5d94caf9/Maps.png -------------------------------------------------------------------------------- /NetworkInterfaces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usr-sse2/Black80211-Catalina/b8111411de43540b7d1633f5c8bf8b0b5d94caf9/NetworkInterfaces.png -------------------------------------------------------------------------------- /NetworkMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usr-sse2/Black80211-Catalina/b8111411de43540b7d1633f5c8bf8b0b5d94caf9/NetworkMenu.png -------------------------------------------------------------------------------- /NetworkMenuIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usr-sse2/Black80211-Catalina/b8111411de43540b7d1633f5c8bf8b0b5d94caf9/NetworkMenuIcon.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Archived: now the development is continued directly in https://github.com/OpenIntelWireless/itlwm 2 | 3 | This project joins https://github.com/AppleIntelWifi/Black80211-Catalina and https://github.com/OpenIntelWireless/itlwm to provide a wireless driver for Intel adapters that can be controlled using native ![AirPort](NetworkMenuIcon.png) menu item. 4 | 5 | ![menu](NetworkMenu.png) 6 | 7 | The driver is recognized by the system as a Wi-Fi adapter, not an Ethernet adapter: 8 | 9 | ![profiler](SystemProfiler.png) 10 | 11 | ![interfaces](NetworkInterfaces.png) 12 | 13 | ![ip](IPSettings.png) 14 | 15 | The following actions already work: 16 | - Turning Wi-Fi off and on 17 | - Scanning networks (this also allows Location Services to detect location) 18 | 19 | ![maps](Maps.png) 20 | 21 | - Connecting to Open, WEP Open System, WPA2 Personal and WPA2 Enterprise networks 22 | 23 | The following authentication types are not supported: 24 | - WEP Shared Key 25 | - WPA3 26 | - OWE 27 | 28 | The following has not been tested: 29 | - First-generation WPA Personal and WPA Enterprise 30 | 31 | itlwm should be used from https://github.com/usr-sse2/itlwm 32 | 33 | macOS Catalina and Big Sur are supported. 34 | 35 | ### How to load manually: 36 | put Black80211.kext and itlwm.kext in the same folder 37 | ```bash 38 | sudo chown -R root:wheel *.kext 39 | sudo chmod -R 755 *.kext 40 | sudo kextutil itlwm.kext 41 | sudo kextutil Black80211.kext 42 | ``` 43 | 44 | ### How to load on boot: 45 | - *(Recommended)* the kexts can be injected with this OpenCore 0.6.1. **[SecureBoot](https://dortania.github.io/OpenCore-Post-Install/universal/security/applesecureboot.html) should be enabled** to load the `immutablekernel` which always contains IO80211Family.kext; 46 | - *(Not recommended)* the kexts can be installed to `/Library/Extensions` with System Integrity Protection disabled; 47 | - only in the installer or Recovery the kexts can be injected with regular OpenCore or Clover, because macOS excludes IO80211Family from the `prelinkedkernel` when there are no wireless devices with drivers in system locations. 48 | -------------------------------------------------------------------------------- /SystemProfiler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usr-sse2/Black80211-Catalina/b8111411de43540b7d1633f5c8bf8b0b5d94caf9/SystemProfiler.png -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | TARGETOS := $(shell uname -s) 2 | 3 | ifeq ($(TARGETOS), Darwin) 4 | OSXRELEASE := $(shell uname -r | sed 's/\..*//') 5 | ifeq ($(OSXRELEASE), 17) 6 | OSXVER = HighSierra 7 | endif 8 | ifeq ($(OSXRELEASE), 16) 9 | OSXVER = Sierra 10 | endif 11 | endif 12 | KEXT=DerivedData/Black80211/Build/Products/$(OSXVER)/Debug/Black80211.kext 13 | 14 | ifeq ($(findstring 32,$(BITS)),32) 15 | OPTIONS:=$(OPTIONS) -arch i386 16 | endif 17 | 18 | ifeq ($(findstring 64,$(BITS)),64) 19 | OPTIONS:=$(OPTIONS) -arch x86_64 20 | endif 21 | 22 | .PHONY: all 23 | all: 24 | xcodebuild build $(OPTIONS) -scheme Black80211_$(OSXVER) -configuration Debug 25 | 26 | .PHONY: deps 27 | deps: 28 | sudo kextlibs -xml $(KEXT) 29 | 30 | .PHONY: load 31 | load: 32 | sudo chown -R root:wheel $(KEXT) 33 | sudo kextutil $(KEXT) 34 | 35 | .PHONY: unload 36 | unload: 37 | sudo kextunload $(KEXT) 38 | 39 | .PHONY: clean 40 | clean: 41 | sudo rm -rf $(KEXT) 42 | --------------------------------------------------------------------------------