Skip to content
This repository has been archived by the owner on Dec 6, 2020. It is now read-only.

Commit

Permalink
Compatibility with macOS 11 preview
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Belyaev committed Aug 11, 2020
1 parent 319d97c commit 509d743
Show file tree
Hide file tree
Showing 9 changed files with 210 additions and 2,882 deletions.
169 changes: 150 additions & 19 deletions Black80211.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

27 changes: 12 additions & 15 deletions Black80211/Black80211Control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,8 @@ IONetworkInterface *Black80211Control::createInterface() {

bool Black80211Control::createWorkLoop() {
if(!fWorkloop) {
if (fProvider) {
fWorkloop = fProvider->getWorkLoop();
if (fWorkloop)
fWorkloop->retain();
}
}

fWorkloop = IO80211WorkLoop::workLoop();
}
return (fWorkloop != NULL);
}

Expand All @@ -113,21 +108,23 @@ bool Black80211Control::start(IOService* provider) {
OSSafeReleaseNULL(smc);

IOLog("Black80211: Start\n");
fProvider->setController(this);
if (!super::start(provider)) {
IOLog("Black80211: Failed to call IO80211Controller::start!\n");
createWorkLoop();
if (!fWorkloop) {
IOLog("Black80211: Failed to get workloop!\n");
ReleaseAll();
return false;
}


fProvider->setController(this);

//fWorkloop = (IO80211WorkLoop *)getWorkLoop();
if (!fWorkloop) {
IOLog("Black80211: Failed to get workloop!\n");
if (!super::start(provider)) {
IOLog("Black80211: Failed to call IO80211Controller::start!\n");
ReleaseAll();
return false;
}

fCommandGate = fProvider->getCommandGate();
if (!fCommandGate) {
IOLog("Black80211: Failed to create command gate!\n");
Expand Down
8 changes: 4 additions & 4 deletions Black80211/Black80211Control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ class Black80211Control : public IO80211Controller {
OSDeclareDefaultStructors(Black80211Control)

public:
bool init(OSDictionary* parameters) APPLE_KEXT_OVERRIDE;
void free() APPLE_KEXT_OVERRIDE;
bool start(IOService* provider) APPLE_KEXT_OVERRIDE;
void stop(IOService* provider) APPLE_KEXT_OVERRIDE;
bool init(OSDictionary* parameters) override;
void free() override;
bool start(IOService* provider) override;
void stop(IOService* provider) override;
IOService* probe(IOService* provider, SInt32* score) override;

SInt32 apple80211Request(unsigned int request_type, int request_number, IO80211Interface* interface, void* data) override;
Expand Down
15 changes: 0 additions & 15 deletions Black80211/apple80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,8 @@
#ifndef apple80211_h
#define apple80211_h

#ifdef SIERRA
#include "apple80211/sierra/IO80211Controller.h"
#include "apple80211/sierra/IO80211WorkLoop.h"
#include "apple80211/sierra/IO80211Interface.h"
#endif

#ifdef HIGH_SIERRA
#include "apple80211/high_sierra/IO80211Controller.h"
#include "apple80211/high_sierra/IO80211WorkLoop.h"
#include "apple80211/high_sierra/IO80211Interface.h"
#endif

#ifdef CATALINA
#include "apple80211/catalina/IO80211Controller.h"
#include "apple80211/catalina/IO80211WorkLoop.h"
#include "apple80211/catalina/IO80211Interface.h"
#endif


#endif /* apple80211_h */
105 changes: 30 additions & 75 deletions Black80211/apple80211/catalina/IO80211Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,32 +127,43 @@ class IO80211Controller : public IOEthernetController {
OSDeclareAbstractStructors(IO80211Controller)

public:

virtual void free() override;
virtual bool init(OSDictionary *) override;
virtual IOReturn configureReport(IOReportChannelList *,uint,void *,void *) override;
virtual IOReturn updateReport(IOReportChannelList *,uint,void *,void *) override;
virtual bool start(IOService *) override;
virtual void stop(IOService *) override;
virtual IOService* getProvider(void) const override;
virtual IOWorkLoop* getWorkLoop(void) const override;
virtual const char* stringFromReturn(int) override;
virtual int errnoFromReturn(int) override;
virtual IOOutputQueue* getOutputQueue(void) const override;
virtual bool createWorkLoop(void) override;
virtual IOReturn enable(IONetworkInterface *) override;
virtual IOReturn disable(IONetworkInterface *) override;
virtual bool attachInterface(IONetworkInterface **, bool attach = true) override;
virtual void detachInterface(IONetworkInterface *, bool sync = false) override;
virtual IONetworkInterface* createInterface(void) override;
virtual bool configureInterface(IONetworkInterface *) override;
virtual IOReturn outputStart(IONetworkInterface *,uint);
virtual IOReturn getHardwareAddress(IOEthernetAddress *) override;
virtual void requestPacketTx(void*, uint);

virtual IOReturn getHardwareAddressForInterface(IO80211Interface *,IOEthernetAddress *);
virtual void inputMonitorPacket(mbuf_t,uint,void *,ulong);
virtual int outputRaw80211Packet(IO80211Interface *,mbuf_t);

virtual int outputActionFrame(IO80211Interface *,mbuf_t);

virtual int bpfOutputPacket(OSObject *,uint,mbuf_t);

virtual SInt32 monitorModeSetEnabled(IO80211Interface*, bool, uint);

virtual IO80211Interface* getNetworkInterface(void);

virtual IO80211SkywalkInterface* getPrimarySkywalkInterface(void);

virtual SInt32 apple80211_ioctl(IO80211Interface *, IO80211VirtualInterface*, ifnet_t,ulong,void *);
virtual SInt32 apple80211_ioctl(IO80211SkywalkInterface *,ulong,void *);

virtual SInt32 apple80211_ioctl(IO80211Interface *, ifnet_t,ulong id,void *) { return 0; };


// WTF?
virtual SInt32 apple80211Request(unsigned int, int, IO80211Interface*, void*) = 0;

virtual SInt32 apple80211VirtualRequest(uint,int,IO80211VirtualInterface *,void *);

virtual SInt32 apple80211SkywalkRequest(uint,int,IO80211SkywalkInterface *,void *);
virtual SInt32 stopDMA() { return 0x66; };
virtual UInt32 hardwareOutputQueueDepth(IO80211Interface*) { return 0; };
Expand All @@ -164,70 +175,41 @@ class IO80211Controller : public IOEthernetController {
virtual SInt32 setVirtualHardwareAddress(IO80211VirtualInterface *,ether_addr *);
virtual SInt32 enableVirtualInterface(IO80211VirtualInterface *);
virtual SInt32 disableVirtualInterface(IO80211VirtualInterface *);

virtual bool requiresExplicitMBufRelease() { return false; };
virtual bool flowIdSupported() { return false; };

virtual IO80211FlowQueueLegacy* requestFlowQueue(FlowIdMetadata const*);
virtual void releaseFlowQueue(IO80211FlowQueue *);

virtual void getLogPipes(CCPipe**, CCPipe**, CCPipe**) {};

virtual IOReturn enablePacketTimestamping(void) {
return kIOReturnUnsupported;
}

virtual IOReturn disablePacketTimestamping(void) {
return kIOReturnUnsupported;
}

virtual UInt32 selfDiagnosticsReport(int,char const*,uint);

virtual UInt32 getDataQueueDepth(OSObject *);

#ifdef BIG_SUR
virtual bool isAssociatedToMovingNetwork(void) { return false; }
#endif
virtual mbuf_flags_t inputPacket(mbuf_t);

virtual SInt32 apple80211_ioctl_get(IO80211Interface *,IO80211VirtualInterface *,ifnet_t,void *);

virtual SInt32 apple80211_ioctl_get(IO80211SkywalkInterface *,void *);

virtual SInt32 apple80211_ioctl_set(IO80211Interface *,IO80211VirtualInterface *,IO80211SkywalkInterface *,void *);

virtual SInt32 apple80211_ioctl_set(IO80211SkywalkInterface *,void*);

virtual bool attachInterface(IOSkywalkInterface *,IOService *);


#ifdef BIG_SUR
virtual bool detachInterface(IOSkywalkInterface *, bool);
#endif
virtual IO80211VirtualInterface* createVirtualInterface(ether_addr *,uint);
virtual bool attachVirtualInterface(IO80211VirtualInterface **,ether_addr *,uint,bool);
virtual bool detachVirtualInterface(IO80211VirtualInterface *,bool);

virtual IOReturn enable(IO80211SkywalkInterface *);

virtual IOReturn disable(IO80211SkywalkInterface *);
virtual IOReturn updateReport(IOReportChannelList *,uint,void *,void *) override;
virtual IOReturn configureReport(IOReportChannelList *,uint,void *,void *) override;

virtual void detachInterface(IONetworkInterface *, bool sync = false) APPLE_KEXT_OVERRIDE;
virtual bool attachInterface(IONetworkInterface **, bool attach = true) APPLE_KEXT_OVERRIDE;
virtual void stop(IOService *) override;
virtual void free() override;
virtual bool terminate(unsigned int) APPLE_KEXT_OVERRIDE;
virtual bool init(OSDictionary *) override;
virtual IOService* getProvider(void) const APPLE_KEXT_OVERRIDE;
/*
virtual SInt32 apple80211_ioctl_get(IO80211Interface *,IO80211VirtualInterface *,IO80211SkywalkInterface *,void *) {
return kIOReturnUnsupported;
}
*/

IO80211SkywalkInterface* getInfraInterface(void);
IO80211ScanManager* getPrimaryInterfaceScanManager(void);

IO80211ControllerMonitor* getInterfaceMonitor(void);


IOReturn addReporterLegend(IOService *,IOReporter *,char const*,char const*);
IOReturn addReporterLegend(IOService *,IOReporter *,char const*,char const*);
IOReturn removeReporterFromLegend(IOService *,IOReporter *,char const*,char const*);
IOReturn unlockIOReporterLegend(void);
void lockIOReporterLegend(void);//怀疑对象,之前是返回int
Expand All @@ -239,34 +221,10 @@ class IO80211Controller : public IOEthernetController {
void setIOReportersStreamFlags(ulong long);
void updateIOReportersStreamFrequency(void); //怀疑对象,之前是返回int
void setIOReportersStreamLevel(CCStreamLogLevel);


void powerChangeGated(OSObject *,void *,void *,void *,void *);
int copyOut(void const*,ulong long,ulong);

//modified


SInt32 getASSOCIATE_RESULT(IO80211Interface *,IO80211VirtualInterface *,IO80211SkywalkInterface *,apple80211_assoc_result_data * assoc_result);
virtual int errnoFromReturn(int) override;
virtual const char* stringFromReturn(int) override;

virtual IONetworkInterface* createInterface(void) override;
virtual IOReturn getHardwareAddress(IOEthernetAddress *) override;
virtual IOWorkLoop* getWorkLoop(void) const APPLE_KEXT_OVERRIDE;
virtual bool createWorkLoop(void) override;
virtual IOOutputQueue* getOutputQueue(void) const APPLE_KEXT_OVERRIDE;

virtual bool configureInterface(IONetworkInterface *) override;
virtual IOReturn enable(IONetworkInterface *) override;
virtual IOReturn disable(IONetworkInterface *) override;
virtual bool start(IOService *) override;

//virtual SInt32 apple


virtual IOReturn outputStart(IONetworkInterface *,uint);


/*
virtual IOReturn setChanNoiseFloorLTE(apple80211_stat_report *,int) {
return kIOReturnSuccess;
Expand Down Expand Up @@ -321,7 +279,6 @@ class IO80211Controller : public IOEthernetController {
IOReturn copyIn(ulong long,void *,ulong);
void logIOCTL(apple80211req *);
bool isIOCTLLoggingRestricted(apple80211req *);

bool getBeaconPeriod(apple80211_beacon_period_data *);
SInt32 apple80211VirtualRequestIoctl(uint,int,IO80211VirtualInterface *,void *);
bool getBSSIDData(OSObject *,apple80211_bssid_data *);
Expand Down Expand Up @@ -349,10 +306,8 @@ class IO80211Controller : public IOEthernetController {
void logDebug(ulong long,char const*,...);//怀疑对象,之前是返回int
void vlogDebug(ulong long,char const*,va_list);//怀疑对象,之前是返回char
void logDebug(char const*,...);//怀疑对象,之前是返回int

bool calculateInterfacesCoex(void);
void setInfraChannel(apple80211_channel *);

void configureAntennae(void);
SInt32 apple80211RequestIoctl(uint,int,IO80211Interface *,void *);
UInt32 radioCountForInterface(IO80211Interface *);
Expand Down
20 changes: 10 additions & 10 deletions Black80211/apple80211/catalina/IO80211Interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,21 @@ class IO80211Interface : public IOEthernetInterface
OSDeclareDefaultStructors( IO80211Interface );

public:
virtual bool terminate(unsigned int) APPLE_KEXT_OVERRIDE;
virtual bool attach(IOService*) APPLE_KEXT_OVERRIDE;
virtual void detach(IOService*) APPLE_KEXT_OVERRIDE;
virtual bool init(IONetworkController*) APPLE_KEXT_OVERRIDE;
virtual bool terminate(unsigned int) override;
virtual bool attach(IOService*) override;
virtual void detach(IOService*) override;
virtual bool init(IONetworkController*) override;
virtual IOReturn updateReport(IOReportChannelList *,uint,void *,void *) override;
virtual IOReturn configureReport(IOReportChannelList *,uint,void *,void *) override;
virtual UInt32 inputPacket(mbuf_t packet,
UInt32 length = 0,
IOOptionBits options = 0,
void * param = 0) APPLE_KEXT_OVERRIDE;
virtual bool inputEvent(unsigned int, void*) APPLE_KEXT_OVERRIDE;
virtual IOReturn newUserClient(task_t, void*, UInt32 type, OSDictionary*, IOUserClient**) APPLE_KEXT_OVERRIDE;
virtual SInt32 performCommand(IONetworkController*, unsigned long, void*, void*) APPLE_KEXT_OVERRIDE;
virtual IOReturn attachToDataLinkLayer(IOOptionBits, void*) APPLE_KEXT_OVERRIDE;
virtual void detachFromDataLinkLayer(unsigned int, void*) APPLE_KEXT_OVERRIDE;
void * param = 0) override;
virtual bool inputEvent(unsigned int, void*) override;
virtual IOReturn newUserClient(task_t, void*, UInt32 type, OSDictionary*, IOUserClient**) override;
virtual SInt32 performCommand(IONetworkController*, unsigned long, void*, void*) override;
virtual IOReturn attachToDataLinkLayer(IOOptionBits, void*) override;
virtual void detachFromDataLinkLayer(unsigned int, void*) override;
virtual int errnoFromReturn(int) override;
virtual const char* stringFromReturn(int) override;

Expand Down
8 changes: 4 additions & 4 deletions Black80211/apple80211/catalina/IO80211WorkLoop.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class IO80211WorkLoop : public IOWorkLoop

static IO80211WorkLoop * workLoop();

virtual void openGate() APPLE_KEXT_OVERRIDE;
virtual void closeGate() APPLE_KEXT_OVERRIDE;
virtual int sleepGate( void * event, UInt32 interuptibleType ) APPLE_KEXT_OVERRIDE;
virtual void openGate() override;
virtual void closeGate() override;
virtual int sleepGate( void * event, UInt32 interuptibleType ) override;
virtual int sleepGateDeadline( void * event, UInt32 interuptibleType, AbsoluteTime deadline );
virtual void wakeupGate( void * event, bool oneThread ) APPLE_KEXT_OVERRIDE;
virtual void wakeupGate( void * event, bool oneThread ) override;

};
#endif
Loading

0 comments on commit 509d743

Please sign in to comment.