AnsweredAssumed Answered

Couple of issues discovered in lwIP port

Question asked by Michael Brudevold on Sep 13, 2016
Latest reply on Feb 27, 2017 by Lawrence Muray

Using Kinetis SDKv2 on a K64 dev kit.


In function ethernetif_input, status is compared against kStatus_Success in the else case.  The issue is that status can be kStatus_ENET_RxFrameEmpty, which is a valid case of data not ready, not an error.  This was causing me occasional packet loss.  Changing it to check against kStatus_ENET_RxFrameEmpty fixed it.


Also in ethernetif_input, the call to ENET_ReadFrame expects a contiguous buffer, which is not guaranteed.  It also incorrectly modifies the length of the packetBuffer.  Either ENET_ReadFrame needs to be aware of the pbuf structure or a temporary buffer needs to be created to fit the entire packet.  Failure to do so causes unintended memory to be overwritten.