Skip to content

Commit

Permalink
Recognize IEEE802.1Q tagged packet, as no many adapters support VLAN …
Browse files Browse the repository at this point in the history
…tag packet sending, no much use for end users, and this code examines the data which lacks efficiency, so I left it commented, the sending part is also unfinished. This code refers to Win10Pcap at https://github.com/SoftEtherVPN/Win10Pcap.
  • Loading branch information
hsluoyz committed Dec 29, 2015
1 parent f749881 commit 156f199
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions packetWin7/npf/npf/Read.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ NPF_TapExForEachOpen(

if (withVlanTag)
{
// Insert a tag in the case of IEEE802.1Q packet
pHeaderBuffer = ExAllocatePoolWithTag(NonPagedPool, fres + 4, 'NPCA');
NdisMoveMappedMemory(pHeaderBuffer, HeaderBuffer, 12);
pHeaderBuffer[12] = 0x81;
Expand Down
41 changes: 41 additions & 0 deletions packetWin7/npf/npf/Write.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,47 @@ NPF_Write(
NPFSetNBLChildOpen(pNetBufferList, Open); //save the child open object in the packets
//SendFlags |= NDIS_SEND_FLAGS_CHECK_FOR_LOOPBACK;

// Recognize IEEE802.1Q tagged packet, as no many adapters support VLAN tag packet sending, no much use for end users,
// and this code examines the data which lacks efficiency, so I left it commented, the sending part is also unfinished.
// This code refers to Win10Pcap at https://github.com/SoftEtherVPN/Win10Pcap.
// if (Open->Loopback == FALSE)
// {
// PUCHAR pHeaderBuffer;
// UINT iFres;
//
// BOOLEAN withVlanTag = FALSE;
// UINT VlanID = 0;
// UINT VlanUserPriority = 0;
// UINT VlanCanFormatID = 0;
//
// NdisQueryMdl(
// Irp->MdlAddress,
// &pHeaderBuffer,
// &iFres,
// NormalPagePriority);
//
// // Determine if the packet is IEEE802.1Q tagged packet.
// if (iFres >= 18)
// {
// if (pHeaderBuffer[12] == 0x81 && pHeaderBuffer[13] == 0x00)
// {
// USHORT pTmpVlanTag = 0;
//
// ((UCHAR *)(&pTmpVlanTag))[0] = pHeaderBuffer[15];
// ((UCHAR *)(&pTmpVlanTag))[1] = pHeaderBuffer[14];
//
// VlanID = pTmpVlanTag & 0x0FFF;
// VlanUserPriority = (pTmpVlanTag >> 13) & 0x07;
// VlanCanFormatID = (pTmpVlanTag >> 12) & 0x01;
//
// if (VlanID != 0)
// {
// withVlanTag = TRUE;
// }
// }
// }
// }

//
// Call the MAC
//
Expand Down

0 comments on commit 156f199

Please sign in to comment.