summaryrefslogtreecommitdiff
path: root/proto/babel/packets.c
diff options
context:
space:
mode:
authorToke Høiland-Jørgensen <toke@toke.dk>2023-02-14 18:18:32 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2023-02-14 18:18:32 +0100
commitee919658948772105d0bd3b4535ba28883484f2c (patch)
treef8c188f8e674d946ddcf2cc1811c99ab1783bd81 /proto/babel/packets.c
parenteecc3f02e41bcb91d463c4c1189fd56bc44e6514 (diff)
Babel: Keep separate auth PC counters for unicast and multicast
The babel protocol normally sends all its messages as multicast packets, but the protocol specification allows most messages to be sent as either unicast or multicast, and the two can be mixed freely. In particular, the babeld implementation can be configured to unicast updates to all peers instead of sending them as unicast. Daniel discovered that this can cause problems with the packet counter checks in the MAC extension due to packet reordering. This happens on WiFi networks where clients have power save enabled (which is quite common in infrastructure networks): in this case, the access point will buffer all multicast traffic and only send it out along with its beacons, leading to a maximum buffering in default Linux-based access point configuration of up to 200 ms. This means that a Babel sender that mixes unicast and multicast messages can have the unicast messages overtake the multicast messages because of this buffering; when authentication is enabled, this causes the receiver to discard the multicast message when it does arrive because it now has a packet counter value less than the unicast message that arrived before it. Daniel observed that this happens frequently enough that Babel ceases to work entirely when runner over a WiFi network. The issue has been described in draft-ietf-babel-mac-relaxed, which is currently pending RFC publication. That also describes two mitigation mechanisms: Keeping separate PC counters for unicast and multicast, and using a reorder window for PC values. This patch implements the former as that is the simplest, and resolves the particular issue seen on WiFi. Thanks to Daniel Gröber for the bugreport. Minor changes from committer.
Diffstat (limited to 'proto/babel/packets.c')
-rw-r--r--proto/babel/packets.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/proto/babel/packets.c b/proto/babel/packets.c
index 28bf9f63..61c94cc5 100644
--- a/proto/babel/packets.c
+++ b/proto/babel/packets.c
@@ -1704,6 +1704,7 @@ babel_read_pc(struct babel_tlv *hdr, union babel_msg *m UNUSED,
state->auth.pc_seen = 1;
state->auth.index_len = index_len;
state->auth.index = tlv->index;
+ state->auth.unicast = state->is_unicast;
state->current_tlv_endpos += index_len;
return PARSE_SUCCESS;