mirror of
https://github.com/espressif/openthread.git
synced 2026-08-24 19:29:52 +00:00
[ip6] log checksum error from Checksum::VerifyMessageChecksum() (#9556)
This commit is contained in:
@@ -34,14 +34,18 @@
|
||||
#include "checksum.hpp"
|
||||
|
||||
#include "common/code_utils.hpp"
|
||||
#include "common/log.hpp"
|
||||
#include "common/message.hpp"
|
||||
#include "net/icmp6.hpp"
|
||||
#include "net/ip4_types.hpp"
|
||||
#include "net/ip6.hpp"
|
||||
#include "net/tcp6.hpp"
|
||||
#include "net/udp6.hpp"
|
||||
|
||||
namespace ot {
|
||||
|
||||
RegisterLogModule("Ip6");
|
||||
|
||||
void Checksum::AddUint8(uint8_t aUint8)
|
||||
{
|
||||
uint16_t newValue = mValue;
|
||||
@@ -147,11 +151,18 @@ void Checksum::Calculate(const Ip4::Address &aSource,
|
||||
|
||||
Error Checksum::VerifyMessageChecksum(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo, uint8_t aIpProto)
|
||||
{
|
||||
Error error = kErrorNone;
|
||||
Checksum checksum;
|
||||
|
||||
checksum.Calculate(aMessageInfo.GetPeerAddr(), aMessageInfo.GetSockAddr(), aIpProto, aMessage);
|
||||
|
||||
return (checksum.GetValue() == kValidRxChecksum) ? kErrorNone : kErrorDrop;
|
||||
if (checksum.GetValue() != kValidRxChecksum)
|
||||
{
|
||||
LogNote("Bad %s checksum", Ip6::Ip6::IpProtoToString(aIpProto));
|
||||
error = kErrorDrop;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void Checksum::UpdateMessageChecksum(Message &aMessage,
|
||||
|
||||
@@ -905,18 +905,10 @@ Error Ip6::HandlePayload(Header &aIp6Header,
|
||||
#if OPENTHREAD_CONFIG_TCP_ENABLE
|
||||
case kProtoTcp:
|
||||
error = mTcp.HandleMessage(aIp6Header, *messagePtr, aMessageInfo);
|
||||
if (error == kErrorDrop)
|
||||
{
|
||||
LogNote("Error TCP Checksum");
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case kProtoUdp:
|
||||
error = mUdp.HandleMessage(*messagePtr, aMessageInfo);
|
||||
if (error == kErrorDrop)
|
||||
{
|
||||
LogNote("Error UDP Checksum");
|
||||
}
|
||||
break;
|
||||
|
||||
case kProtoIcmp6:
|
||||
|
||||
Reference in New Issue
Block a user