X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/b9b03aadb219d06fbad9d110e508db93e45461af..03ee87b35abdb8b92e8b55ec040fa943f9a6786c:/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..d09930e4e 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c @@ -1,21 +1,21 @@ /* LUFA Library - Copyright (C) Dean Camera, 2009. + Copyright (C) Dean Camera, 2010. dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ /* - Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, and distribute this software - and its documentation for any purpose and without fee is hereby - granted, provided that the above copyright notice appear in all - copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -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 */