1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

Auto formatting with AStyle

This commit is contained in:
Evengard 2020-05-11 17:18:55 +03:00
parent 1d6a4d3ec8
commit f627b64264
8 changed files with 727 additions and 640 deletions

View File

@ -591,7 +591,7 @@ void FreeIPC(IPC *ipc)
FreeInterruptManager(ipc->Interrupt);
for (i = 0;i < LIST_NUM(ipc->ArpTable);i++)
for (i = 0; i < LIST_NUM(ipc->ArpTable); i++)
{
IPC_ARP *a = LIST_DATA(ipc->ArpTable, i);
IPCFreeARP(a);
@ -1404,13 +1404,13 @@ void IPCProcessL3EventsEx(IPC *ipc, UINT64 now)
}
else if (protocol == MAC_PROTO_IPV6)
{
PKT* p = ParsePacketUpToICMPv6(b->Buf, b->Size);
PKT *p = ParsePacketUpToICMPv6(b->Buf, b->Size);
if (p != NULL)
{
IP ip_src, ip_dst;
bool ndtProcessed = false;
UCHAR* data = Clone(p->L3.IPv6Header, p->L3.IPv6Header->PayloadLength + sizeof(IPV6_HEADER));
UCHAR *data = Clone(p->L3.IPv6Header, p->L3.IPv6Header->PayloadLength + sizeof(IPV6_HEADER));
IPv6AddrToIP(&ip_src, &p->IPv6HeaderPacketInfo.IPv6Header->SrcAddress);
IPv6AddrToIP(&ip_dst, &p->IPv6HeaderPacketInfo.IPv6Header->DestAddress);
@ -1602,7 +1602,7 @@ void IPCSendIPv4(IPC *ipc, void *data, UINT size)
UINT i;
// Destination
for (i = 0;i < 6;i++)
for (i = 0; i < 6; i++)
{
dest[i] = 0xff;
}
@ -1668,7 +1668,7 @@ void IPCFlushArpTableEx(IPC *ipc, UINT64 now)
now = Tick64();
}
for (i = 0;i < LIST_NUM(ipc->ArpTable);i++)
for (i = 0; i < LIST_NUM(ipc->ArpTable); i++)
{
IPC_ARP *a = LIST_DATA(ipc->ArpTable, i);
bool b = false;
@ -1695,7 +1695,7 @@ void IPCFlushArpTableEx(IPC *ipc, UINT64 now)
if (o != NULL)
{
for (i = 0;i < LIST_NUM(o);i++)
for (i = 0; i < LIST_NUM(o); i++)
{
IPC_ARP *a = LIST_DATA(o, i);
@ -1759,7 +1759,7 @@ void IPCSendIPv4Unicast(IPC *ipc, void *data, UINT size, IP *next_ip)
arp.SrcIP = IPToUINT(&ipc->ClientIPAddress);
arp.TargetIP = IPToUINT(next_ip);
for (i = 0;i < 6;i++)
for (i = 0; i < 6; i++)
{
tmp[i] = 0xff;
}
@ -1782,7 +1782,7 @@ void IPCSendIPv4Unicast(IPC *ipc, void *data, UINT size, IP *next_ip)
}
// Search the ARP table
IPC_ARP *IPCSearchArpTable(LIST* arpTable, IP *ip)
IPC_ARP *IPCSearchArpTable(LIST *arpTable, IP *ip)
{
IPC_ARP t;
IPC_ARP *a;
@ -1939,19 +1939,22 @@ BLOCK *IPCRecvL2(IPC *ipc)
// IPv6 stuff
// Memory management
void IPCIPv6Init(IPC* ipc)
void IPCIPv6Init(IPC *ipc)
{
ipc->IPv6ReceivedQueue = NewQueue();
// The NDT is basically the same as ARP Table with some slight adjustments
ipc->IPv6NeighborTable = NewList(IPCCmpArpTable);
ipc->IPv6RouterAdvs = NewList(NULL);
ipc->IPv6ClientEUI = 0;
ipc->IPv6ServerEUI = 0;
}
void IPCIPv6Free(IPC* ipc)
void IPCIPv6Free(IPC *ipc)
{
UINT i;
for (i = 0; i < LIST_NUM(ipc->IPv6NeighborTable); i++)
{
IPC_ARP* a = LIST_DATA(ipc->IPv6NeighborTable, i);
IPC_ARP *a = LIST_DATA(ipc->IPv6NeighborTable, i);
IPCFreeARP(a);
}
@ -1959,7 +1962,7 @@ void IPCIPv6Free(IPC* ipc)
for (i = 0; i < LIST_NUM(ipc->IPv6RouterAdvs); i++)
{
IPC_IPV6_ROUTER_ADVERTISEMENT* ra = LIST_DATA(ipc->IPv6RouterAdvs, i);
IPC_IPV6_ROUTER_ADVERTISEMENT *ra = LIST_DATA(ipc->IPv6RouterAdvs, i);
Free(ra);
}
@ -1967,7 +1970,7 @@ void IPCIPv6Free(IPC* ipc)
while (true)
{
BLOCK* b = GetNext(ipc->IPv6ReceivedQueue);
BLOCK *b = GetNext(ipc->IPv6ReceivedQueue);
if (b == NULL)
{
break;
@ -1980,13 +1983,13 @@ void IPCIPv6Free(IPC* ipc)
}
// NDT
void IPCIPv6AssociateOnNDT(IPC* ipc, IP* ip, UCHAR* mac_address)
void IPCIPv6AssociateOnNDT(IPC *ipc, IP *ip, UCHAR *mac_address)
{
IPCIPv6AssociateOnNDTEx(ipc, ip, mac_address, false);
}
void IPCIPv6AssociateOnNDTEx(IPC* ipc, IP* ip, UCHAR* mac_address, bool isNeighborAdv)
void IPCIPv6AssociateOnNDTEx(IPC *ipc, IP *ip, UCHAR *mac_address, bool isNeighborAdv)
{
IPC_ARP* a;
IPC_ARP *a;
UINT addrType = 0;
if (ipc == NULL || ip == NULL ||
IsValidUnicastIPAddress6(ip) == false ||
@ -2034,7 +2037,7 @@ void IPCIPv6AssociateOnNDTEx(IPC* ipc, IP* ip, UCHAR* mac_address, bool isNeighb
a->GiveupTime = 0;
while (true)
{
BLOCK* b = GetNext(a->PacketQueue);
BLOCK *b = GetNext(a->PacketQueue);
if (b == NULL)
{
@ -2051,14 +2054,14 @@ void IPCIPv6AssociateOnNDTEx(IPC* ipc, IP* ip, UCHAR* mac_address, bool isNeighb
}
}
void IPCIPv6FlushNDT(IPC* ipc)
void IPCIPv6FlushNDT(IPC *ipc)
{
IPCIPv6FlushNDTEx(ipc, 0);
}
void IPCIPv6FlushNDTEx(IPC* ipc, UINT64 now)
void IPCIPv6FlushNDTEx(IPC *ipc, UINT64 now)
{
UINT i;
LIST* o = NULL;
LIST *o = NULL;
// Validate arguments
if (ipc == NULL)
{
@ -2071,7 +2074,7 @@ void IPCIPv6FlushNDTEx(IPC* ipc, UINT64 now)
for (i = 0; i < LIST_NUM(ipc->IPv6NeighborTable); i++)
{
IPC_ARP* a = LIST_DATA(ipc->IPv6NeighborTable, i);
IPC_ARP *a = LIST_DATA(ipc->IPv6NeighborTable, i);
bool b = false;
if (a->Resolved && a->ExpireTime <= now)
@ -2099,7 +2102,7 @@ void IPCIPv6FlushNDTEx(IPC* ipc, UINT64 now)
{
for (i = 0; i < LIST_NUM(o); i++)
{
IPC_ARP* a = LIST_DATA(o, i);
IPC_ARP *a = LIST_DATA(o, i);
IPCFreeARP(a);
@ -2110,14 +2113,24 @@ void IPCIPv6FlushNDTEx(IPC* ipc, UINT64 now)
}
}
bool IPCIPv6CheckExistingLinkLocal(IPC *ipc, IP *addr)
{
HUB t, *h;
IP_TABLE_ENTRY t, *e;
t.Name = ipc->HubName;
h = Search(ipc->Cedar->HubList, &t);
//h->IpTable
}
// RA
void IPCIPv6AddRouterPrefix(IPC* ipc, ICMPV6_OPTION_LIST* recvPrefix, UCHAR* macAddress, IP* ip)
void IPCIPv6AddRouterPrefix(IPC *ipc, ICMPV6_OPTION_LIST *recvPrefix, UCHAR *macAddress, IP *ip)
{
UINT i;
bool foundPrefix = false;
for (i = 0; i < LIST_NUM(ipc->IPv6RouterAdvs); i++)
{
IPC_IPV6_ROUTER_ADVERTISEMENT* existingRA = LIST_DATA(ipc->IPv6RouterAdvs, i);
IPC_IPV6_ROUTER_ADVERTISEMENT *existingRA = LIST_DATA(ipc->IPv6RouterAdvs, i);
if (Cmp(&recvPrefix->Prefix->Prefix, &existingRA->RoutedPrefix.ipv6_addr, sizeof(IPV6_ADDR)) == 0)
{
foundPrefix = true;
@ -2127,7 +2140,7 @@ void IPCIPv6AddRouterPrefix(IPC* ipc, ICMPV6_OPTION_LIST* recvPrefix, UCHAR* mac
if (!foundPrefix)
{
IPC_IPV6_ROUTER_ADVERTISEMENT* newRA = Malloc(sizeof(IPC_IPV6_ROUTER_ADVERTISEMENT));
IPC_IPV6_ROUTER_ADVERTISEMENT *newRA = Malloc(sizeof(IPC_IPV6_ROUTER_ADVERTISEMENT));
IPv6AddrToIP(&newRA->RoutedPrefix, &recvPrefix->Prefix->Prefix);
IntToSubnetMask6(&newRA->RoutedMask, recvPrefix->Prefix->SubnetLength);
CopyIP(&newRA->RouterAddress, ip);
@ -2137,14 +2150,14 @@ void IPCIPv6AddRouterPrefix(IPC* ipc, ICMPV6_OPTION_LIST* recvPrefix, UCHAR* mac
}
}
bool IPCIPv6CheckUnicastFromRouterPrefix(IPC* ipc, IP* ip, IPC_IPV6_ROUTER_ADVERTISEMENT* matchedRA)
bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVERTISEMENT *matchedRA)
{
UINT i;
IPC_IPV6_ROUTER_ADVERTISEMENT* matchingRA = NULL;
IPC_IPV6_ROUTER_ADVERTISEMENT *matchingRA = NULL;
bool isInPrefix = false;
for (i = 0; i < LIST_NUM(ipc->IPv6RouterAdvs); i++)
{
IPC_IPV6_ROUTER_ADVERTISEMENT* ra = LIST_DATA(ipc->IPv6RouterAdvs, i);
IPC_IPV6_ROUTER_ADVERTISEMENT *ra = LIST_DATA(ipc->IPv6RouterAdvs, i);
isInPrefix = IsInSameNetwork6(ip, &ra->RoutedPrefix, &ra->RoutedMask);
if (isInPrefix)
{
@ -2162,7 +2175,7 @@ bool IPCIPv6CheckUnicastFromRouterPrefix(IPC* ipc, IP* ip, IPC_IPV6_ROUTER_ADVER
}
// Send router solicitation and then eventually populate the info from Router Advertisements
void IPCIPv6SendRouterSolicitation(IPC* ipc)
void IPCIPv6SendRouterSolicitation(IPC *ipc)
{
IP senderIP;
IP destIP;
@ -2202,12 +2215,19 @@ void IPCIPv6SendRouterSolicitation(IPC* ipc)
// The processing should populate the received RAs by itself
IPCProcessL3Events(ipc);
}
// Populating the IPv6 Server EUI for IPV6CP
if (LIST_NUM(ipc->IPv6RouterAdvs) > 0)
{
IPC_IPV6_ROUTER_ADVERTISEMENT *ra = LIST_DATA(ipc->IPv6RouterAdvs, 0);
ipc->IPv6ServerEUI = READ_UINT64(&ra->RouterAddress.ipv6_addr[8]);
}
}
// Data flow
BLOCK* IPCIPv6Recv(IPC* ipc)
BLOCK *IPCIPv6Recv(IPC *ipc)
{
BLOCK* b;
BLOCK *b;
// Validate arguments
if (ipc == NULL)
{
@ -2219,12 +2239,12 @@ BLOCK* IPCIPv6Recv(IPC* ipc)
return b;
}
void IPCIPv6Send(IPC* ipc, void* data, UINT size)
void IPCIPv6Send(IPC *ipc, void *data, UINT size)
{
IP destAddr;
UINT ipv6Type;
UCHAR destMac[6];
IPV6_HEADER* header = data;
IPV6_HEADER *header = data;
IPv6AddrToIP(&destAddr, &header->DestAddress);
@ -2254,7 +2274,7 @@ void IPCIPv6Send(IPC* ipc, void* data, UINT size)
}
}
void IPCIPv6SendWithDestMacAddr(IPC* ipc, void* data, UINT size, UCHAR* dest_mac_addr)
void IPCIPv6SendWithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr)
{
UCHAR tmp[1514];
// Validate arguments
@ -2279,12 +2299,12 @@ void IPCIPv6SendWithDestMacAddr(IPC* ipc, void* data, UINT size, UCHAR* dest_mac
IPCSendL2(ipc, tmp, size + 14);
}
void IPCIPv6SendUnicast(IPC* ipc, void* data, UINT size, IP* next_ip)
void IPCIPv6SendUnicast(IPC *ipc, void *data, UINT size, IP *next_ip)
{
IPC_ARP* ndtMatch;
UCHAR* destMac = NULL;
IPC_ARP *ndtMatch;
UCHAR *destMac = NULL;
IPC_IPV6_ROUTER_ADVERTISEMENT ra;
IPV6_HEADER* header = data;
IPV6_HEADER *header = data;
IP srcIp;
bool isLocal = false;
// First we need to understand if it is a local packet or we should route it through the router
@ -2346,7 +2366,7 @@ void IPCIPv6SendUnicast(IPC* ipc, void* data, UINT size, IP* next_ip)
/// TODO: check if we need to manage NDT manually from here or the client will
/// TODO: send Neighbor Solicitations by itself and we just proxy them
CHAR tmp[MAX_SIZE];
BLOCK* blk = NewBlock(data, size, 0);
BLOCK *blk = NewBlock(data, size, 0);
InsertQueue(ndtMatch->PacketQueue, blk);
IPToStr6(tmp, MAX_SIZE, next_ip);
Debug("We can't send the packet because we don't have IP %s in NDT! Need to send Neighbor Solicitation first... Saving for later send.\n", tmp);

View File

@ -125,9 +125,9 @@ struct IPC
UINT Layer;
// IPv6 stuff
QUEUE* IPv6ReceivedQueue; // IPv6 reception queue
LIST* IPv6NeighborTable; // Neighbor Discovery Table
LIST* IPv6RouterAdvs; // Router offered prefixes
QUEUE *IPv6ReceivedQueue; // IPv6 reception queue
LIST *IPv6NeighborTable; // Neighbor Discovery Table
LIST *IPv6RouterAdvs; // Router offered prefixes
UINT64 IPv6ClientEUI; // The EUI of the client (for the SLAAC autoconf)
UINT64 IPv6ServerEUI; // The EUI of the server (from the RA discovery)
};
@ -173,7 +173,7 @@ IPC_ARP *IPCNewARP(IP *ip, UCHAR *mac_address);
void IPCFreeARP(IPC_ARP *a);
int IPCCmpArpTable(void *p1, void *p2);
void IPCSendIPv4Unicast(IPC *ipc, void *data, UINT size, IP *next_ip);
IPC_ARP *IPCSearchArpTable(LIST* arpTable, IP *ip);
IPC_ARP *IPCSearchArpTable(LIST *arpTable, IP *ip);
void IPCSendIPv4WithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr);
void IPCFlushArpTable(IPC *ipc);
void IPCFlushArpTableEx(IPC *ipc, UINT64 now);
@ -195,22 +195,23 @@ void FreeIPCAsync(IPC_ASYNC *a);
// IPv6 stuff
// Memory management
void IPCIPv6Init(IPC* ipc);
void IPCIPv6Free(IPC* ipc);
void IPCIPv6Init(IPC *ipc);
void IPCIPv6Free(IPC *ipc);
// NDT
void IPCIPv6AssociateOnNDT(IPC* ipc, IP* ip, UCHAR* mac_address);
void IPCIPv6AssociateOnNDTEx(IPC* ipc, IP* ip, UCHAR* mac_address, bool isNeighborAdv);
void IPCIPv6FlushNDT(IPC* ipc);
void IPCIPv6FlushNDTEx(IPC* ipc, UINT64 now);
void IPCIPv6AssociateOnNDT(IPC *ipc, IP *ip, UCHAR *mac_address);
void IPCIPv6AssociateOnNDTEx(IPC *ipc, IP *ip, UCHAR *mac_address, bool isNeighborAdv);
void IPCIPv6FlushNDT(IPC *ipc);
void IPCIPv6FlushNDTEx(IPC *ipc, UINT64 now);
bool IPCIPv6CheckExistingLinkLocal(IPC *ipc, IP *addr);
// RA
void IPCIPv6AddRouterPrefix(IPC* ipc, ICMPV6_OPTION_LIST* recvPrefix, UCHAR* macAddress, IP* ip);
bool IPCIPv6CheckUnicastFromRouterPrefix(IPC* ipc, IP* ip, IPC_IPV6_ROUTER_ADVERTISEMENT* matchedRA);
void IPCIPv6SendRouterSolicitation(IPC* ipc);
void IPCIPv6AddRouterPrefix(IPC *ipc, ICMPV6_OPTION_LIST *recvPrefix, UCHAR *macAddress, IP *ip);
bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVERTISEMENT *matchedRA);
void IPCIPv6SendRouterSolicitation(IPC *ipc);
// Data flow
BLOCK* IPCIPv6Recv(IPC* ipc);
void IPCIPv6Send(IPC* ipc, void* data, UINT size);
void IPCIPv6SendWithDestMacAddr(IPC* ipc, void* data, UINT size, UCHAR* dest_mac_addr);
void IPCIPv6SendUnicast(IPC* ipc, void* data, UINT size, IP* next_ip);
BLOCK *IPCIPv6Recv(IPC *ipc);
void IPCIPv6Send(IPC *ipc, void *data, UINT size);
void IPCIPv6SendWithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr);
void IPCIPv6SendUnicast(IPC *ipc, void *data, UINT size, IP *next_ip);
bool ParseAndExtractMsChapV2InfoFromPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password);

View File

@ -864,7 +864,7 @@ bool PPPProcessLCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req
WHERE;
return false;
}
if (opt->DataSize == sizeof(USHORT) && *((USHORT*)(opt->Data)) == Endian16(PPP_LCP_AUTH_EAP))
if (opt->DataSize == sizeof(USHORT) && *((USHORT *)(opt->Data)) == Endian16(PPP_LCP_AUTH_EAP))
{
// Try to request MS-CHAPv2 then
if (!isAccepted)
@ -877,7 +877,7 @@ bool PPPProcessLCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req
ms_chap_v2_code[2] = PPP_CHAP_ALG_MS_CHAP_V2;
Copy(&offer, ms_chap_v2_code, sizeof(ms_chap_v2_code));
Debug("NACK proto with code = 0x%x, cypher = 0x%x, offered cypher = 0x%x\n", pp->Lcp->Code, *((USHORT*)(opt->Data)), offer);
Debug("NACK proto with code = 0x%x, cypher = 0x%x, offered cypher = 0x%x\n", pp->Lcp->Code, *((USHORT *)(opt->Data)), offer);
Debug("Request MSCHAPv2\n");
Add(c->OptionList, NewPPPOption(PPP_LCP_OPTION_AUTH, &ms_chap_v2_code, sizeof(ms_chap_v2_code)));
if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_LCP, c))
@ -903,7 +903,7 @@ bool PPPProcessLCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req
PPP_LCP *c = NewPPPLCP(PPP_LCP_CODE_REQ, 0);
USHORT proto = Endian16(PPP_LCP_AUTH_PAP);
Copy(&offer, t->Data, t->DataSize > sizeof(UINT64) ? sizeof(UINT64) : t->DataSize);
Debug("NACK proto with code = 0x%x, cypher = 0x%x, offered cypher = 0x%x\n", pp->Lcp->Code, *((USHORT*)(opt->Data)), offer);
Debug("NACK proto with code = 0x%x, cypher = 0x%x, offered cypher = 0x%x\n", pp->Lcp->Code, *((USHORT *)(opt->Data)), offer);
Debug("Request PAP\n");
Add(c->OptionList, NewPPPOption(PPP_LCP_OPTION_AUTH, &proto, sizeof(USHORT)));
if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_LCP, c))
@ -921,14 +921,14 @@ bool PPPProcessLCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req
}
}
else if (opt->DataSize == sizeof(USHORT) && *((USHORT*)(opt->Data)) == Endian16(PPP_LCP_AUTH_PAP))
else if (opt->DataSize == sizeof(USHORT) && *((USHORT *)(opt->Data)) == Endian16(PPP_LCP_AUTH_PAP))
{
// We couldn't agree on auth proto, failing connection
if (!isAccepted)
{
UINT64 offer = 0;
Copy(&offer, t->Data, t->DataSize > sizeof(UINT64) ? sizeof(UINT64) : t->DataSize);
Debug("NACK proto with code = 0x%x, cypher = 0x%x, offered cypher = 0x%x\n", pp->Lcp->Code, *((USHORT*)(opt->Data)), offer);
Debug("NACK proto with code = 0x%x, cypher = 0x%x, offered cypher = 0x%x\n", pp->Lcp->Code, *((USHORT *)(opt->Data)), offer);
Debug("Couldn't agree on auth protocol!\n");
PPPLog(p, "LP_PAP_MSCHAPV2_REJECTED");
PPPSetStatus(p, PPP_STATUS_FAIL);
@ -1265,12 +1265,12 @@ bool PPPProcessLCPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp)
{
case PPP_LCP_OPTION_AUTH:
t->IsSupported = true;
if (t->DataSize == sizeof(USHORT) && *((USHORT*)t->Data) == PPP_LCP_AUTH_EAP && p->AuthProtocol == PPP_UNSPECIFIED)
if (t->DataSize == sizeof(USHORT) && *((USHORT *)t->Data) == PPP_LCP_AUTH_EAP && p->AuthProtocol == PPP_UNSPECIFIED)
{
t->IsAccepted = true;
NegotiatedAuthProto = PPP_PROTOCOL_EAP;
}
else if (t->DataSize == sizeof(USHORT) && *((USHORT*)t->Data) == PPP_LCP_AUTH_PAP && p->AuthProtocol == PPP_UNSPECIFIED)
else if (t->DataSize == sizeof(USHORT) && *((USHORT *)t->Data) == PPP_LCP_AUTH_PAP && p->AuthProtocol == PPP_UNSPECIFIED)
{
t->IsAccepted = true;
NegotiatedAuthProto = PPP_PROTOCOL_PAP;
@ -2675,7 +2675,7 @@ bool PPPParseMSCHAP2ResponsePacket(PPP_SESSION *p, PPP_PACKET *pp)
ipc = NewIPC(p->Cedar, p->ClientSoftwareName, p->Postfix, hub, id, password,
&error_code, &p->ClientIP, p->ClientPort, &p->ServerIP, p->ServerPort,
p->ClientHostname, p->CryptName, false, p->AdjustMss, p->EapClient, NULL,
+ IPC_LAYER_3);
+ IPC_LAYER_3);
if (ipc != NULL)
{
@ -3684,7 +3684,7 @@ void GenerateNtPasswordHash(UCHAR *dst, char *password)
tmp = ZeroMalloc(tmp_size);
for (i = 0;i < len;i++)
for (i = 0; i < len; i++)
{
tmp[i * 2] = password[i];
}
@ -3852,7 +3852,7 @@ char *MsChapV2DoBruteForce(IPC_MSCHAP_V2_AUTHINFO *d, LIST *password_list)
return NULL;
}
for (i = 0;i < LIST_NUM(password_list);i++)
for (i = 0; i < LIST_NUM(password_list); i++)
{
char *s = LIST_DATA(password_list, i);
char tmp[MAX_SIZE];
@ -3864,7 +3864,7 @@ char *MsChapV2DoBruteForce(IPC_MSCHAP_V2_AUTHINFO *d, LIST *password_list)
len = StrLen(tmp);
max = Power(2, MIN(len, 9));
for (j = 0;j < max;j++)
for (j = 0; j < max; j++)
{
SetStrCaseAccordingToBits(tmp, j);
if (MsChapV2VerityPassword(d, tmp))

File diff suppressed because it is too large Load Diff

View File

@ -357,7 +357,7 @@ typedef struct SOCKLIST
// Parameters for timeout thread for Solaris
typedef struct SOCKET_TIMEOUT_PARAM{
typedef struct SOCKET_TIMEOUT_PARAM {
SOCK *sock;
CANCEL *cancel;
THREAD *thread;
@ -1303,13 +1303,13 @@ bool IsInSameNetwork4(IP *a1, IP *a2, IP *subnet);
bool IsInSameNetwork4Standard(IP *a1, IP *a2);
// Utility functions about IP and MAC address types
bool IsValidUnicastIPAddress4(IP* ip);
bool IsValidUnicastIPAddress4(IP *ip);
bool IsValidUnicastIPAddressUINT4(UINT ip);
bool IsValidUnicastIPAddress6(IP* ip);
bool IsMacUnicast(UCHAR* mac);
bool IsMacBroadcast(UCHAR* mac);
bool IsMacMulticast(UCHAR* mac);
bool IsMacInvalid(UCHAR* mac);
bool IsValidUnicastIPAddress6(IP *ip);
bool IsMacUnicast(UCHAR *mac);
bool IsMacBroadcast(UCHAR *mac);
bool IsMacMulticast(UCHAR *mac);
bool IsMacInvalid(UCHAR *mac);
bool ParseIpAndSubnetMask4(char *src, UINT *ip, UINT *mask);
bool ParseIpAndSubnetMask46(char *src, IP *ip, IP *mask);

View File

@ -804,7 +804,7 @@ bool VLanRemoveTag(void **packet_data, UINT *packet_size, UINT vlan_id, UINT vla
UINT dest_size = src_size - 4;
UINT i;
for (i = 12;i < dest_size;i++)
for (i = 12; i < dest_size; i++)
{
src_data[i] = src_data[i + 4];
}
@ -889,7 +889,7 @@ BUF *BuildICMPv6NeighborSoliciation(IPV6_ADDR *src_ip, IPV6_ADDR *target_ip, UCH
return ret;
}
BUF *BuildICMPv6RouterSoliciation(IPV6_ADDR* src_ip, IPV6_ADDR* target_ip, UCHAR* my_mac_address, UINT id)
BUF *BuildICMPv6RouterSoliciation(IPV6_ADDR *src_ip, IPV6_ADDR *target_ip, UCHAR *my_mac_address, UINT id)
{
ICMPV6_OPTION_LIST opt;
ICMPV6_OPTION_LINK_LAYER link;
@ -1491,7 +1491,7 @@ PKT *ClonePacket(PKT *p, bool copy_data)
}
// Parse the packet but without data layer except for ICMP
PKT* ParsePacketUpToICMPv6(UCHAR* buf, UINT size)
PKT *ParsePacketUpToICMPv6(UCHAR *buf, UINT size)
{
return ParsePacketEx5(buf, size, false, 0, true, true, false, true);
}
@ -1513,11 +1513,11 @@ PKT *ParsePacketEx3(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool b
{
return ParsePacketEx4(buf, size, no_l3, vlan_type_id, bridge_id_as_mac_address, false, false);
}
PKT* ParsePacketEx4(UCHAR* buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum)
PKT *ParsePacketEx4(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum)
{
return ParsePacketEx5(buf, size, no_l3, vlan_type_id, bridge_id_as_mac_address, no_http, correct_checksum, false);
}
PKT* ParsePacketEx5(UCHAR* buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum, bool no_l3_l4_except_icmpv6)
PKT *ParsePacketEx5(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum, bool no_l3_l4_except_icmpv6)
{
PKT *p;
USHORT vlan_type_id_16;
@ -2004,7 +2004,7 @@ bool ParsePacketL2Ex(PKT *p, UCHAR *buf, UINT size, bool no_l3, bool no_l3_l4_ex
p->BroadcastPacket = true;
b1 = true;
b2 = true;
for (i = 0;i < 6;i++)
for (i = 0; i < 6; i++)
{
if (p->MacHeader->DestAddress[i] != 0xff)
{
@ -3303,7 +3303,7 @@ BUF *BuildDhcpOptionsBuf(LIST *o)
}
b = NewBuf();
for (i = 0;i < LIST_NUM(o);i++)
for (i = 0; i < LIST_NUM(o); i++)
{
DHCP_OPTION *d = LIST_DATA(o, i);
UINT current_size = d->Size;
@ -3612,7 +3612,7 @@ void BuildClasslessRouteTableStr(char *str, UINT str_size, DHCP_CLASSLESS_ROUTE_
return;
}
for (i = 0;i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES;i++)
for (i = 0; i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES; i++)
{
DHCP_CLASSLESS_ROUTE *r = &t->Entries[i];
@ -3684,7 +3684,7 @@ bool ParseClasslessRouteTableStr(DHCP_CLASSLESS_ROUTE_TABLE *d, char *str)
{
UINT i;
for (i = 0;i < t->NumTokens;i++)
for (i = 0; i < t->NumTokens; i++)
{
DHCP_CLASSLESS_ROUTE r;
@ -3784,7 +3784,7 @@ BUF *DhcpBuildClasslessRouteData(DHCP_CLASSLESS_ROUTE_TABLE *t)
b = NewBuf();
for (i = 0;i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES;i++)
for (i = 0; i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES; i++)
{
DHCP_CLASSLESS_ROUTE *r = &t->Entries[i];
@ -3883,7 +3883,7 @@ void DhcpParseClasslessRouteData(DHCP_CLASSLESS_ROUTE_TABLE *t, void *data, UINT
Copy(&r.SubnetMask, &mask, sizeof(IP));
r.SubnetMaskLen = subnet_mask_len;
for (i = 0;i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES;i++)
for (i = 0; i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES; i++)
{
if (Cmp(&t->Entries[i], &r, sizeof(DHCP_CLASSLESS_ROUTE)) == 0)
{
@ -3919,7 +3919,7 @@ DHCP_OPTION *GetDhcpOption(LIST *o, UINT id)
return NULL;
}
for (i = 0;i < LIST_NUM(o);i++)
for (i = 0; i < LIST_NUM(o); i++)
{
DHCP_OPTION *opt = LIST_DATA(o, i);
if (opt->Id == id)
@ -3947,7 +3947,7 @@ DHCP_CLASSLESS_ROUTE *GetBestClasslessRoute(DHCP_CLASSLESS_ROUTE_TABLE *t, IP *i
return NULL;
}
for (i = 0;i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES;i++)
for (i = 0; i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES; i++)
{
DHCP_CLASSLESS_ROUTE *e = &t->Entries[i];
@ -3977,7 +3977,7 @@ void FreeDhcpOptions(LIST *o)
return;
}
for (i = 0;i < LIST_NUM(o);i++)
for (i = 0; i < LIST_NUM(o); i++)
{
DHCP_OPTION *opt = LIST_DATA(o, i);
Free(opt->Data);
@ -4183,7 +4183,7 @@ BUF *DhcpModify(DHCP_MODIFY_OPTION *m, void *data, UINT size)
// Rebuilding the options list
opt_list2 = NewListFast(NULL);
for (i = 0;i < LIST_NUM(opt_list);i++)
for (i = 0; i < LIST_NUM(opt_list); i++)
{
DHCP_OPTION *o = LIST_DATA(opt_list, i);
DHCP_OPTION *o2 = NULL;

View File

@ -745,8 +745,8 @@ PKT *ParsePacketEx(UCHAR *buf, UINT size, bool no_l3);
PKT *ParsePacketEx2(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id);
PKT *ParsePacketEx3(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address);
PKT *ParsePacketEx4(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum);
PKT* ParsePacketEx5(UCHAR* buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum, bool no_l3_l4_except_icmpv6);
PKT* ParsePacketUpToICMPv6(UCHAR* buf, UINT size);
PKT *ParsePacketEx5(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum, bool no_l3_l4_except_icmpv6);
PKT *ParsePacketUpToICMPv6(UCHAR *buf, UINT size);
void FreePacket(PKT *p);
void FreePacketWithData(PKT *p);
void FreePacketIPv4(PKT *p);
@ -788,7 +788,7 @@ BUF *BuildIPv6PacketHeader(IPV6_HEADER_PACKET_INFO *info, UINT *bytes_before_pay
UCHAR IPv6GetNextHeaderFromQueue(QUEUE *q);
void BuildAndAddIPv6PacketOptionHeader(BUF *b, IPV6_OPTION_HEADER *opt, UCHAR next_header, UINT size);
BUF *BuildICMPv6NeighborSoliciation(IPV6_ADDR *src_ip, IPV6_ADDR *target_ip, UCHAR *my_mac_address, UINT id);
BUF *BuildICMPv6RouterSoliciation(IPV6_ADDR* src_ip, IPV6_ADDR* target_ip, UCHAR* my_mac_address, UINT id);
BUF *BuildICMPv6RouterSoliciation(IPV6_ADDR *src_ip, IPV6_ADDR *target_ip, UCHAR *my_mac_address, UINT id);
BUF *BuildICMPv6(IPV6_ADDR *src_ip, IPV6_ADDR *dest_ip, UCHAR hop_limit, UCHAR type, UCHAR code, void *data, UINT size, UINT id);
bool VLanRemoveTag(void **packet_data, UINT *packet_size, UINT vlan_id, UINT vlan_tpid);