mirror of
https://github.com/ntop/n2n.git
synced 2024-09-20 00:51:10 +02:00
add callback function for hin2n to protect socket (#684)
This commit is contained in:
parent
e2c687558f
commit
cfa92d28d8
|
@ -516,6 +516,9 @@ typedef struct n2n_edge_callbacks {
|
||||||
|
|
||||||
/* Called periodically in the main loop. */
|
/* Called periodically in the main loop. */
|
||||||
void (*main_loop_period)(n2n_edge_t *eee, time_t now);
|
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;
|
} n2n_edge_callbacks_t;
|
||||||
|
|
||||||
typedef struct n2n_tuntap_priv_config {
|
typedef struct n2n_tuntap_priv_config {
|
||||||
|
|
|
@ -219,6 +219,9 @@ int supernode_connect(n2n_edge_t *eee) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(eee->cb.sock_opened)
|
||||||
|
eee->cb.sock_opened(eee);
|
||||||
|
|
||||||
struct sockaddr_in sock;
|
struct sockaddr_in sock;
|
||||||
sock.sin_family = AF_INET;
|
sock.sin_family = AF_INET;
|
||||||
sock.sin_port = htons(eee->curr_sn->sock.port);
|
sock.sin_port = htons(eee->curr_sn->sock.port);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user