mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-30 09:48:54 +00:00
More tap driver cleanup, and add IOCTL to get L2 multicast ethernet address subscriptions.
This commit is contained in:
parent
fbb40b98ad
commit
3375363d93
@ -4,7 +4,7 @@ Class=Net
|
||||
ClassGuid={4d36e972-e325-11ce-bfc1-08002be10318}
|
||||
Provider=%Provider%
|
||||
CatalogFile=ztTap100.cat
|
||||
DriverVer=08/24/2013,16.12.30.608
|
||||
DriverVer=01/20/2014,14.30.21.864
|
||||
|
||||
|
||||
[Strings]
|
||||
|
Binary file not shown.
BIN
ext/bin/tap-windows/x64/zttap100.cat
Normal file
BIN
ext/bin/tap-windows/x64/zttap100.cat
Normal file
Binary file not shown.
@ -4,7 +4,7 @@ Class=Net
|
||||
ClassGuid={4d36e972-e325-11ce-bfc1-08002be10318}
|
||||
Provider=%Provider%
|
||||
CatalogFile=ztTap100.cat
|
||||
DriverVer=08/24/2013,16.12.37.14
|
||||
DriverVer=01/20/2014,14.30.31.745
|
||||
|
||||
|
||||
[Strings]
|
||||
|
Binary file not shown.
BIN
ext/bin/tap-windows/x86/zttap100.cat
Normal file
BIN
ext/bin/tap-windows/x86/zttap100.cat
Normal file
Binary file not shown.
@ -124,7 +124,9 @@
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'">
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
|
||||
<EnableDeployment>False</EnableDeployment>
|
||||
@ -139,6 +141,21 @@
|
||||
<VerifyFlags>133563</VerifyFlags>
|
||||
<PackageDir>$(OutDir)TapDriver Package</PackageDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'">
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@ -147,8 +164,43 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TapDriver\TapDriver.vcxproj">
|
||||
<Project>{689210b1-467c-4850-bb7d-2e10d5b4a3da}</Project>
|
||||
<Private>true</Private>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Build\Win32\VistaRelease\ztTap100.sys">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Debug|Win32'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Release|Win32'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">true</ExcludedFromBuild>
|
||||
</None>
|
||||
<None Include="..\Build\x64\VistaRelease\ztTap100.sys">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">false</ExcludedFromBuild>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
@ -6,4 +6,12 @@
|
||||
<Extensions>inf;inv;inx;mof;mc;</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Build\x64\VistaRelease\ztTap100.sys">
|
||||
<Filter>Driver Files</Filter>
|
||||
</None>
|
||||
<None Include="..\Build\Win32\VistaRelease\ztTap100.sys">
|
||||
<Filter>Driver Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -127,6 +127,7 @@
|
||||
<TargetName>ztTap100</TargetName>
|
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir>
|
||||
<IntDir>$(Platform)\$(ConfigurationName)\</IntDir>
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
|
||||
@ -135,50 +136,61 @@
|
||||
<TargetName>ztTap100</TargetName>
|
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir>
|
||||
<IntDir>$(Platform)\$(ConfigurationName)\</IntDir>
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Vista Release|Win32'">
|
||||
<TargetName>ztTap100</TargetName>
|
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir>
|
||||
<IntDir>$(Platform)\$(ConfigurationName)\</IntDir>
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'">
|
||||
<TargetName>ztTap100</TargetName>
|
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir>
|
||||
<IntDir>$(Platform)\$(ConfigurationName)\</IntDir>
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'">
|
||||
<TargetName>ztTap100</TargetName>
|
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir>
|
||||
<IntDir>$(Platform)\$(ConfigurationName)\</IntDir>
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'">
|
||||
<TargetName>ztTap100</TargetName>
|
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir>
|
||||
<IntDir>$(Platform)\$(ConfigurationName)\</IntDir>
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Vista Debug|x64'">
|
||||
<TargetName>ztTap100</TargetName>
|
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir>
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">
|
||||
<TargetName>ztTap100</TargetName>
|
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir>
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Vista Release|x64'">
|
||||
<TargetName>ztTap100</TargetName>
|
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir>
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">
|
||||
<TargetName>ztTap100</TargetName>
|
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir>
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">
|
||||
<TargetName>ztTap100</TargetName>
|
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir>
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">
|
||||
<TargetName>ztTap100</TargetName>
|
||||
<OutDir>$(SolutionDir)\Build\$(Platform)\$(ConfigurationName)\</OutDir>
|
||||
<TimeStampServer>http://timestamp.digicert.com/</TimeStampServer>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define PRODUCT_TAP_WIN_MINOR 0
|
||||
#define PRODUCT_TAP_WIN_PROVIDER "ZeroTier Networks"
|
||||
#define PRODUCT_TAP_WIN_DEVICE_DESCRIPTION PRODUCT_NAME
|
||||
#define PRODUCT_TAP_WIN_RELDATE "08/01/2013"
|
||||
#define PRODUCT_TAP_WIN_RELDATE "01/20/2014"
|
||||
|
||||
#define TAP_DRIVER_MAJOR_VERSION PRODUCT_TAP_WIN_MAJOR
|
||||
#define TAP_DRIVER_MINOR_VERSION PRODUCT_TAP_WIN_MINOR
|
||||
|
@ -40,7 +40,7 @@
|
||||
#define ETHERNET_PACKET_SIZE (ETHERNET_MTU + ETHERNET_HEADER_SIZE)
|
||||
#define DEFAULT_PACKET_LOOKAHEAD (ETHERNET_PACKET_SIZE)
|
||||
|
||||
#define NIC_MAX_MCAST_LIST 32 // Max length of multicast address list
|
||||
#define NIC_MAX_MCAST_LIST 128 // Max length of multicast address list
|
||||
|
||||
#define MINIMUM_MTU 576 // USE TCP Minimum MTU
|
||||
#define MAXIMUM_MTU 65536 // IP maximum MTU
|
||||
|
@ -28,12 +28,7 @@
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
#define IP_HEADER_SIZE 20
|
||||
#define IPV6_HEADER_SIZE 40
|
||||
|
||||
typedef unsigned char MACADDR [6];
|
||||
typedef unsigned long IPADDR;
|
||||
typedef unsigned char IPV6ADDR [16];
|
||||
|
||||
//-----------------
|
||||
// Ethernet address
|
||||
@ -62,163 +57,4 @@ typedef struct
|
||||
USHORT proto; /* packet type ID field */
|
||||
} ETH_HEADER, *PETH_HEADER;
|
||||
|
||||
//----------------
|
||||
// ARP packet
|
||||
//----------------
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MACADDR m_MAC_Destination; // Reverse these two
|
||||
MACADDR m_MAC_Source; // to answer ARP requests
|
||||
USHORT m_Proto; // 0x0806
|
||||
|
||||
# define MAC_ADDR_TYPE 0x0001
|
||||
USHORT m_MAC_AddressType; // 0x0001
|
||||
|
||||
USHORT m_PROTO_AddressType; // 0x0800
|
||||
UCHAR m_MAC_AddressSize; // 0x06
|
||||
UCHAR m_PROTO_AddressSize; // 0x04
|
||||
|
||||
# define ARP_REQUEST 0x0001
|
||||
# define ARP_REPLY 0x0002
|
||||
USHORT m_ARP_Operation; // 0x0001 for ARP request, 0x0002 for ARP reply
|
||||
|
||||
MACADDR m_ARP_MAC_Source;
|
||||
IPADDR m_ARP_IP_Source;
|
||||
MACADDR m_ARP_MAC_Destination;
|
||||
IPADDR m_ARP_IP_Destination;
|
||||
}
|
||||
ARP_PACKET, *PARP_PACKET;
|
||||
|
||||
//----------
|
||||
// IP Header
|
||||
//----------
|
||||
|
||||
typedef struct {
|
||||
# define IPH_GET_VER(v) (((v) >> 4) & 0x0F)
|
||||
# define IPH_GET_LEN(v) (((v) & 0x0F) << 2)
|
||||
UCHAR version_len;
|
||||
|
||||
UCHAR tos;
|
||||
USHORT tot_len;
|
||||
USHORT id;
|
||||
|
||||
# define IP_OFFMASK 0x1fff
|
||||
USHORT frag_off;
|
||||
|
||||
UCHAR ttl;
|
||||
|
||||
# define IPPROTO_UDP 17 /* UDP protocol */
|
||||
# define IPPROTO_TCP 6 /* TCP protocol */
|
||||
# define IPPROTO_ICMP 1 /* ICMP protocol */
|
||||
# define IPPROTO_IGMP 2 /* IGMP protocol */
|
||||
UCHAR protocol;
|
||||
|
||||
USHORT check;
|
||||
ULONG saddr;
|
||||
ULONG daddr;
|
||||
/* The options start here. */
|
||||
} IPHDR;
|
||||
|
||||
//-----------
|
||||
// UDP header
|
||||
//-----------
|
||||
|
||||
typedef struct {
|
||||
USHORT source;
|
||||
USHORT dest;
|
||||
USHORT len;
|
||||
USHORT check;
|
||||
} UDPHDR;
|
||||
|
||||
//--------------------------
|
||||
// TCP header, per RFC 793.
|
||||
//--------------------------
|
||||
|
||||
typedef struct {
|
||||
USHORT source; /* source port */
|
||||
USHORT dest; /* destination port */
|
||||
ULONG seq; /* sequence number */
|
||||
ULONG ack_seq; /* acknowledgement number */
|
||||
|
||||
# define TCPH_GET_DOFF(d) (((d) & 0xF0) >> 2)
|
||||
UCHAR doff_res;
|
||||
|
||||
# define TCPH_FIN_MASK (1<<0)
|
||||
# define TCPH_SYN_MASK (1<<1)
|
||||
# define TCPH_RST_MASK (1<<2)
|
||||
# define TCPH_PSH_MASK (1<<3)
|
||||
# define TCPH_ACK_MASK (1<<4)
|
||||
# define TCPH_URG_MASK (1<<5)
|
||||
# define TCPH_ECE_MASK (1<<6)
|
||||
# define TCPH_CWR_MASK (1<<7)
|
||||
UCHAR flags;
|
||||
|
||||
USHORT window;
|
||||
USHORT check;
|
||||
USHORT urg_ptr;
|
||||
} TCPHDR;
|
||||
|
||||
#define TCPOPT_EOL 0
|
||||
#define TCPOPT_NOP 1
|
||||
#define TCPOPT_MAXSEG 2
|
||||
#define TCPOLEN_MAXSEG 4
|
||||
|
||||
//------------
|
||||
// IPv6 Header
|
||||
//------------
|
||||
|
||||
typedef struct {
|
||||
UCHAR version_prio;
|
||||
UCHAR flow_lbl[3];
|
||||
USHORT payload_len;
|
||||
# define IPPROTO_ICMPV6 0x3a /* ICMP protocol v6 */
|
||||
UCHAR nexthdr;
|
||||
UCHAR hop_limit;
|
||||
IPV6ADDR saddr;
|
||||
IPV6ADDR daddr;
|
||||
} IPV6HDR;
|
||||
|
||||
//--------------------------------------------
|
||||
// IPCMPv6 NS/NA Packets (RFC4443 and RFC4861)
|
||||
//--------------------------------------------
|
||||
|
||||
// Neighbor Solictiation - RFC 4861, 4.3
|
||||
// (this is just the ICMPv6 part of the packet)
|
||||
typedef struct {
|
||||
UCHAR type;
|
||||
# define ICMPV6_TYPE_NS 135 // neighbour solicitation
|
||||
UCHAR code;
|
||||
# define ICMPV6_CODE_0 0 // no specific sub-code for NS/NA
|
||||
USHORT checksum;
|
||||
ULONG reserved;
|
||||
IPV6ADDR target_addr;
|
||||
} ICMPV6_NS;
|
||||
|
||||
// Neighbor Advertisement - RFC 4861, 4.4 + 4.6/4.6.1
|
||||
// (this is just the ICMPv6 payload)
|
||||
typedef struct {
|
||||
UCHAR type;
|
||||
# define ICMPV6_TYPE_NA 136 // neighbour advertisement
|
||||
UCHAR code;
|
||||
# define ICMPV6_CODE_0 0 // no specific sub-code for NS/NA
|
||||
USHORT checksum;
|
||||
UCHAR rso_bits; // Router(0), Solicited(2), Ovrrd(4)
|
||||
UCHAR reserved[3];
|
||||
IPV6ADDR target_addr;
|
||||
// always include "Target Link-layer Address" option (RFC 4861 4.6.1)
|
||||
UCHAR opt_type;
|
||||
#define ICMPV6_OPTION_TLLA 2
|
||||
UCHAR opt_length;
|
||||
#define ICMPV6_LENGTH_TLLA 1 // multiplied by 8 -> 1 = 8 bytes
|
||||
MACADDR target_macaddr;
|
||||
} ICMPV6_NA;
|
||||
|
||||
// this is the complete packet with Ethernet and IPv6 headers
|
||||
typedef struct {
|
||||
ETH_HEADER eth;
|
||||
IPV6HDR ipv6;
|
||||
ICMPV6_NA icmpv6;
|
||||
} ICMPV6_NA_PKT;
|
||||
|
||||
#pragma pack()
|
||||
|
@ -146,58 +146,12 @@ VOID FlushQueues
|
||||
TapExtensionPointer p_Extension
|
||||
);
|
||||
|
||||
VOID ResetTapAdapterState
|
||||
(
|
||||
TapAdapterPointer p_Adapter
|
||||
);
|
||||
|
||||
BOOLEAN ProcessARP
|
||||
(
|
||||
TapAdapterPointer p_Adapter,
|
||||
const PARP_PACKET src,
|
||||
const IPADDR adapter_ip,
|
||||
const IPADDR ip_network,
|
||||
const IPADDR ip_netmask,
|
||||
const MACADDR mac
|
||||
);
|
||||
|
||||
VOID SetMediaStatus
|
||||
(
|
||||
TapAdapterPointer p_Adapter,
|
||||
BOOLEAN state
|
||||
);
|
||||
|
||||
VOID InjectPacketDeferred
|
||||
(
|
||||
TapAdapterPointer p_Adapter,
|
||||
UCHAR *packet,
|
||||
const unsigned int len
|
||||
);
|
||||
|
||||
VOID InjectPacketNow
|
||||
(
|
||||
TapAdapterPointer p_Adapter,
|
||||
UCHAR *packet,
|
||||
const unsigned int len
|
||||
);
|
||||
|
||||
// for KDEFERRED_ROUTINE and Static Driver Verifier
|
||||
//#include <wdm.h>
|
||||
//KDEFERRED_ROUTINE InjectPacketDpc;
|
||||
|
||||
VOID InjectPacketDpc
|
||||
(
|
||||
KDPC *Dpc,
|
||||
PVOID DeferredContext,
|
||||
PVOID SystemArgument1,
|
||||
PVOID SystemArgument2
|
||||
);
|
||||
|
||||
VOID CheckIfDhcpAndTunMode
|
||||
(
|
||||
TapAdapterPointer p_Adapter
|
||||
);
|
||||
|
||||
VOID HookDispatchFunctions();
|
||||
|
||||
struct WIN2K_NDIS_MINIPORT_BLOCK
|
||||
@ -206,17 +160,4 @@ struct WIN2K_NDIS_MINIPORT_BLOCK
|
||||
UNICODE_STRING MiniportName; // how mini-port refers to us
|
||||
};
|
||||
|
||||
#if PACKET_TRUNCATION_CHECK
|
||||
|
||||
VOID IPv4PacketSizeVerify
|
||||
(
|
||||
const UCHAR *data,
|
||||
ULONG length,
|
||||
BOOLEAN tun,
|
||||
const char *prefix,
|
||||
LONG *counter
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -38,6 +38,13 @@
|
||||
#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED)
|
||||
#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED)
|
||||
#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED)
|
||||
#define TAP_WIN_IOCTL_GET_MULTICAST_MEMBERSHIPS TAP_WIN_CONTROL_CODE (11, METHOD_BUFFERED)
|
||||
|
||||
// Must be the same as NIC_MAX_MCAST_LIST in constants.h
|
||||
#define TAP_MAX_MCAST_LIST 128
|
||||
|
||||
// Amount of memory that must be provided to ioctl TAP_WIN_IOCTL_GET_MULTICAST_MEMBERSHIPS
|
||||
#define TAP_WIN_IOCTL_GET_MULTICAST_MEMBERSHIPS_OUTPUT_BUF_SIZE (TAP_MAX_MCAST_LIST * 6)
|
||||
|
||||
/*
|
||||
* =================
|
||||
|
@ -1523,6 +1523,7 @@ NTSTATUS
|
||||
PIO_STACK_LOCATION l_IrpSp;
|
||||
NTSTATUS l_Status = STATUS_SUCCESS;
|
||||
BOOLEAN accessible;
|
||||
ULONG i,j;
|
||||
|
||||
l_IrpSp = IoGetCurrentIrpStackLocation (p_IRP);
|
||||
|
||||
@ -1633,6 +1634,39 @@ NTSTATUS
|
||||
}
|
||||
#endif
|
||||
|
||||
// Allow ZeroTier One to get multicast memberships at the L2 level in a
|
||||
// protocol-neutral manner.
|
||||
case TAP_WIN_IOCTL_GET_MULTICAST_MEMBERSHIPS:
|
||||
{
|
||||
if (&l_Adapter->m_MCLockAllocated)
|
||||
NdisAcquireSpinLock (&l_Adapter->m_MCLock);
|
||||
if (l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength < TAP_WIN_IOCTL_GET_MULTICAST_MEMBERSHIPS_OUTPUT_BUF_SIZE) {
|
||||
/* output buffer too small */
|
||||
NOTE_ERROR ();
|
||||
p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
|
||||
} else {
|
||||
char *out = (char *)p_IRP->AssociatedIrp.SystemBuffer;
|
||||
char *end = out + TAP_WIN_IOCTL_GET_MULTICAST_MEMBERSHIPS_OUTPUT_BUF_SIZE;
|
||||
for(i=0;i<l_Adapter->m_MCListSize;++i) {
|
||||
if (i >= TAP_MAX_MCAST_LIST)
|
||||
break;
|
||||
for(j=0;j<6;++j)
|
||||
*(out++) = l_Adapter->m_MCList.list[i].addr[j];
|
||||
if (out >= end)
|
||||
break;
|
||||
}
|
||||
while (out < end)
|
||||
*(out++) = (char)0;
|
||||
p_IRP->IoStatus.Information
|
||||
= l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
|
||||
p_IRP->IoStatus.Status = l_Status = STATUS_SUCCESS;
|
||||
}
|
||||
if (&l_Adapter->m_MCLockAllocated)
|
||||
NdisReleaseSpinLock (&l_Adapter->m_MCLock);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case TAP_WIN_IOCTL_SET_MEDIA_STATUS:
|
||||
{
|
||||
if (l_IrpSp->Parameters.DeviceIoControl.InputBufferLength >=
|
||||
|
@ -82,14 +82,6 @@ typedef struct _TapExtension
|
||||
// Flags
|
||||
BOOLEAN m_TapIsRunning;
|
||||
BOOLEAN m_CalledTapDeviceFreeResources;
|
||||
|
||||
#if 0
|
||||
// DPC queue for deferred packet injection
|
||||
BOOLEAN m_InjectDpcInitialized;
|
||||
KDPC m_InjectDpc;
|
||||
NDIS_SPIN_LOCK m_InjectLock;
|
||||
Queue *m_InjectQueue;
|
||||
#endif
|
||||
}
|
||||
TapExtension, *TapExtensionPointer;
|
||||
|
||||
@ -103,17 +95,6 @@ typedef struct _TapPacket
|
||||
}
|
||||
TapPacket, *TapPacketPointer;
|
||||
|
||||
#if 0
|
||||
typedef struct _InjectPacket
|
||||
{
|
||||
# define INJECT_PACKET_SIZE(data_size) (sizeof (InjectPacket) + (data_size))
|
||||
# define INJECT_PACKET_FREE(ib) NdisFreeMemory ((ib), INJECT_PACKET_SIZE ((ib)->m_Size), 0)
|
||||
ULONG m_Size;
|
||||
UCHAR m_Data []; // m_Data must be the last struct member
|
||||
}
|
||||
InjectPacket, *InjectPacketPointer;
|
||||
#endif
|
||||
|
||||
typedef struct _TapAdapter
|
||||
{
|
||||
# define NAME(a) ((a)->m_NameAnsi.Buffer)
|
||||
@ -122,9 +103,6 @@ typedef struct _TapAdapter
|
||||
BOOLEAN m_InterfaceIsRunning;
|
||||
NDIS_HANDLE m_MiniportAdapterHandle;
|
||||
LONG m_Rx, m_Tx, m_RxErr, m_TxErr;
|
||||
#if PACKET_TRUNCATION_CHECK
|
||||
LONG m_RxTrunc, m_TxTrunc;
|
||||
#endif
|
||||
NDIS_MEDIUM m_Medium;
|
||||
ULONG m_Lookahead;
|
||||
ULONG m_MTU;
|
||||
|
Loading…
Reference in New Issue
Block a user