From 5aac8813e6da323f310aa83f332bb97eefd3b21e Mon Sep 17 00:00:00 2001 From: randomize00 <53703968+randomize00@users.noreply.github.com> Date: Fri, 29 Jan 2021 21:03:26 +0800 Subject: [PATCH] safer checking for REGISTER_SUPER_ACK and UNREGISTER_SUPER (#611) --- src/sn_utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sn_utils.c b/src/sn_utils.c index b49f2ce..75a02fe 100644 --- a/src/sn_utils.c +++ b/src/sn_utils.c @@ -1430,8 +1430,8 @@ static int process_udp (n2n_sn_t * sss, return -1; } - if((from_supernode == 0) != (comm->is_federation == IS_NO_FEDERATION)) { - traceEvent(TRACE_DEBUG, "process_udp dropped UNREGISTER_SUPER: from_supernode value doesn't correspond to the internal federation marking."); + if((from_supernode == 1) || (comm->is_federation == IS_FEDERATION)) { + traceEvent(TRACE_DEBUG, "process_udp dropped UNREGISTER_SUPER: should not come from a supernode or federation."); return -1; } @@ -1486,8 +1486,8 @@ static int process_udp (n2n_sn_t * sss, return -1; } - 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."); + if((from_supernode == 0) || (comm->is_federation == IS_NO_FEDERATION)) { + traceEvent(TRACE_DEBUG, "process_udp dropped REGISTER_SUPER_ACK: should not come from an edge or regular community."); return -1; }