From 27a8418f216c8fc2eaa2b551c2998cea4275e9a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Sun, 28 Jul 2019 20:58:57 +0300 Subject: [PATCH] Don't create Speak version packets for broadcasts. This allows new versions of the protocol to send broadcast advertizements without the older versions telling the sender to speak their version. Version 1.0 of the reference implementation will still do that, but the issue is not great enough to warrant pulling and replacing it. --- ethermess-backend.c | 8 +++++++- ethermess.7 | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ethermess-backend.c b/ethermess-backend.c index 2e84bae..d9547c3 100644 --- a/ethermess-backend.c +++ b/ethermess-backend.c @@ -835,10 +835,13 @@ void process_frame(void) { return; } + bool broadcast; if (memcmp(frame, own_mac, 6) == 0) { // Targetted at us + broadcast = false; } else if (memcmp(frame, broadcast_mac, 6) == 0) { // Broadcast + broadcast = true; } else { // Does not concern us return; @@ -852,8 +855,11 @@ void process_frame(void) { unsigned char version = frame[14]; // If they speak a version we don't understand, tell them to speak ours + // Exception: If it was a broadcast, just ingore it if (version > EM_PROTOCOL_VERSION) { - send_speak_version(source_mac); + if (!broadcast) { + send_speak_version(source_mac); + } return; } diff --git a/ethermess.7 b/ethermess.7 index 18b3056..359338d 100644 --- a/ethermess.7 +++ b/ethermess.7 @@ -58,6 +58,10 @@ Version 1 EtherMess protocol version Tells the recipient to speak the given version of the protocol. Should be generated whenever an EtherMess packet with a version one doesn't speak is received. +.Pp +Note however that this packet shouldn't be generated if the packet was +sent to the Ethernet broadcast address +.Li ff:ff:ff:ff:ff:ff . .It Status request (0x01) Requests the recipient to announce its status and nick. Upon receiving this packet, a status packet should be sent to the sender.