Skip to content

Commit 7aa859f

Browse files
committed
clusterer_controller: the multicast controller, added to clusterer
The nodes of a cluster declared with cluster_options use_controller=1 find each other over encrypted IPv4 multicast, elect a master, receive their node ids and BIN addresses from it, and fail the cluster's sharing tags over; every other cluster behaves as with clusterer. clusterer's side (per-cluster node ids, controller-managed clusters and sharing tags, BIN messages that cannot override the controller) is in clusterer's files, the controller's own code in cl_ctr_*. Loading clusterer.so beside it is refused. The master admits joiners a few at a time and holds each one CONNECTING, with no role or sharing tag, until its BIN links to every member are up both ways; a joiner stuck there is named with the pairs that are down, and parked after 60 s so that the queue moves on past it. Every member multicasts a heartbeat each second with its links and capability states, so liveness and node events come from heartbeats and links, with no periodic BIN pings, no link-state floods and no routing through other nodes. Module broadcasts go out as one multicast datagram (fragments when larger), numbered per sender, repaired by unicast and ordered with the TCP messages that follow them; what cannot be repaired is reported, and the sender goes down and up to this node's modules, which sync again. Wire version 4. With its unit, network-namespace and real-cluster tests, the packages (opensips-module-contrib-clusterer-controller), the README, an overview diagram, and libsodium in the CI build dependencies.
1 parent 89394a4 commit 7aa859f

64 files changed

Lines changed: 21445 additions & 473 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎modules-contrib/clusterer_controller/Makefile‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,23 @@ NAME=clusterer_controller.so
66
#DEFS+= -DCLUSTERER_DBG
77
#DEFS+= -DCLUSTERER_EXTRA_BIN_DBG
88

9+
# Linux-only: the controller's timers are timerfds and its multicast socket is
10+
# pinned to its interface with SO_BINDTODEVICE
11+
ifneq ($(OS),linux)
12+
$(error clusterer_controller builds on Linux only (timerfd, SO_BINDTODEVICE) - drop it from include_modules on $(OS))
13+
endif
14+
15+
# libsodium is a hard requirement: it provides the payload AEAD
16+
# (XChaCha20-Poly1305), the bootstrap KDF (Argon2id), the Noise_NNpsk0 join
17+
# handshake, and X25519 / HKDF-SHA256 / RNG. It is linked dynamically (distro
18+
# static libs are usually non-PIC), so target hosts need the libsodium runtime
19+
# package (e.g. `apt install libsodium23`).
20+
SODIUM_EXISTS := $(shell pkg-config --exists libsodium 2>/dev/null && echo yes)
21+
ifeq ($(SODIUM_EXISTS),yes)
22+
DEFS += $(shell pkg-config --cflags libsodium)
23+
LIBS += $(shell pkg-config --libs libsodium)
24+
else
25+
$(error clusterer_controller requires libsodium (install libsodium-dev / libsodium-devel))
26+
endif
27+
928
include ../../Makefile.modules

‎modules-contrib/clusterer_controller/README.md‎

Lines changed: 1887 additions & 329 deletions
Large diffs are not rendered by default.

‎modules-contrib/clusterer_controller/cl_ctr.h‎

Lines changed: 1295 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)