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:
parent
9513911377
commit
27a8418f21
|
@ -835,10 +835,13 @@ void process_frame(void) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool broadcast;
|
||||||
if (memcmp(frame, own_mac, 6) == 0) {
|
if (memcmp(frame, own_mac, 6) == 0) {
|
||||||
// Targetted at us
|
// Targetted at us
|
||||||
|
broadcast = false;
|
||||||
} else if (memcmp(frame, broadcast_mac, 6) == 0) {
|
} else if (memcmp(frame, broadcast_mac, 6) == 0) {
|
||||||
// Broadcast
|
// Broadcast
|
||||||
|
broadcast = true;
|
||||||
} else {
|
} else {
|
||||||
// Does not concern us
|
// Does not concern us
|
||||||
return;
|
return;
|
||||||
|
@ -852,8 +855,11 @@ void process_frame(void) {
|
||||||
unsigned char version = frame[14];
|
unsigned char version = frame[14];
|
||||||
|
|
||||||
// If they speak a version we don't understand, tell them to speak ours
|
// 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) {
|
if (version > EM_PROTOCOL_VERSION) {
|
||||||
send_speak_version(source_mac);
|
if (!broadcast) {
|
||||||
|
send_speak_version(source_mac);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,10 @@ Version 1 EtherMess protocol version
|
||||||
Tells the recipient to speak the given version of the protocol.
|
Tells the recipient to speak the given version of the protocol.
|
||||||
Should be generated whenever an EtherMess packet with a version one doesn't
|
Should be generated whenever an EtherMess packet with a version one doesn't
|
||||||
speak is received.
|
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)
|
.It Status request (0x01)
|
||||||
Requests the recipient to announce its status and nick.
|
Requests the recipient to announce its status and nick.
|
||||||
Upon receiving this packet, a status packet should be sent to the sender.
|
Upon receiving this packet, a status packet should be sent to the sender.
|
||||||
|
|
Loading…
Reference in New Issue