From 365dd29b1296ccb5d8453c84a88bf38f9fefa772 Mon Sep 17 00:00:00 2001 From: emanuele-f Date: Mon, 10 Jun 2019 09:35:13 +0200 Subject: [PATCH] Remove unused field in peer_info --- n2n.h | 1 - sn.c | 14 +++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/n2n.h b/n2n.h index caf824b..6b96e90 100644 --- a/n2n.h +++ b/n2n.h @@ -170,7 +170,6 @@ typedef char macstr_t[N2N_MACSTR_SIZE]; struct peer_info { n2n_mac_t mac_addr; - n2n_community_t community_name; n2n_sock_t sock; int timeout; time_t last_seen; diff --git a/sn.c b/sn.c index 49ea7ad..345e5ea 100644 --- a/sn.c +++ b/sn.c @@ -147,7 +147,6 @@ static int update_edge(n2n_sn_t * sss, scan = (struct peer_info*)calloc(1, sizeof(struct peer_info)); /* deallocated in purge_expired_registrations */ - memcpy(scan->community_name, comm->community, sizeof(n2n_community_t)); memcpy(&(scan->mac_addr), edgeMac, sizeof(n2n_mac_t)); memcpy(&(scan->sock), sender_sock, sizeof(n2n_sock_t)); @@ -158,10 +157,7 @@ static int update_edge(n2n_sn_t * sss, sock_to_cstr(sockbuf, sender_sock)); } else { /* Known */ - if((0 != memcmp(comm, scan->community_name, sizeof(n2n_community_t))) || - (!sock_equal(sender_sock, &(scan->sock)))) - { - memcpy(scan->community_name, comm, sizeof(n2n_community_t)); + if(!sock_equal(sender_sock, &(scan->sock))) { memcpy(&(scan->sock), sender_sock, sizeof(n2n_sock_t)); traceEvent(TRACE_INFO, "update_edge updated %s ==> %s", @@ -925,18 +921,18 @@ static void dump_registrations(int signo) { traceEvent(TRACE_NORMAL, "===================================="); HASH_ITER(hh, sss_node.communities, comm, ctmp) { + traceEvent(TRACE_NORMAL, "Dumping community: %s", comm->community); + HASH_ITER(hh, comm->edges, list, tmp) { if(list->sock.family == AF_INET) - traceEvent(TRACE_NORMAL, "[id: %u][MAC: %s][edge: %u.%u.%u.%u:%u][community: %s][last seen: %u sec ago]", + traceEvent(TRACE_NORMAL, "[id: %u][MAC: %s][edge: %u.%u.%u.%u:%u][last seen: %u sec ago]", ++num, macaddr_str(buf, list->mac_addr), list->sock.addr.v4[0], list->sock.addr.v4[1], list->sock.addr.v4[2], list->sock.addr.v4[3], list->sock.port, - (char*)list->community_name, now-list->last_seen); else - traceEvent(TRACE_NORMAL, "[id: %u][MAC: %s][edge: IPv6:%u][community: %s][last seen: %u sec ago]", + traceEvent(TRACE_NORMAL, "[id: %u][MAC: %s][edge: IPv6:%u][last seen: %u sec ago]", ++num, macaddr_str(buf, list->mac_addr), list->sock.port, - (char*)list->community_name, now-list->last_seen); } }