Merged PR 4101781: Connect detach from ioctl -> code

Connect detach from ioctl -> code
This commit is contained in:
Alan Jowett 2021-02-11 02:33:41 +00:00
Родитель 267668f5f6
Коммит 1a3ff0129b
4 изменённых файлов: 29 добавлений и 6 удалений

Просмотреть файл

@ -144,7 +144,6 @@ EbpfCoreInitDriverObjects(
goto Exit;
}
DbgBreakPoint();
pInit = WdfControlDeviceInitAllocate(
*pDriver,
&SDDL_DEVOBJ_SYS_ALL_ADM_ALL // only kernel/system and admins
@ -569,6 +568,7 @@ EbpfCoreEvtIoDeviceControl(
break;
}
case detach:
status = DetachCodeFromHook(inputBuffer);
break;
default:
break;

Просмотреть файл

@ -11,6 +11,11 @@ typedef unsigned int __u32;
typedef unsigned short __u16;
typedef unsigned char __u8;
static inline __u16 ntohs(__u16 us)
{
return us << 8 | us >> 8;
}
typedef struct xdp_md_
{
__u64 data;
@ -73,11 +78,8 @@ int DropPacket(xdp_md* ctx)
// udp
if (iphdr->Protocol == 17)
{
udphdr = (UDP_HEADER* )((char *)data + sizeof(IPV4_HEADER));
if ((char *)data + sizeof(UDP_HEADER) > (char *)data_end)
goto Done;
if (udphdr->length ==0)
udphdr = (UDP_HEADER* )(iphdr + 1);
if (ntohs(udphdr->length) <= sizeof(UDP_HEADER))
{
rc = 2;
}

Просмотреть файл

@ -167,6 +167,22 @@
<ItemGroup>
<ResourceCompile Include="test.rc" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="bpf_call.o">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<FileType>Document</FileType>
</CopyFileToFolders>
<CopyFileToFolders Include="droppacket.o">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<FileType>Document</FileType>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="bpf.o">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<FileType>Document</FileType>
</CopyFileToFolders>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

Просмотреть файл

@ -38,4 +38,9 @@
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="bpf_call.o" />
<CopyFileToFolders Include="droppacket.o" />
<CopyFileToFolders Include="bpf.o" />
</ItemGroup>
</Project>