X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/b9b03aadb219d06fbad9d110e508db93e45461af..cf22a744ec0da3b68c4ffdb14c6fa43f2e07542f:/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c index 57380a082..0749af7ce 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c @@ -37,7 +37,6 @@ #include "Ethernet.h" -/* Global Variables: */ /** Constant for convenience when checking against or setting a MAC address to the virtual server MAC address. */ const MAC_Address_t ServerMACAddress = {SERVER_MAC_ADDRESS}; @@ -59,7 +58,7 @@ const IP_Address_t ClientIPAddress = {CLIENT_IP_ADDRESS}; */ void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* FrameIN, Ethernet_Frame_Info_t* FrameOUT) { - DecodeEthernetFrameHeader(FrameIN->FrameData); + DecodeEthernetFrameHeader(FrameIN); /* Cast the incoming Ethernet frame to the Ethernet header type */ Ethernet_Frame_Header_t* FrameINHeader = (Ethernet_Frame_Header_t*)&FrameIN->FrameData; @@ -69,7 +68,8 @@ void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* FrameIN, Ethernet_Frame_Info_ /* Ensure frame is addressed to either all (broadcast) or the virtual webserver, and is a type II frame */ if ((MAC_COMPARE(&FrameINHeader->Destination, &ServerMACAddress) || - MAC_COMPARE(&FrameINHeader->Destination, &BroadcastMACAddress))) + MAC_COMPARE(&FrameINHeader->Destination, &BroadcastMACAddress)) && + (SwapEndian_16(FrameIN->FrameLength) > ETHERNET_VER2_MINSIZE)) { /* Process the packet depending on its protocol */ switch (SwapEndian_16(FrameINHeader->EtherType)) @@ -110,8 +110,8 @@ void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* FrameIN, Ethernet_Frame_Info_ /** Calculates the appropriate ethernet checksum, consisting of the addition of the one's * compliment of each word, complimented. * - * \param Data Pointer to the packet buffer data whose checksum must be calculated - * \param Bytes Number of bytes in the data buffer to process + * \param[in] Data Pointer to the packet buffer data whose checksum must be calculated + * \param[in] Bytes Number of bytes in the data buffer to process * * \return A 16-bit Ethernet checksum value */