projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Try harder to connect to unreachable nodes.
[tinc]
/
src
/
route.c
diff --git
a/src/route.c
b/src/route.c
index
fc08f5f
..
d1048e7
100644
(file)
--- a/
src/route.c
+++ b/
src/route.c
@@
-59,33
+59,30
@@
static const size_t opt_size = sizeof(struct nd_opt_hdr);
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
-volatile int dummy;
static timeout_t age_subnets_timeout;
/* RFC 1071 */
static timeout_t age_subnets_timeout;
/* RFC 1071 */
-static uint16_t inet_checksum(void *data, int len, uint16_t prevsum) {
- uint16_t *p = data;
+static uint16_t inet_checksum(void *vdata, int len, uint16_t prevsum) {
+ uint8_t *data = vdata;
+ uint16_t word;
uint32_t checksum = prevsum ^ 0xFFFF;
while(len >= 2) {
uint32_t checksum = prevsum ^ 0xFFFF;
while(len >= 2) {
- checksum += *p++;
+ memcpy(&word, data, sizeof(word));
+ checksum += word;
+ data += 2;
len -= 2;
}
if(len) {
len -= 2;
}
if(len) {
- checksum += *
(uint8_t *)p
;
+ checksum += *
data
;
}
while(checksum >> 16) {
checksum = (checksum & 0xFFFF) + (checksum >> 16);
}
}
while(checksum >> 16) {
checksum = (checksum & 0xFFFF) + (checksum >> 16);
}
- // Work around a compiler optimization bug.
- if(checksum) {
- dummy = 1;
- }
-
return ~checksum;
}
return ~checksum;
}