rfc-8768

Constrained Application Protocol (CoAP) Hop-Limit Option

M. Boucadair, T. Reddy.K, J. Shallow
date2020-03 streamIETF areawit wgcore statusPROPOSED STANDARD pages8 canonicalhttps://www.rfc-editor.org/rfc/rfc8768 doi10.17487/RFC8768
The presence of Constrained Application Protocol (CoAP) proxies may lead to infinite forwarding loops, which is undesirable. To prevent and detect such loops, this document specifies the Hop-Limit CoAP option.

Extracted elements (22)

design-rationale §4

Each intermediate proxy prepends its identifier to the 5.08 diagnostic payload (space-separated) rather than appending, to limit message size, ease correlation with hop count, and detect proxy participation in error forwarding. Prepending is skipped if Path MTU would be exceeded.

realtime

design-rationale §3

The default Hop-Limit value of 16 was chosen to be large enough to avoid dropping legitimate requests in loop-free networks in the majority of cases, while not consuming excessive proxy resources when a loop does occur. The value remains configurable for unusual topologies.

realtime

design-rationale §1.1

The Hop-Limit option is made part of the cache key so that responses cached with different hop-limit values are not incorrectly served; servers with internal caching that implement this option gain improved caching efficiency.

realtime

interoperability-note §3

CoAP proxies that do not understand the Hop-Limit option will forward it safely (safe-to-forward property), but loops involving only such proxies will not be detected. Loop detection remains functional if at least one Hop-Limit-aware proxy is in the loop.

realtime

interoperability-note §5

For HTTP/CoAP mapping, the HTTP-to-CoAP proxy maps 5.08 (Hop Limit Reached) to HTTP 508 (Loop Detected), and the CoAP-to-HTTP proxy maps 508 (Loop Detected) back to 5.08. The CoAP-to-HTTP proxy inserts a Via header (or optionally CDN-Loop) when the CoAP request includes a Hop-Limit option.

http, realtime

interoperability-note §5

When both HTTP-to-CoAP and CoAP-to-HTTP proxies are involved and proxy-forwarded traffic crosses both boundaries repeatedly, loop detection may break. However, if the loop is confined within the CoAP or HTTP legs alone, detection remains functional.

http, realtime

normative-requirement §3 SHOULD

A CoAP proxy SHOULD be instructed via configuration to insert a Hop-Limit option when relaying a request that does not already include one.

realtime

normative-requirement §3 MUST NOT

A CoAP proxy that understands the Hop-Limit option MUST NOT use a stored 5.08 (Hop Limit Reached) error response unless the Hop-Limit value in the presented request is smaller than or equal to the value in the request used to obtain the stored response.

realtime

normative-requirement §4 MUST NOT

An intermediate proxy MUST NOT forward a 5.08 (Hop Limit Reached) error message if it detects that its own identifier is already present in the diagnostic payload; such messages SHOULD be logged and alerts sent to administrators.

realtime

normative-requirement §3 MUST

Any request carrying multiple Hop-Limit options MUST be handled following the procedure in Section 5.4.5 of RFC 7252, since the option is not repeatable.

realtime

normative-requirement §3 MUST NOT

CoAP requests MUST NOT be forwarded if the Hop-Limit option is set to '0' after decrement. Such requests SHOULD be logged and a 5.08 (Hop Limit Reached) error response sent back to the CoAP peer.

realtime

normative-requirement §3 MUST

If no initial Hop-Limit value is explicitly configured, the default initial value of 16 MUST be used.

realtime

normative-requirement §1.1 MUST

New CoAP proxies MUST implement the Hop-Limit option and have it enabled by default.

realtime

normative-requirement §3 MUST

The Hop-Limit option value MUST be between 1 and 255 inclusive. Requests with a Hop-Limit of 0 or greater than 255 MUST be rejected with a 4.00 (Bad Request) response.

realtime

normative-requirement §4 MUST NOT

The identifier included in the 5.08 diagnostic payload by the detecting proxy MUST NOT include any space character (ASCII value 32).

realtime

protocol-element §3

The Hop-Limit option is assigned option number 16, encoded as an unsigned integer, 1 byte in length, with a default value of 16. It is elective, safe to forward, and part of the cache key.

realtime

protocol-element §4

When a loop is detected and a 5.08 error is generated, the detecting proxy includes an identifier (e.g., proxy name, alias, or IP address) in the diagnostic payload. Each intermediate proxy relaying the error prepends its own identifier separated by a space.

realtime

registry §6.2

IANA has registered CoAP Option Number 16 with name 'Hop-Limit' in the 'CoAP Option Numbers' subregistry of the core-parameters registry.

registry, realtime

registry §6.1

IANA has registered CoAP Response Code 5.08 with description 'Hop Limit Reached' in the 'CoAP Response Codes' subregistry of the core-parameters registry.

registry, realtime

security-consideration §7

A CoAP endpoint can probe network topology by tweaking the Hop-Limit value. This probing can be mitigated by proxies at administrative domain boundaries rewriting or removing the Hop-Limit value in received requests.

security, realtime

security-consideration §7

The diagnostic payload of a 5.08 (Hop Limit Reached) error message may leak sensitive topology information. A boundary proxy MAY be instructed to strip part or all of the diagnostic payload before forwarding the 5.08 response.

security, privacy, realtime

wire-format §3

The Hop-Limit option value is encoded as an unsigned integer (uint), 1 octet in length, carrying values between 1 and 255 inclusive. Option number is 16.

realtime