projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix sparse warnings and add an extra sprinkling of const.
[tinc]
/
src
/
net.c
diff --git
a/src/net.c
b/src/net.c
index
ee58ac0
..
3508dd7
100644
(file)
--- a/
src/net.c
+++ b/
src/net.c
@@
-1,7
+1,7
@@
/*
net.c -- most of the network code
Copyright (C) 1998-2005 Ivo Timmermans,
/*
net.c -- most of the network code
Copyright (C) 1998-2005 Ivo Timmermans,
- 2000-201
0
Guus Sliepen <guus@tinc-vpn.org>
+ 2000-201
1
Guus Sliepen <guus@tinc-vpn.org>
2006 Scott Lamb <slamb@slamb.org>
This program is free software; you can redistribute it and/or modify
2006 Scott Lamb <slamb@slamb.org>
This program is free software; you can redistribute it and/or modify
@@
-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;
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)) {
/* 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);
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;
+ }
}
}
}
}
@@
-414,11
+423,11
@@
int main_loop(void) {
}
}
}
}
- send_key_changed(
broadcast, myself
);
+ send_key_changed();
keyexpires = now + keylifetime;
}
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) {
logger(LOG_WARNING, "Possible node with same Name as us!");
if(rand() % 3 == 0) {