made gratuitous arp being sent at the right time (#635)

This commit is contained in:
Logan oos Even 2021-02-08 20:55:11 +05:45 committed by GitHub
parent 54ba76e3bc
commit c73e59341d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View File

@ -950,7 +950,7 @@ int main (int argc, char* argv[]) {
runlevel = 2;
}
eee->last_sup = 1; /* to prevent gratuitous arp packet */
eee->last_sup = 0; /* if it wasn't zero yet */
eee->curr_sn = eee->conf.supernodes;
while(runlevel < 5) {
@ -1072,7 +1072,6 @@ int main (int argc, char* argv[]) {
eee->last_sweep = now_time - SWEEP_TIME + 2 * BOOTSTRAP_TIMEOUT;
eee->sn_wait = 1;
eee->last_register_req = 0;
eee->last_sup = 0; /* to allow gratuitous arp packet after regular REGISTER_SUPER_ACK */
#ifndef WIN32
if(eee->tuntap_priv_conf.daemon) {

View File

@ -2229,14 +2229,18 @@ void readFromIPSocket (n2n_edge_t * eee, int in_sock) {
}
}
if(!eee->last_sup) {
// indicates successful connection between the edge and a supernode
traceEvent(TRACE_NORMAL, "[OK] Edge Peer <<< ================ >>> Super Node");
// send gratuitous ARP only upon first registration with supernode
send_grat_arps(eee);
// update last_sup only on 'real' REGISTER_SUPER_ACKs, not on bootstrap ones (null_mac)
// this allows reliable in/out PACKET drop if not really registered with a supernode yet
if(!is_null_mac(ra.edgeMac)) {
if(!eee->last_sup) {
// indicates successful connection between the edge and a supernode
traceEvent(TRACE_NORMAL, "[OK] Edge Peer <<< ================ >>> Super Node");
// send gratuitous ARP only upon first registration with supernode
send_grat_arps(eee);
}
eee->last_sup = now;
}
eee->last_sup = now;
eee->sn_wait = 0;
eee->sup_attempts = N2N_EDGE_SUP_ATTEMPTS; /* refresh because we got a response */