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.
This commit is contained in:
Juhani Krekelä 2019-07-28 20:58:57 +03:00
parent 9513911377
commit 27a8418f21
2 changed files with 11 additions and 1 deletions

View File

@ -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;
}

View File

@ -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.