-
Notifications
You must be signed in to change notification settings - Fork 0
Solution Ideas
This section summarises our view of the problem and the solution ideas that we have. This page also provides the challenges that we face, doubts and queries that we have on each of the ideas.
The objective of this idea is to use the ECN notification packages for better calculation of RTT and RTO. The implementation of this mechanism would be in the application layer, unlike the traditional transport layer implementation of ECN. Here the end-point
would be setting the ECN bits
of the ACK
or RST
or the response
packets, if it is experiencing congestion or is not able to process the packets fast enough or when some other errors and difficulties are experienced. The ECN notifications could also be used as a flow-control mechanism, since CoAP has none.
It is important to note that, unlike ECN notifications which are sent by the intermediate routers
, the solution mechanism discussed here mandates the ECN notifications to be sent from by the end-points
alone. This is because the routers have access only to the network layer and transport layer information of the packets and not to the application layer information and it is in the Application layer that the ECP bits are set (since CoAP header where they are set, is part of Application layer).
- Accommodating the 2 ECN bits in the CoAP header is the major difficulty since it is just 4 bytes long and is fit completely. Even though it is true that only few of the bits of
Code
field in the header are being used today, the others are reserved and are difficult to obtain for our use. We could work around this problem using theOptions
field. - Detection of congestion at the Application layer.
- Implementation of flow-control at the Application layer.
- Changing the existing methods of RTT and RTO calculation to use the ECN notifications.
- When, how and for which type of requests should the ECN notification be sent?
- Would this mechanism work with the current policies of CoAP for declaring a communication to have failed?
- Why is there no flow-control mechanism in CoAP?
- What have been the difficulties in implementing a flow-control mechanism in CoAP?
- Why is a separate mechanism (the ECN notifications) required at the Application layer for RTT calculation, when we already have
ACK
andRST
packets? - To what extent would this mechanism help in congestion control?
CoAP is an application layer protocol, and traditionally it works with UDP as the transport layer protocol. Since ECN is implemented in the transport layer and the network layer, we think of implementing it in UDP. This would work similar to ECN with TCP and would help in congestion control.
- UDP has a fully packed 8 byte header, hence it would be impossible to accommodate the 2 bits, that ECN requires, in the UDP header. Hence we would have to look into some other ways to accommodate the 2 bits, for instance, by using hashing or xor or some other type of encoding.
- Implementation of Congestion control in UDP using ECN notifications.
- Does our approach require any changes in the routing protocols?
- Are the 2 extra bits really required?
This section summarises the solution method we came up with for incorporating ECN with CoAP. It portrays the incremental development in the solution.
Figure out a way to accommodate ECN notification bits in CoAP headerThe ECN notification bits can be accommodated in the CODE
field of the CoAP header. Presently the CODE
field values
1.00 to 1.31, 6.00 to 6.31 and 7.00 to 7.31 are reserved and unused.
We did not go with the idea of using the OPTION
field bits for this purpose because of the importance it carries and the community's ethic toward it.
Figure out which type of messages would have ECN notifications.
We think that it is logical to have ECN notifications only for those messages which require reliable transmission. And since the only type of message that provides reliable transmission in CoAP is Confirmable message (CON), only CON messages will have the ECN notifications.
Figure out way to let each end point know that the other end point in ECN capable or notSince only every message (from the application) is fragmented and sent as a series of packets, it is safe to assume that each message (from the application) transmitted is fragmented into at least 2 packets at the CoAP level. Hence the first packet of the bunch can carry the information about the ECN capability of Host A to Host B and the ACK to this packet from Host B could carry the ECN capability of Host B and this would be similar to the ECN initialisation. Since CoAP follows Stop and Wait for the CON packets, which implies any other packet of the message (from the application) will be able to use the ECN initialisation data obtained from the first packet transmission, this solution would work.
- How to have ECN initilisation when the first packet itself experiences congestion?
- Is it necessary to solve the issue of "first packet itself experiencing congestion"?
Core CoAP messages must be small enough to fit into their link-layer packets (~ 64 KiB for UDP) but, in any case the RFC states that:
- it SHOULD fit within a single IP packet to avoid IP fragmentation (MTU of 1280 for IPv6). If nothing is known about the size of the headers, good upper bounds are 1152 bytes for the message size and 1024 bytes for the payload size; or less to avoid adaptation layer fragmentation (60-80 bytes for 6LoWPAN networks);
- if you need to transfer larger payloads, this IETF draft extends core CoAP with new options for transferring multiple blocks of information from a resource representation in multiple request-response pair (so you can transfer more than 64KiB per message).
Hence the given solution works only for a few CoAP transmissions since most of them are non fragmented messages.
Figure out way to let each end point know that the other end point in ECN capable or not
From the "discovery" above, we understand that almost all the messages (from the application) are sent without fragmentation. Hence the solution discussed earlier won't work. We also note that unlike TCP we cannot have 3 way handshake in CoAP. Thus the only way to have ECN in CoAP would be iff the Host A already knew about the ECN capabilities of the Host B.
We also note that, CoAP is a protocol that is mostly implemented in a constrained IOT environment. Generally, each CoAP node communicates with only a few, finite number of, CoAP nodes.
So the solution for this problem would be to store the ECN capabilities of each of the possible destination CoAP nodes in the host. And since the number of destination nodes is very few, the amount of memory required for this is very small. Let the data-structure used for this storage be called ECN capabilities table.
Figure out a way to have ECN capable communication using the ECN capability info of each host.
The CoAP Header is used for communicating the ECN capability of the host, acknowledgement of the congestion (ECN-Echo) and CWR flag. The IP Header is used for congestion notifications as suggested in RFC 3168
.
The steps in each CoAP communication between Host A and Host B would be as follows :
- Host A receive the message to be sent to Host B, from the application.
- Host A checks in its ECN capabilities table to see if Host B is ECN capable or not. If Host B is ECN capable then Host A sets the ECN bits in both the IP header and the CoAP header and sends the packet. If the Host B is not ECN capable, then Host A sets the ECN bits only in the CoAP header and not in the IP header and sends the packet.
- Host B on receiving the message, sends the acknowledgement. In the ACK, Host B sets the ECN bits in the CoAP header to signify its ECN capabilities. If the CON message header said that Host A was ECN capable, Host B sets the ECN bits in IP header of the ACK packet else IP header is not touched. Host B also updates its entry of Host A in the ECN capabilities table, using the info about the ECN capability of Host A in the CON CoAP header.
- Host A upon receiving the ACK, updates its entry of Host B in the ECN capabilities table, using the info about the ECN capability of Host B in the ACK CoAP header.
The hosts do not set ECN bits in the IP Header for retransmissions even if both the hosts are ECN capable in order to avoid DoS attacks. But the ECN bits of CoAP header are always set to signify the ECN capabilities of the Hosts.
The above mentioned steps for communication is for a Peer-to-Peer architecture. It the architecture were to be a Server-Client architecture, then the Host B (which here is the server), would not need to have an ECN capabilities table since it could just use the info in the CoAP header itself. But the Host A (which here is the client) needs to always have the ECN capabilities table.
- How and when to set the CWR flag?
- How to communicate and use the CWR flag?
- How to set and communicate the ECN-Echo (ECE)?
Figure out way to let each end point know that the other end point in ECN capable or not
The previously discussed idea involves the usage of a separate data-structure called ECN capabilities table, which would turn out to be memory intensive and won't be a scalable solution as the networks size increases.
Hence we think of not using the ECN capabilities table at all. The idea is as follows:
- If a host is ECN capable then it always marks the packets originating from it to indicate that they are part of an ECN capable communication, irrespective of the ECN capabilities of the other end-point.
- If a host is not ECN capable it never marks its packets, hence they would not be part of ECN capable communication.
The motive behind such bold marking is to help the IOT traffic to compete with the real Internet packets at congested situations, i.e in order to have IOT packets not dropped while competing with the internet traffic.
Figure out a the complete steps of communication once ECN is enabled based on the above discussed ECN mechanism.
The CoAP Header is used for communicating the ECN capability of the host and acknowledgement of the congestion (ECN-Echo). The IP Header is used for congestion notifications as suggested in RFC 3168
.
Here we assume that we have two bits at the CoAP Header dedicated for ECN. Thus different ECN codepoints at the CoAP header would be
+-----+-----+
| ECN FIELD |
+-----+-----+
ECT CE
0 0 Not-ECN capable
1 0 ECN Capable and No Congestion
1 1 ECN Capable and Congestion
Here we note that, we do not require the 01
codepoint unlike the ECN at IP because at CoAP layer, there is no risk of corruption of ECN bits in middle-ware devices.
The steps of communication are as follows (here we assume that HOST A
and HOST B
are the two end-points):
-
When a
HOST
is not ECN capable:- It sets the
ECN
field at the CoAP header to00
and sets theECN
field at the IP header to00
on all its packets. - It ignores any ECN notifications from the IP layer.
- It sets the
-
When a
HOST
is ECN capable:- It sets the
ECN
field at the IP header to10
(ECT-0) on all its response packets(except theACK
). - It sets the
ECT
bit at the CoAP header to1
(signifying that it is ECN capable) and setsCE
bit at the CoAP header to0
on the initial packet(i.e when it has received no congestion notification about the particular path). - If it knows that there is congestion in the path, then it sets the
CE
bit at the CoAP header to1
. It setsCE
iff there was a notification from IP on the previous packet of theother HOST
. - For the very next
ACK
packet, theECN
bits at IP header are set to00
and theECN
bits at the CoAP header are set as discussed above. - For retransmissions, the
ECN
bits at IP header are set to00
(as perRFC 3168
). - It ignores any notifications from the IP for packets with a different sequence number than what is required (i.e for the duplicate packets).
- It sets the
Detailed explanation of different communication scenarios:
-
When a
HOST A
is not ECN capable:- It sets the
ECN
field at the CoAP header to00
and sets theECN
field at the IP header to00
on all its packets. - It ignores any ECN notifications from the IP layer.
- It responds(with either an
ACK
or aresponse message
) toHOST B
by settingECN
field at the CoAP header to00
and setting theECN
field at the IP header to00
.
- It sets the
-
When
HOST A
is ECN capable and no congestion notification was received:- It sets the
ECN
field at the IP header to10
(ECT-0) on its response packets(except theACK
). - It sets the
ECT
bit at the CoAP header to1
(signifying that it is ECN capable) and setsCE
bit at the CoAP header to0
on its response packets toHOST B
. - For the very next
ACK
packet toHOST B
, theECN
bits at IP header are set to00
and theECN
bits at the CoAP header are set to10
.
- It sets the
-
When
HOST A
is ECN capable and a congestion notification was received:- It sets
ECN
bits in the IP header to10
on its response packet toHOST B
. - Here it is important to note that, the congestion notification can be received only from the IP layer.
- It sets the
ECT
bit at the CoAP header to1
andCE
bit at the CoAP header to1
on its very next response packet toHOST B
. It setsCE
iff there was a notification from IP on the previous packet ofHOST B
. - For the very next
ACK
packet toHOST B
, theECN
bits at IP header are set to00
and theECN
bits at the CoAP header are set to11
.
- It sets
For HOST B
too, the communication steps are exactly similar.
Important details and subtleties to note:
- At a
HOST
capable of ECN, for the retransmissions, theECN
bits at IP header must be set to00
(as perRFC 3168
). This is done in order to prevent attacks that use sequence number spoofing, which would be a major problem at some nodes, if they do honor the IP's ECN notification for undesired-sequence-number packets. - At a
HOST
capable of ECN, the CoAP layer must ignore the ECN bits of CoAP header for packets with undesired-sequence-numbers. This is just a secondary protection mechanism, sinceRFC 7252
already mandates that duplicate message must be processed exactly once. - The
HOST
should ignore any notifications from the IP, for packets with a different sequence number than what is required or desired (i.e for the duplicate packets).
Figure out a way to accommodate ECN notification bits in CoAP header.
The previous discussed idea of incorporating the ECN bits in the CODE
field of the CoAP header would not work in the case of "separate response" messages because the response message itself would have a CODE
and there can only be one CODE
value sent at a time.
We have come to a conclusion that only 1 bit (specifically the CN
bit) of information at the CoAP header is sufficient to send the congestion notification. This is because, an end-point does not need to know the ECN capabilities of the other end-point, since it marks all the packets ECN capable irrespective of the capabilities of the other end-point.
Since we have concluded that, we require only 1 bit of information, we will be sending this one bit in the TOKEN
field in the following way:
- We plan on using the
TOKEN
field for carrying theCN
bit's information. - The current mechanism requires the response message to have the same
TOKEN
as the request, but our new mechanism would want the response messageTOKEN
to be either the same or the 1's compliment of that in the request message. - Case 1: If the
CN
bit need to be set (i.e. CN = 1), we will be responding with aTOKEN
which is the 1's complement of that received in the request message. - Case 2: If the
CN
bit needs to be not set (i.e. CN = 0), we will be responding with aTOKEN
which is exactly the same as that received in the request message.
Why should this work?
-
RFC 7252
mandates that every message must have aTOKEN
value. Hence we can be sure to receive theCN
information. - If the
RESPONDING HOST
is not ECN capable, then he would respond with the sameTOKEN
as that in the request message. TheREQUESTING HOST
would interpret it as no congestion experienced (CN=0), which is exactly what we intended. - If the
RESPONDING HOST
is ECN capable and there was congestion notification from IP, then he would respond with the aTOKEN
that is 1's complement of that in the request message. TheREQUESTING HOST
would interpret it as congestion experienced (CN=1), which is exactly what we intended. - Hence, if the
REQUESTING HOST
receives a response with the sameTOKEN
as that in its request message, it would imply that, either theRESPONDING HOST
is ECN not capable or that there was no congestion experienced.
How would this effect the current CoAP mechanisms?
- This mechanism will not affect the current message send-receive mechanisms in any way. The current mechanism requires the response message to have the same
TOKEN
as the request, but our new mechanism would want the response messageTOKEN
to be either the same or the 1's compliment of that in the request message. - Assume that a ECN not capable host (
REQUESTING HOST
) is communicating with a ECN capable host (RESPONDING HOST
) and there was congestion in the channel. Here even though theRESPONDING HOST
is ECN capable, it won't complement theTOKEN
bits because it will never get congestion notification from IP since theREQUESTING HOST
would have marked the packet ECN incapable (i.e ECT=0 and CE=0 at the IP header). HenceREQUESTING HOST
will receive a response just like before (TOKEN
is the same as request). -
RFC 7252
says thatTOKEN
is used as a protection against spoofing. Our mechanism is at least as safe as that in the RFC, since there is no indication at the CoAP header that tells that the packet is ECN capable transmission or not, implying that, any host who looks at this packet sees theTOKEN
field just as a random string of bits, as in the mechanism in RFC. Only the end-point hosts understand the meaning of theTOKEN
field and no one else does.
What is the disadvantage?
-
RFC 7252
says thatTOKEN
is used to distinguish between the responses of the concurrent requests (which were destined to the same host). - It also mandates that, the
REQUESTING HOST
must generateTOKEN
in such a that, it does not matchTOKEN
of any other message already in the channel which is destined to the same host. - Since we use the
TOKEN
value and its 1's complement value in the response, a ECN capableREQUESTING HOST
must generateTOKEN
in such a that, it does not match either theTOKEN
or the 1's complement of any other message already in the channel which is destined to the same host. - This implies that the maximum number of concurrent messages, in one RTT, reduces by half.
- Since the
TOKEN
field is 8 bytes long, and since it is highly improbable that there would be 2^64 concurrent messages to the same host in one RTT, we think that our mechanism is a fairly good one. Moreover, 2^63 (the resulting, max number of concurrent requests) is still an extremely huge number.
Provide a clear description of the steps of communication once ECN is enabled based on the above discussed ECN mechanism.
The TOKEN
field in the CoAP Header is going to used for communicating the acknowledgement of the congestion (ECN-Echo). The IP Header is used for congestion notifications as suggested in RFC 3168
.
Here assume the presence of a virtual bit in the CoAP Header dedicated for ECN. Thus different ECN codepoints at the CoAP header would be:
+-----+-----+-------+
| ECN VIRTUAL FIELD |
+-----+-----+-------+
CN
0 No Congestion experienced
1 Congestion experienced
Note:
In the following discussion,
-
REQUEST MESSAGES
is used to signify requests and declarative message. -
RESPONSE MESSAGES
is used to signify responses, ACK and reset messages. - the expression "CN bit is 1" would mean that the
TOKEN
in theRESPONSE MESSAGE
is the 1's compliment of that of theREQUEST MESSAGE
; and - the expression "CN bit is 0" would mean that the
TOKEN
in theRESPONSE MESSAGE
is same as that of theREQUEST MESSAGE
. - if the expression "CN bit is 0" is used in the context of
REQUEST MESSAGE
, it means that a newTOKEN
, satisfying the conditions discussed above, is set for the message.
The steps of communication are as follows (here we assume that HOST A
and HOST B
are the two end-points and that HOST A
is the requester and HOST B
is the responder):
-
When
HOST
is not ECN capable:- It sets the
CN
field at the CoAP header to0
and sets theECN
field at the IP header to00
on all its messages. - It ignores any congestion notifications from the IP layer.
- It sets the
-
When
HOST
is ECN capable:- It sets
ECN
field in the IP Header to10
(ECT-0) on all its messages, except theACK
response message. forACK
messages,ECN
field at the IP Header is00
(RFC 3168
). - It sets
CN
field in CoAP header to0
on all itsREQUEST MESSAGES
(this happens in caseHOST A
). - It sets
CN
field in CoAP header to1
on itsRESPONSE MESSAGES
(this happens in caseHOST B
), iff it received a congestion notification for the message it is responding to. - For retransmissions, the
ECN
bits at IP header are set to00
(as perRFC 3168
). - It ignores any notifications from the IP for packets with a different sequence number than what is required (i.e for the duplicate packets).
- It sets
Detailed description of different communication scenarios when HOST A
is ECN capable.
-
Scenario 1:
HOST A
andHOST B
are ECN capable and there was congestion experienced by theREQUEST MESSAGE
sent byHOST A
:-
HOST B
receives a congestion notification from the IP layer. -
HOST B
sets CN = 1 (in CoAP header) in theRESPONSE MESSAGE
.
-
-
Scenario 2:
HOST A
andHOST B
are ECN capable and there was no congestion experienced by theREQUEST MESSAGE
sent byHOST A
:-
HOST B
receives no congestion notification from the IP layer. -
HOST B
sets CN = 0 (in CoAP header) in theRESPONSE MESSAGE
.
-
-
Scenario 3:
HOST A
is ECN capable andHOST B
is not ECN capable and there congestion experienced by theREQUEST MESSAGE
sent byHOST B
:-
HOST B
receives a congestion notification from the IP layer, but does not understand what the notification means. -
HOST B
sets CN = 0 (in CoAP header) in theRESPONSE MESSAGE
.
-
Important details and subtleties to note:
- At a
HOST
capable of ECN, for the retransmissions, theECN
bits at IP header must be set to00
(as perRFC 3168
). This is done in order to prevent attacks that use sequence number spoofing, which would be a major problem at some nodes, if they do honour the IP's ECN notification for undesired-sequence-number packets. - At a
HOST
capable of ECN, the CoAP layer must ignore the ECN bits of CoAP header for packets with undesired-sequence-numbers. This is just a secondary protection mechanism, sinceRFC 7252
already mandates that duplicate message must be processed exactly once. - The
HOST
should ignore any notifications from the IP, for packets with a different sequence number than what is required or desired (i.e for the duplicate packets).