Fix satellite disconnect loop: parent now sends hello reply

The parent SatelliteLink never sent a hello reply after authenticating
the satellite client. This caused two problems:

1. The satellite client's m_hello_received stayed false, preventing it
   from forwarding any local events to the parent.
2. No parent→satellite traffic until the first heartbeat at ~10s,
   allowing intermediate firewalls/NAT to kill the idle connection
   (observed as ~7s disconnect-after-auth loops).

Send a MsgTrunkHello reply from the parent, matching what TrunkLink
already does for trunk peers. Update tests for two-way handshake.
This commit is contained in:
Audric committed 2026-04-10 10:59:39 +02:00
1 parent 76c2afc084
commit 8b6148a678
3 files changed
+15 -4

No files matched your search

+7 -3
View File
@@ -272,16 +272,20 @@ class SatellitePeer(TrunkPeer):
def handshake(self, sat_id=SAT_ID, secret=SAT_SECRET, priority=None,
**kwargs):
"""Send MsgTrunkHello with ROLE_SATELLITE.
"""Send MsgTrunkHello with ROLE_SATELLITE and read parent reply.
Unlike trunk peers, the parent does NOT send a hello back —
authentication is one-way (satellite proves identity to parent).
Two-way authentication: satellite proves identity, parent replies
with its own hello so the satellite can verify and start forwarding.
"""
if priority is None:
priority = struct.unpack("!I", os.urandom(4))[0]
hello = build_trunk_hello(sat_id, "", priority, secret,
role=ROLE_SATELLITE)
send_frame(self.sock, hello)
# Read the parent's hello reply
msg_type, _fields = self.recv_msg(timeout=5.0)
assert msg_type == MSG_TRUNK_HELLO, \
f"Expected hello reply, got type={msg_type}"
# ---------------------------------------------------------------------------