More fixups to ARP and UDP (udp still buggy)
authorJohn Hodge <[email protected]>
Thu, 25 Feb 2010 13:35:27 +0000 (21:35 +0800)
committerJohn Hodge <[email protected]>
Thu, 25 Feb 2010 13:35:27 +0000 (21:35 +0800)
Kernel/Makefile.BuildNum
Modules/IPStack/arp.c
Modules/IPStack/ipv4.c
Modules/IPStack/udp.c

index e082886..51a99bb 100644 (file)
@@ -1 +1 @@
-BUILD_NUM = 1447
+BUILD_NUM = 1450
index 2b246cd..4064928 100644 (file)
@@ -152,8 +152,15 @@ void ARP_UpdateCache4(tIPv4 SWAddr, tMacAddr HWAddr)
                gaARP_Cache4[i].IP = SWAddr;
        }
        
+       Log("[ARP  ] Caching %i.%i.%i.%i (%02x:%02x:%02x:%02x:%02x:%02x) in %i",
+               SWAddr.B[0], SWAddr.B[1], SWAddr.B[2], SWAddr.B[3],
+               HWAddr.B[0], HWAddr.B[1], HWAddr.B[2], HWAddr.B[3], HWAddr.B[4], HWAddr.B[5],
+               i
+               );
+               
        gaARP_Cache4[i].MAC = HWAddr;
        gaARP_Cache4[i].LastUpdate = now();
+       giARP_LastUpdateID ++;
        RELEASE(&glARP_Cache4);
 }
 
@@ -187,6 +194,7 @@ void ARP_UpdateCache6(tIPv6 SWAddr, tMacAddr HWAddr)
        
        gaARP_Cache6[i].IP = SWAddr;
        gaARP_Cache6[i].LastUpdate = now();
+       giARP_LastUpdateID ++;
        RELEASE(&glARP_Cache6);
 }
 
@@ -304,5 +312,9 @@ void ARP_int_GetPacket(tAdapter *Adapter, tMacAddr From, int Length, void *Buffe
                }
                
                break;
+       
+       default:
+               Warning("[ARP  ] Unknown Request ID %i", ntohs(req4->Request));
+               break;
        }
 }
index 15cf65f..89f5671 100644 (file)
@@ -69,6 +69,13 @@ int IPv4_SendPacket(tInterface *Iface, tIPv4 Address, int Protocol, int ID, int
        hdr->Version = 4;
        hdr->HeaderLength = sizeof(tIPv4Header)/4;
        hdr->DiffServices = 0;  // TODO: Check
+       
+       hdr->Reserved = 0;
+       hdr->DontFragment = 0;
+       hdr->MoreFragments = 0;
+       hdr->FragOffLow = 0;
+       hdr->FragOffHi = 0;
+       
        hdr->TotalLength = htons( bufSize );
        hdr->Identifcation = htons( ID );       // TODO: Check
        hdr->TTL = DEFAULT_TTL;
index f014c55..fe13a3e 100644 (file)
@@ -125,7 +125,7 @@ void UDP_SendPacket(tUDPChannel *Channel, void *Data, size_t Length)
                hdr = malloc(sizeof(tUDPHeader)+Length);
                hdr->SourcePort = htons( Channel->LocalPort );
                hdr->DestPort = htons( Channel->RemotePort );
-               hdr->Length = htons( Length );
+               hdr->Length = htons( sizeof(tUDPHeader) + Length );
                hdr->Checksum = 0;      // Checksum can be zero on IPv4
                memcpy(hdr->Data, Data, Length);
                // Pass on the the IPv4 Layer

UCC git Repository :: git.ucc.asn.au