Mesh networking

How do mesh networks avoid duplicate messages?

Mesh networks avoid duplicate messages by giving every message an identifier, usually the originator's address plus a sequence number, and having each device keep a short-lived cache of identifiers it has already handled, so it forwards each message at most once. Many meshes also cut copies at the source by letting only some neighbours rebroadcast, and add random delays so nearby relays do not transmit at the same moment.

TL;DR

Copies are normal in a mesh because every broadcast reaches every neighbour. Each relay identifies messages, usually by originator and sequence number, caches them long enough to cover the slowest copy, and forwards each at most once. Chosen relays and random delays cut copies but do not replace the cache. A forged early copy can block the real one.

Learning objectives

After reading this article you will be able to:

  • Explain why one radio broadcast produces several copies of a message in a mesh
  • Describe how originator addresses, sequence numbers and caches catch duplicate copies
  • Recognise how a forged early copy can make a relay reject the real one

Causes of duplicate copies in a mesh network

Radio is a broadcast medium, so when a device transmits, every neighbour in range hears it. In a mesh where neighbours relay for each other, that means a single message quickly exists in several places at once.

Take four devices, where A can hear B and C, and B and C can both hear D. A sends a message. B and C both receive it and both rebroadcast it. D now hears it twice, once from each. If D relays too, B and C hear it again from D. RFC 6621, the IETF’s Simplified Multicast Forwarding specification, lists the two causes in one sentence: packets may go back out over the same interface they arrived on, and routers “may also receive multiple copies of the same packets from different neighbors”.

None of this is a fault. Multiple paths are what make a mesh resilient. But if every copy were treated as new, each device would forward the same message again and again, and the network would fill with its own echoes. A hop limit stops this eventually; duplicate detection stops it at the first repeat.

Message identifiers for duplicate detection

Mesh routing protocols commonly identify a message by two parts: who created the message and a counter that the creator increases for each new one. Duplicate detection starts with this identifier, which stays the same on every copy.

  • RFC 5444, the shared message format for IETF mesh routing protocols, says that when the originator address and message sequence number are both present, the header “provides for duplicate suppression”. Together with the message type, they identify the message until the sequence number wraps round and repeats.
  • AODV (RFC 3561) identifies each route request by the originator’s address and an RREQ ID. A node that has seen the same pair recently silently discards the new copy.
  • B.A.T.M.A.N. gives every originator message a sequence number set by its originator, so a node can tell whether it has received that message before.

An originator and sequence number can be checked from the header alone, without reading the message body. RFC 5444 lists this separation of forwarding from processing among the properties it was designed for.

RFC 6621 also describes a second approach, hash-based detection: the relay hashes the parts of the header that do not change in transit, together with the payload, and treats a matching hash as a duplicate. The RFC leaves the choice between the two to the deployment, but all routers in one network must use the same method.

Seen-message caches on mesh devices

Each device keeps a cache of recent identifiers and checks every arriving message against it.

  • Bluetooth Mesh requires every node to implement a Network Message Cache of recently seen messages. A message found in the cache “is immediately discarded”.
  • OLSR (RFC 3626) keeps a Duplicate Set. Each entry records the originator, the sequence number, whether the message has already been retransmitted, the interfaces it arrived on, and an expiry time.
  • RFC 6621 recommends keeping a history of recently processed packets, held long enough to cover the longest time a packet can take to cross the network.

That last point is the sizing rule. If the cache forgets an identifier before the slowest copy arrives, the copy looks new and is forwarded again. In a mesh that holds messages while devices are out of range, a copy can arrive much later than on a live link, so the cache needs to last longer. The general trade-offs of windows and identifiers are covered in What is message deduplication?; in a mesh, every relay keeps such a cache, not only the recipient.

Separate processing and forwarding records

Tracking processing and forwarding separately lets a device act on a message without being one of the devices chosen to retransmit it. A device can do two things with a message: act on it, and pass it on. Mesh protocols often track these separately, because the right answer can differ.

OLSRv2 (RFC 7181) keeps three records. A Received Set per interface notes what has arrived there, a Processed Set notes what the router has acted on, and a Forwarded Set notes what it has sent on. The RFC says together they ensure a message “is processed at most once and is forwarded at most once” per interface. Each record identifies a message by its type, originator address and sequence number. OLSRv2 also has a router silently discard any copy of a message it originated itself, which removes the echo of its own broadcasts coming back from neighbours.

In OLSR, for example, neighbours not selected as multipoint relays still receive and process broadcasts but do not retransmit them. B.A.T.M.A.N. goes further for its own announcements: a node rebroadcasts each one at most once, and only if it arrived from the neighbour it currently judges to be the best next hop towards the originator.

Relay selection and random forwarding delays

Choosing a subset of relays and adding a small random delay before forwarding, so neighbours do not all transmit at the same instant, both reduce the number of copies in the air. A cache stops any one device forwarding twice, but in plain flooding every device still forwards once, and in a dense network many of those transmissions reach nobody new. What is flooding in a mesh network? covers those techniques. They work alongside duplicate detection, not instead of it: RFC 6621 still requires a cache even when every node forwards, and describes it as critical in that mode.

Attacks on mesh duplicate detection

Duplicate detection can be attacked: because a cache entry blocks later copies, a forged or tampered copy that arrives first can block the real one. RFC 6621 describes an attacker who lowers the hop limit on a copy and delivers it early, so the relay records the message as seen and then refuses the genuine copy. It suggests storing hop limit information with each cache entry. It also warns that sequence-based identifiers are predictable, and recommends mixing in an internal hash of the packet content.

Frequently asked questions

Is a duplicate cache in a mesh the same as message deduplication in an app?

They use the same idea but protect different things. A relay's cache stops the network forwarding the same message twice. An app's deduplication stops the same message, or the same piece of work, taking effect twice for the user. A reliable system usually needs both.

Why not just drop every message after one hop?

Because then nothing reaches devices out of direct range. Meshes need some rebroadcasting to work at all; the goal is to forward each message once per device, and only through devices that actually extend its reach.

What is the Network Message Cache in Bluetooth Mesh?

It is a cache of recently seen messages that every Bluetooth Mesh node is required to implement. A message found in the cache is immediately discarded.

How long should a mesh duplicate cache keep entries?

RFC 6621 recommends keeping a history long enough to cover the longest time a packet can take to cross the network. If the cache forgets an identifier before the slowest copy arrives, the copy looks new and is forwarded again, and in a mesh that holds messages while devices are out of range, that copy can arrive much later.

Can a relay spot a duplicate without reading the message body?

Yes. An originator address and sequence number can be checked from the header alone, and RFC 5444 lists this separation of forwarding from processing among the properties it was designed for.

How does AODV detect duplicate route requests?

AODV (RFC 3561) identifies each route request by the originator's address and an RREQ ID. A node that has seen the same pair recently silently discards the new copy.

Sources

Build it with Offline Protocol

The configuration reference lists the mesh SDK's deduplication cache size and retention, and shows how to change them along with the hop limit and retry settings.

Read the configuration reference