Browse Source

fixed a null_mac bug (#592)

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

9
src/n2n.c

@ -328,9 +328,12 @@ struct peer_info* add_sn_to_list_by_mac_or_sock (struct peer_info **sn_list, n2n
if(peer == NULL) { /* zero MAC, search by socket */
HASH_ITER(hh, *sn_list, scan, tmp) {
if(memcmp(&(scan->sock), sock, sizeof(n2n_sock_t)) == 0) {
HASH_DEL(*sn_list, scan);
memcpy(scan->mac_addr, mac, sizeof(n2n_mac_t));
HASH_ADD_PEER(*sn_list, scan);
// update mac if appropriate, needs to be deleted first because it is key to the hash list
if(!is_null_mac(mac)) {
HASH_DEL(*sn_list, scan);
memcpy(scan->mac_addr, mac, sizeof(n2n_mac_t));
HASH_ADD_PEER(*sn_list, scan);
}
peer = scan;
break;
}

Loading…
Cancel
Save