Browse Source

prevented transmission of QUERY_PEER on multicast MAC addresses (#668)

pull/669/head
Logan oos Even 4 years ago
committed by GitHub
parent
commit
edc6f53ca0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/edge_utils.c

10
src/edge_utils.c

@ -785,7 +785,7 @@ static void check_known_peer_sock_change (n2n_edge_t *eee,
if(is_empty_ip_address(peer)) if(is_empty_ip_address(peer))
return; return;
if(!memcmp(mac, broadcast_mac, N2N_MAC_SIZE)) if(is_multi_broadcast(mac))
return; return;
/* Search the peer in known_peers */ /* Search the peer in known_peers */
@ -1423,7 +1423,7 @@ static int handle_PACKET (n2n_edge_t * eee,
/* hexdump(payload, psize); */ /* hexdump(payload, psize); */
if(from_supernode) { if(from_supernode) {
if(!memcmp(pkt->dstMac, broadcast_mac, N2N_MAC_SIZE)) if(is_multi_broadcast(pkt->dstMac))
++(eee->stats.rx_sup_broadcast); ++(eee->stats.rx_sup_broadcast);
++(eee->stats.rx_sup); ++(eee->stats.rx_sup);
@ -1854,8 +1854,8 @@ static int find_peer_destination (n2n_edge_t * eee,
int retval = 0; int retval = 0;
time_t now = time(NULL); time_t now = time(NULL);
if(!memcmp(mac_address, broadcast_mac, N2N_MAC_SIZE)) { if(is_multi_broadcast(mac_address)) {
traceEvent(TRACE_DEBUG, "Broadcast destination peer, using supernode"); traceEvent(TRACE_DEBUG, "Multicast or broadcast destination peer, using supernode");
memcpy(destination, &(eee->curr_sn->sock), sizeof(struct sockaddr_in)); memcpy(destination, &(eee->curr_sn->sock), sizeof(struct sockaddr_in));
return(0); return(0);
} }
@ -1924,7 +1924,7 @@ static int send_packet (n2n_edge_t * eee,
else else
++(eee->stats.tx_sup); ++(eee->stats.tx_sup);
if(!memcmp(dstMac, broadcast_mac, N2N_MAC_SIZE)) { if(is_multi_broadcast(dstMac)) {
++(eee->stats.tx_sup_broadcast); ++(eee->stats.tx_sup_broadcast);
// if no supernode around, foward the broadcast to all known peers // if no supernode around, foward the broadcast to all known peers

Loading…
Cancel
Save