#include "connection.h"
#include "control_common.h"
+#include "crypto.h"
#include "ethernet.h"
#include "ipv4.h"
#include "ipv6.h"
#include "protocol.h"
#include "route.h"
#include "subnet.h"
+#include "utils.h"
rmode_t routing_mode = RMODE_ROUTER;
fmode_t forwarding_mode = FMODE_INTERNAL;
static const size_t ns_size = sizeof(struct nd_neighbor_solicit);
static const size_t opt_size = sizeof(struct nd_opt_hdr);
-#ifndef MAX
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#endif
-
static timeout_t age_subnets_timeout;
/* RFC 1071 */
}
}
- close(sockfd);
+ closesocket(sockfd);
}
}
}
}
- close(sockfd);
+ closesocket(sockfd);
}
}
csum += csum >> 16;
csum ^= 0xffff;
DATA(packet)[start + 16] = csum >> 8;
- DATA(packet)[start + 17] = csum;
+ DATA(packet)[start + 17] = csum & 0xff;
break;
}
}
(void)data;
bool left = false;
- for splay_each(subnet_t, s, myself->subnet_tree) {
+ for splay_each(subnet_t, s, &myself->subnet_tree) {
if(s->expires && s->expires < now.tv_sec) {
if(debug_level >= DEBUG_TRAFFIC) {
char netstr[MAXNETSTR];
if(left)
timeout_set(&age_subnets_timeout, &(struct timeval) {
- 10, rand() % 100000
+ 10, jitter()
});
}
}
timeout_add(&age_subnets_timeout, age_subnets, NULL, &(struct timeval) {
- 10, rand() % 100000
+ 10, jitter()
});
} else {
if(subnet->expires) {
todo = ntohs(ip.ip_len) - ip_size;
if(ether_size + ip_size + todo != packet->len) {
- logger(DEBUG_TRAFFIC, LOG_WARNING, "Length of packet (%d) doesn't match length in IPv4 header (%zu)", packet->len, ether_size + ip_size + todo);
+ logger(DEBUG_TRAFFIC, LOG_WARNING, "Length of packet (%d) doesn't match length in IPv4 header (%lu)", packet->len, (unsigned long)(ether_size + ip_size + todo));
return;
}