[tmf] add local IPv6 DSCP values to indicate TMF message priority (#7869)

This commit adds new IPv6 header DSCP values which indicate a TMF
message priority. This allows intermediate routers forwarding TMF
message to be able to determine and use the TMF message priority that
originator of the message selects (e.g., address query/notification
use net-level priority whereas network diagnostics message use normal
priority). This replaces the previous behavior where on intermediate
routers all TMF messages were treated as net-level priority.

The new DSCP values are allocated from local codepoint range
`0bxxxx11` (per RFC 2474 - section 6). If the sender does not use
TMF-specific DSCP values, we use `kPriorityNet` as default on
intermediate router. This ensures that senders that are using older
code (do not use the new) experience the same behavior as before.
This commit is contained in:
Abtin Keshavarzian
2023-04-07 12:23:01 -07:00
committed by GitHub
parent cb40a45298
commit d9ea37a3bb
5 changed files with 93 additions and 3 deletions
+48
View File
@@ -34,6 +34,7 @@
#include "thread/tmf.hpp"
#include "common/locator_getters.hpp"
#include "net/ip6_types.hpp"
namespace ot {
namespace Tmf {
@@ -222,6 +223,53 @@ exit:
return isTmf;
}
uint8_t Agent::PriorityToDscp(Message::Priority aPriority)
{
uint8_t dscp = Ip6::kDscpTmfNormalPriority;
switch (aPriority)
{
case Message::kPriorityNet:
dscp = Ip6::kDscpTmfNetPriority;
break;
case Message::kPriorityHigh:
case Message::kPriorityNormal:
break;
case Message::kPriorityLow:
dscp = Ip6::kDscpTmfLowPriority;
break;
}
return dscp;
}
Message::Priority Agent::DscpToPriority(uint8_t aDscp)
{
Message::Priority priority = Message::kPriorityNet;
// If the sender does not use TMF specific DSCP value, we use
// `kPriorityNet`. This ensures that senders that do not use the
// new value (older firmware) experience the same behavior as
// before where all TMF message were treated as `kPriorityNet`.
switch (aDscp)
{
case Ip6::kDscpTmfNetPriority:
default:
break;
case Ip6::kDscpTmfNormalPriority:
priority = Message::kPriorityNormal;
break;
case Ip6::kDscpTmfLowPriority:
priority = Message::kPriorityLow;
break;
}
return priority;
}
#if OPENTHREAD_CONFIG_DTLS_ENABLE
SecureAgent::SecureAgent(Instance &aInstance)