Update TmfFilter as specification (#1733)

This commit is contained in:
rongli
2017-05-09 23:10:24 -07:00
committed by Jonathan Hui
parent 9c141d798f
commit 027ad9eb03
4 changed files with 19 additions and 16 deletions
+5
View File
@@ -199,6 +199,11 @@ typedef enum ThreadError
*/
kThreadError_ReassemblyTimeout = 32,
/**
* Message is not a TMF Message.
*/
kThreadError_NotTmf = 33,
kThreadError_Error = 255,
} ThreadError;
+3 -3
View File
@@ -47,11 +47,11 @@ namespace Coap {
Server::Server(Ip6::Netif &aNetif, uint16_t aPort) :
CoapBase(aNetif.GetIp6().mUdp),
mPort(aPort),
mResources(NULL),
mInterceptor(NULL),
mResponsesQueue(aNetif)
{
mPort = aPort;
mResources = NULL;
mInterceptor = NULL;
}
ThreadError Server::Start(void)
+1 -1
View File
@@ -296,7 +296,7 @@ public:
* @retval kThreadError_None Server should continue processing this message, other
* return values indicates the server should stop processing
* this message.
* @retval kThreadError_Security The message does not comply with security rules.
* @retval kThreadError_NotTmf The message is not a TMF message.
*
*/
typedef ThreadError(* Interceptor)(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
+10 -12
View File
@@ -196,18 +196,16 @@ ThreadError ThreadNetif::TmfFilter(const Message &aMessage, const Ip6::MessageIn
{
ThreadError error = kThreadError_None;
// A TMF message must comply one of the following rules:
// 1. Source address is RLOC or ALOC, and destination address is RLOC, ALOC or realm-local multicast.
// 2. Both source and destination addresses are link-local.(for Joiner Entrust)
VerifyOrExit(((aMessageInfo.GetPeerAddr().IsRoutingLocator() ||
aMessageInfo.GetPeerAddr().IsAnycastRoutingLocator()) &&
(aMessageInfo.GetSockAddr().IsRoutingLocator() ||
aMessageInfo.GetSockAddr().IsAnycastRoutingLocator() ||
aMessageInfo.GetSockAddr().IsRealmLocalMulticast())) ||
(aMessageInfo.GetPeerAddr().IsLinkLocal() &&
aMessageInfo.GetSockAddr().IsLinkLocal()),
error = kThreadError_Security);
// A TMF message must comply at least one of the following rules:
// 1. The IPv6 source address is RLOC or ALOC.
// 2. The IPv6 destination address is RLOC or ALOC.
// 3. The IPv6 destination address is Link-Local address.
VerifyOrExit(aMessageInfo.GetPeerAddr().IsRoutingLocator() ||
aMessageInfo.GetPeerAddr().IsAnycastRoutingLocator() ||
aMessageInfo.GetSockAddr().IsRoutingLocator() ||
aMessageInfo.GetSockAddr().IsAnycastRoutingLocator() ||
aMessageInfo.GetSockAddr().IsLinkLocal(),
error = kThreadError_NotTmf);
exit:
(void)aMessage;
return error;