projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add tests for network commands
[tinc]
/
src
/
route.c
diff --git
a/src/route.c
b/src/route.c
index
3fe6edb
..
6f1ffd4
100644
(file)
--- a/
src/route.c
+++ b/
src/route.c
@@
-22,6
+22,7
@@
#include "connection.h"
#include "control_common.h"
#include "connection.h"
#include "control_common.h"
+#include "crypto.h"
#include "ethernet.h"
#include "ipv4.h"
#include "ipv6.h"
#include "ethernet.h"
#include "ipv4.h"
#include "ipv6.h"
@@
-55,10
+56,6
@@
static const size_t icmp6_size = sizeof(struct icmp6_hdr);
static const size_t ns_size = sizeof(struct nd_neighbor_solicit);
static const size_t opt_size = sizeof(struct nd_opt_hdr);
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 */
static timeout_t age_subnets_timeout;
/* RFC 1071 */
@@
-167,7
+164,7
@@
static void route_ipv4_unreachable(node_t *source, vpn_packet_t *packet, length_
}
}
}
}
- close(sockfd);
+ close
socket
(sockfd);
}
}
}
}
@@
-272,7
+269,7
@@
static void route_ipv6_unreachable(node_t *source, vpn_packet_t *packet, length_
}
}
}
}
- close(sockfd);
+ close
socket
(sockfd);
}
}
}
}
@@
-486,7
+483,7
@@
static void clamp_mss(const node_t *source, const node_t *via, vpn_packet_t *pac
csum += csum >> 16;
csum ^= 0xffff;
DATA(packet)[start + 16] = csum >> 8;
csum += csum >> 16;
csum ^= 0xffff;
DATA(packet)[start + 16] = csum >> 8;
- DATA(packet)[start + 17] = csum;
+ DATA(packet)[start + 17] = csum
& 0xff
;
break;
}
}
break;
}
}
@@
-495,7
+492,7
@@
static void age_subnets(void *data) {
(void)data;
bool left = false;
(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(s->expires && s->expires < now.tv_sec) {
if(debug_level >= DEBUG_TRAFFIC) {
char netstr[MAXNETSTR];
@@
-505,7
+502,7
@@
static void age_subnets(void *data) {
}
}
}
}
- for list_each(connection_t, c, connection_list)
+ for list_each(connection_t, c,
&
connection_list)
if(c->edge) {
send_del_subnet(c, s);
}
if(c->edge) {
send_del_subnet(c, s);
}
@@
-520,7
+517,7
@@
static void age_subnets(void *data) {
if(left)
timeout_set(&age_subnets_timeout, &(struct timeval) {
if(left)
timeout_set(&age_subnets_timeout, &(struct timeval) {
- 10,
rand() % 100000
+ 10,
jitter()
});
}
});
}
@@
-544,13
+541,13
@@
static void learn_mac(mac_t *address) {
/* And tell all other tinc daemons it's our MAC */
/* And tell all other tinc daemons it's our MAC */
- for list_each(connection_t, c, connection_list)
+ for list_each(connection_t, c,
&
connection_list)
if(c->edge) {
send_add_subnet(c, subnet);
}
timeout_add(&age_subnets_timeout, age_subnets, NULL, &(struct timeval) {
if(c->edge) {
send_add_subnet(c, subnet);
}
timeout_add(&age_subnets_timeout, age_subnets, NULL, &(struct timeval) {
- 10,
rand() % 100000
+ 10,
jitter()
});
} else {
if(subnet->expires) {
});
} else {
if(subnet->expires) {
@@
-588,7
+585,7
@@
static void fragment_ipv4_packet(node_t *dest, vpn_packet_t *packet, length_t et
todo = ntohs(ip.ip_len) - ip_size;
if(ether_size + ip_size + todo != packet->len) {
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 (%
d)", packet->len, (int
)(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;
}
return;
}
@@
-1112,7
+1109,7
@@
static void route_mac(node_t *source, vpn_packet_t *packet) {
static void send_pcap(vpn_packet_t *packet) {
pcap = false;
static void send_pcap(vpn_packet_t *packet) {
pcap = false;
- for list_each(connection_t, c, connection_list) {
+ for list_each(connection_t, c,
&
connection_list) {
if(!c->status.pcap) {
continue;
}
if(!c->status.pcap) {
continue;
}
@@
-1125,7
+1122,7
@@
static void send_pcap(vpn_packet_t *packet) {
}
if(send_request(c, "%d %d %d", CONTROL, REQ_PCAP, len)) {
}
if(send_request(c, "%d %d %d", CONTROL, REQ_PCAP, len)) {
- send_meta(c,
(char *)
DATA(packet), len);
+ send_meta(c, DATA(packet), len);
}
}
}
}
}
}