Browse Source

add callback function for hin2n to protect socket (#684)

pull/685/head
randomize00 3 years ago
committed by GitHub
parent
commit
cfa92d28d8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      include/n2n_typedefs.h
  2. 3
      src/edge_utils.c

3
include/n2n_typedefs.h

@ -516,6 +516,9 @@ typedef struct n2n_edge_callbacks {
/* Called periodically in the main loop. */
void (*main_loop_period)(n2n_edge_t *eee, time_t now);
/* Called when a new socket to supernode is created. */
void (*sock_opened)(n2n_edge_t *eee);
} n2n_edge_callbacks_t;
typedef struct n2n_tuntap_priv_config {

3
src/edge_utils.c

@ -219,6 +219,9 @@ int supernode_connect(n2n_edge_t *eee) {
return -1;
}
if(eee->cb.sock_opened)
eee->cb.sock_opened(eee);
struct sockaddr_in sock;
sock.sin_family = AF_INET;
sock.sin_port = htons(eee->curr_sn->sock.port);

Loading…
Cancel
Save