X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet.c;h=ee5789c29236e52d1b28a658df4ba9c84a05e175;hp=ee58ac0a0b943bf1f2e1c8e0f9bba3f179189925;hb=eacb5a28fb4c1515633f2b8a206e7067bc7b8f0c;hpb=4a21aabada23d1d2c8a10f54dd7248171c4ec82f diff --git a/src/net.c b/src/net.c index ee58ac0a..ee5789c2 100644 --- a/src/net.c +++ b/src/net.c @@ -280,12 +280,21 @@ static void check_network_activity(fd_set * readset, fd_set * writeset) { int result, i; socklen_t len = sizeof(result); vpn_packet_t packet; + static int errors = 0; /* check input from kernel */ if(device_fd >= 0 && FD_ISSET(device_fd, readset)) { if(read_packet(&packet)) { + errors = 0; packet.priority = 0; route(myself, &packet); + } else { + usleep(errors * 50000); + errors++; + if(errors > 10) { + logger(LOG_ERR, "Too many errors from %s, exiting!", device); + running = false; + } } } @@ -418,7 +427,7 @@ int main_loop(void) { keyexpires = now + keylifetime; } - if(contradicting_del_edge && contradicting_add_edge) { + if(contradicting_del_edge > 10 && contradicting_add_edge > 10) { logger(LOG_WARNING, "Possible node with same Name as us!"); if(rand() % 3 == 0) {