Permalink
Browse files

Fix multicast self registration

Trace: (192.168.1.10/AE:C4:1F:99:D7:16 is the edge node itself)

02/Dec/2018 23:01:44 [edge_utils.c:175] Registering with multicast group 224.0.0.68:1968
02/Dec/2018 23:01:44 [edge_utils.c:533] send REGISTER 224.0.0.68:1968
02/Dec/2018 23:01:44 [edge_utils.c:463] sendto sent=36 to
02/Dec/2018 23:01:44 [edge_utils.c:1500] Received packet from multicast socket
02/Dec/2018 23:01:44 [edge_utils.c:1296] ### Rx N2N UDP (36) from 192.168.1.10:48122
02/Dec/2018 23:01:44 [edge_utils.c:1341] Rx REGISTER src=AE:C4:1F:99:D7:16 dst=00:00:00:00:00:00 from peer 192.168.1.10:48122 (192.168.1.10:48122)
02/Dec/2018 23:01:44 [edge_utils.c:567] send REGISTER_ACK 192.168.1.10:48122
02/Dec/2018 23:01:44 [edge_utils.c:463] sendto sent=36 to
02/Dec/2018 23:01:44 [edge_utils.c:1296] ### Rx N2N UDP (36) from 192.168.1.10:48122
02/Dec/2018 23:01:44 [edge_utils.c:1367] Rx REGISTER_ACK src=AE:C4:1F:99:D7:16 dst=AE:C4:1F:99:D7:16 from peer 192.168.1.10:48122 (192.168.1.10:48122)
02/Dec/2018 23:01:44 [edge_utils.c:266] set_peer_operational: AE:C4:1F:99:D7:16 -> 192.168.1.10:48122
02/Dec/2018 23:01:44 [edge_utils.c:318] Failed to find sender in pending_peers.
  • Loading branch information...
emanuele-f committed Dec 2, 2018
1 parent e7cfa00 commit e07ae72c17d09765b2f8ef24bad42764740fd633
Showing with 12 additions and 6 deletions.
  1. +12 −6 edge_utils.c
@@ -1332,6 +1332,7 @@ static void readFromIPSocket(n2n_edge_t * eee, int in_sock) {
/* Another edge is registering with us */
n2n_REGISTER_t reg;
n2n_mac_t null_mac = { '\0' };
int skip_register = 0;
decode_REGISTER(&reg, &cmn, udp_buf, &rem, &idx);
@@ -1347,12 +1348,17 @@ static void readFromIPSocket(n2n_edge_t * eee, int in_sock) {
if(!memcmp(reg.dstMac, eee->device.mac_addr, 6))
check_peer(eee, from_supernode, reg.srcMac, orig_sender);
else if(// (sender.port == N2N_MULTICAST_PORT) &&
(!memcmp(reg.dstMac, null_mac, 6)) /* Announce via a multicast socket */
&& (!memcmp(reg.srcMac, eee->device.mac_addr, 6)) /* It's not our self-announce */
)
check_peer(eee, from_supernode, reg.srcMac, orig_sender);
send_register_ack(eee, orig_sender, &reg);
(!memcmp(reg.dstMac, null_mac, 6))) { /* Announce via a multicast socket */
if(memcmp(reg.srcMac, eee->device.mac_addr, 6)) /* It's not our self-announce */
check_peer(eee, from_supernode, reg.srcMac, orig_sender);
else {
traceEvent(TRACE_INFO, "Skipping REGISTER from self");
skip_register = 1; /* do not register with ourselves */
}
}
if(!skip_register)
send_register_ack(eee, orig_sender, &reg);
}
else if(msg_type == MSG_TYPE_REGISTER_ACK)
{

0 comments on commit e07ae72

Please sign in to comment.