mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-01-14 00:26:38 +00:00
Added more networking tests, lowered DNS timeout, raised DNS retries.
This commit is contained in:
parent
4c0d6ae537
commit
25a76542cd
10 changed files with 131 additions and 6 deletions
Binary file not shown.
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
#define DNS_CLASS_IN 1
|
#define DNS_CLASS_IN 1
|
||||||
|
|
||||||
#define DNS_TIMEOUT 5000
|
#define DNS_TIMEOUT 1000
|
||||||
|
|
||||||
#define DNS_MAX_RETRIES 5 // Shrine has 3, why not 5? :^)
|
#define DNS_MAX_RETRIES 20 // Shrine has 3, why not 5? :^)
|
||||||
|
|
||||||
class CDNSHash:CHash
|
class CDNSHash:CHash
|
||||||
{ // store U8 *hostname as CHash->str U8 *
|
{ // store U8 *hostname as CHash->str U8 *
|
||||||
|
|
|
@ -2,8 +2,8 @@ U8 dest_mac[6] = {0xF0, 0x0D, 0xBE, 0xAD, 0xDE, 0xAF};
|
||||||
U8 send_mac[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0xC0, 0xDE};
|
U8 send_mac[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0xC0, 0xDE};
|
||||||
U8 trgt_mac[6] = {0xB0, 0xDE, 0xCA, 0x5E, 0xD0, 0xD0};
|
U8 trgt_mac[6] = {0xB0, 0xDE, 0xCA, 0x5E, 0xD0, 0xD0};
|
||||||
|
|
||||||
U32 send_ip = EndianU32(0xFEEDBABE);
|
U32 send_ip = EndianU32(0x30313233);
|
||||||
U32 trgt_ip = EndianU32(0x01234567);
|
U32 trgt_ip = EndianU32(0x01020304);
|
||||||
|
|
||||||
U0 ARPSendTrash()
|
U0 ARPSendTrash()
|
||||||
{
|
{
|
||||||
|
|
31
src/Home/Net/Tests/DNSSendTrash.CC
Executable file
31
src/Home/Net/Tests/DNSSendTrash.CC
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
U8 dns_mac[6] = {0xF0, 0x0D, 0xBE, 0xAD, 0xDE, 0xAF};
|
||||||
|
|
||||||
|
U32 dns_ip = 0x51525354;
|
||||||
|
|
||||||
|
U0 DNSSendTrash()
|
||||||
|
{
|
||||||
|
|
||||||
|
U8 **labels = CAlloc(4);
|
||||||
|
U8 **l = labels;
|
||||||
|
CDNSQuestion *q = CAlloc(sizeof(CDNSQuestion));
|
||||||
|
|
||||||
|
ARPCachePut(dns_ip, dns_mac); // Force entry into ARP Cache so IPV4 can match it with GetMACAddressForIP
|
||||||
|
DNSSetResolverIPV4(dns_ip); // Forcing so DNSSendQuestion succeeds
|
||||||
|
|
||||||
|
q->q_name.labels = labels;
|
||||||
|
q->q_name.num_labels = 4;
|
||||||
|
|
||||||
|
*(l++) = StrNew("test1");
|
||||||
|
*(l++) = StrNew("test2");
|
||||||
|
*(l++) = StrNew("test3");
|
||||||
|
*(l++) = StrNew("test4");
|
||||||
|
|
||||||
|
while (TRUE)
|
||||||
|
{
|
||||||
|
|
||||||
|
DNSSendQuestion(0xDEAD, 0xBEEF, q);
|
||||||
|
Sleep(300);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DNSSendTrash;
|
17
src/Home/Net/Tests/HostTest1.CC
Executable file
17
src/Home/Net/Tests/HostTest1.CC
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
U8 dns_mac[6] = {0xF0, 0x0D, 0xBE, 0xAD, 0xDE, 0xAF};
|
||||||
|
|
||||||
|
U32 dns_ip = 0x51525354;
|
||||||
|
|
||||||
|
|
||||||
|
U0 HostTest()
|
||||||
|
{
|
||||||
|
ARPCachePut(dns_ip, dns_mac); // Force entry into ARP Cache so IPV4 can match it with GetMACAddressForIP
|
||||||
|
DNSSetResolverIPV4(dns_ip); // Forcing so DNSSendQuestion succeeds
|
||||||
|
|
||||||
|
|
||||||
|
"\n$BG,8$Type $FG,0$G2;$FG$ if it crashes$BG$\n\n";
|
||||||
|
Host("zenithos.org");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
HostTest;
|
22
src/Home/Net/Tests/ICMPSendTrash.CC
Executable file
22
src/Home/Net/Tests/ICMPSendTrash.CC
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
|
||||||
|
U8 dst_mac[6] = {0xF0, 0x0D, 0xBE, 0xAD, 0xDE, 0xAF};
|
||||||
|
|
||||||
|
U32 dst_ip = 0x01020304;
|
||||||
|
|
||||||
|
U0 ICMPSendTrash()
|
||||||
|
{
|
||||||
|
U8 *data_payload = CAlloc(8);
|
||||||
|
|
||||||
|
*(data_payload(U64 *)) = EndianU64(0xDEADBEEFC0DEFADE);
|
||||||
|
|
||||||
|
ARPCachePut(dst_ip, dst_mac); // Force entry into ARP Cache so IPV4 can match it with GetMACAddressForIP
|
||||||
|
|
||||||
|
while (TRUE)
|
||||||
|
{
|
||||||
|
ICMPSendReply(dst_ip, EndianU16(0xDEAD), EndianU16(0xBEEF), EndianU16(0xC0DE), data_payload, 8);
|
||||||
|
Sleep(300);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ICMPSendTrash;
|
24
src/Home/Net/Tests/IPV4SendTrash.CC
Executable file
24
src/Home/Net/Tests/IPV4SendTrash.CC
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
U8 dst_mac[6] = {0xF0, 0x0D, 0xBE, 0xAD, 0xDE, 0xAF};
|
||||||
|
|
||||||
|
U32 src_ip = 0x30313233;
|
||||||
|
U32 dst_ip = 0x01020304;
|
||||||
|
|
||||||
|
U0 IPV4SendTrash()
|
||||||
|
{
|
||||||
|
U8 *ipv4_packet_buffer;
|
||||||
|
I64 de_index;
|
||||||
|
|
||||||
|
ARPCachePut(dst_ip, dst_mac); // Force entry into ARP Cache so IPV4 can match it with GetMACAddressForIP
|
||||||
|
|
||||||
|
while (TRUE)
|
||||||
|
{
|
||||||
|
de_index = IPV4PacketAllocate(&ipv4_packet_buffer, 0xFF, src_ip, dst_ip, 8);
|
||||||
|
|
||||||
|
*(ipv4_packet_buffer(U64 *)) = EndianU64(0xDEADBEEFC0DEFADE);
|
||||||
|
|
||||||
|
IPV4PacketFinish(de_index);
|
||||||
|
Sleep(300);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IPV4SendTrash;
|
26
src/Home/Net/Tests/UDPSendTrash0.CC
Executable file
26
src/Home/Net/Tests/UDPSendTrash0.CC
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
U8 dst_mac[6] = {0xF0, 0x0D, 0xBE, 0xAD, 0xDE, 0xAF};
|
||||||
|
|
||||||
|
U32 src_ip = 0x30313233;
|
||||||
|
U32 dst_ip = 0x01020304;
|
||||||
|
|
||||||
|
U0 UDPSendTrash()
|
||||||
|
{
|
||||||
|
U8 *udp_payload;
|
||||||
|
I64 de_index;
|
||||||
|
|
||||||
|
ARPCachePut(dst_ip, dst_mac); // Force entry into ARP Cache so IPV4 can match it with GetMACAddressForIP
|
||||||
|
|
||||||
|
while (TRUE)
|
||||||
|
{
|
||||||
|
de_index = UDPPacketAllocate(&udp_payload, src_ip, 0xDEAD, dst_ip, 0xBEEF, 8);
|
||||||
|
|
||||||
|
*(udp_payload(U64 *)) = EndianU64(0xDEADBEEFC0DEFADE);
|
||||||
|
|
||||||
|
UDPPacketFinish(de_index);
|
||||||
|
Sleep(300);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
UDPSendTrash;
|
|
@ -2,10 +2,15 @@ U0 UDPSendTrash()
|
||||||
{
|
{
|
||||||
|
|
||||||
CAddressInfo *result = NULL;
|
CAddressInfo *result = NULL;
|
||||||
I64 error = DNSGetAddressInfo("zenithos.org", NULL, &result);
|
I64 error;
|
||||||
I64 i = 0;
|
|
||||||
U8 *b;
|
U8 *b;
|
||||||
|
|
||||||
|
if (ipv4_globals.local_ip == 0)
|
||||||
|
{ // This test needs to have the network configured first.
|
||||||
|
NetConfigure;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = DNSGetAddressInfo("zenithos.org", NULL, &result);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
{
|
{
|
||||||
ZenithErr("failed at DNS Get Address Info.\n");
|
ZenithErr("failed at DNS Get Address Info.\n");
|
Loading…
Reference in a new issue