safer checking for REGISTER_SUPER_ACK and UNREGISTER_SUPER (#611)

This commit is contained in:
randomize00 2021-01-29 21:03:26 +08:00 committed by GitHub
parent c696f59e07
commit 5aac8813e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1430,8 +1430,8 @@ static int process_udp (n2n_sn_t * sss,
return -1; return -1;
} }
if((from_supernode == 0) != (comm->is_federation == IS_NO_FEDERATION)) { if((from_supernode == 1) || (comm->is_federation == IS_FEDERATION)) {
traceEvent(TRACE_DEBUG, "process_udp dropped UNREGISTER_SUPER: from_supernode value doesn't correspond to the internal federation marking."); traceEvent(TRACE_DEBUG, "process_udp dropped UNREGISTER_SUPER: should not come from a supernode or federation.");
return -1; return -1;
} }
@ -1486,8 +1486,8 @@ static int process_udp (n2n_sn_t * sss,
return -1; return -1;
} }
if((from_supernode == 0) != (comm->is_federation == IS_NO_FEDERATION)) { if((from_supernode == 0) || (comm->is_federation == IS_NO_FEDERATION)) {
traceEvent(TRACE_DEBUG, "process_udp dropped REGISTER_SUPER_ACK: from_supernode value doesn't correspond to the internal federation marking."); traceEvent(TRACE_DEBUG, "process_udp dropped REGISTER_SUPER_ACK: should not come from an edge or regular community.");
return -1; return -1;
} }