Commit graph

2743 commits

Author SHA1 Message Date
thorkill
f93352b095 Prevent packet loops when ICMP6 router solicitation packets are sent to tinc device
When tincd setups it's network device some operating systems send router
solicitation packets from local scope ip addresses. tincd forwards it
then to his neighbors then those nodes follow the same routine fowarding it
to the next hops. I may happen that an loop will occur consuming large amount
of bandwith. Constrains: Mode = Router, Broadcast = mst.

Reproduction: ping6 -c 1  ff02::2%<tincd interface>
Sending one packet will, depending on your setup, generate about 3k packets.

Proposed solution in this commit: enable StrictSubnets, tincd will reject such
packets due to unknown subnet.

Future work: check scope of the ip address and make decisions about forwarding
based on Mode tincd is configured to work.
2015-07-09 22:19:26 +02:00
thorkill
49cc329cf9 Reverted changes on EDGE_ADD update if weight differs 2015-07-09 17:33:17 +02:00
thorkill
0c30f9f0f1 Revert "Forward edge information"
This reverts commit 24af5b94a7.
2015-07-09 17:16:07 +02:00
thorkill
24af5b94a7 Forward edge information 2015-07-09 17:09:35 +02:00
thorkill
5cb5ab3412 Fix memory leak in setup_outgoing_connection
Do not allocate new configuration for outgoing connection if it's already initialized.
2015-07-09 01:04:57 +02:00
thorkill
1f2e14df8c merged with thkr-1.1-fix-0004 2015-07-08 00:44:08 +02:00
thorkill
5f6613e36f Attempt to fix the heap-use-after-free error in mst_kruskal
For some reason the edges ware removed in one direction resulting in e->reverse
point into invalid memory.

Do not insert edge into edge_weight_tree if not needed.
2015-07-08 00:36:22 +02:00
thorkill
06d4eac9ac Prevent tinc from forgeting e->local_address
If ADD_EDGE came from tinc version 1.0.x local_address.sa.sa_family is set to 0.
If it came from tinc version 1.1.x forwarded for older verion it will be 255 - AF_UNKNOWN.
2015-07-07 23:51:56 +02:00
thorkill
5ae403f9e6 Make sure we do not allocate new edge when talking to old nodes and the same edge already exists
When tinc gets ADD_EDGE from older versions it will allocate
new edge in protocol_edge.c:189 due to missed case in lines 149-171 where
local_address is not defined.
2015-07-07 23:51:43 +02:00
thorkill
de8b7a8dfb Prevent tinc from forgeting e->local_address
If ADD_EDGE came from tinc version 1.0.x local_address.sa.sa_family is set to 0.
If it came from tinc version 1.1.x forwarded for older verion it will be 255 - AF_UNKNOWN.
2015-07-07 23:14:08 +02:00
thorkill
e0d14e978f Make sure we do not allocate new edge when talking to old nodes and the same edge already exists
When tinc gets ADD_EDGE from older versions it will allocate
new edge in protocol_edge.c:189 due to missed case in lines 149-171 where
local_address is not defined.
2015-07-07 21:19:26 +02:00
thorkill
80ccfb2894 Update weight if needed at the beginning 2015-07-07 20:50:53 +02:00
thorkill
78d0342a12 Update weight on reverse edge too 2015-07-07 20:49:16 +02:00
thorkill
0c334bb077 Do not insert edge into edge_weight_tree if not needed 2015-07-07 20:37:17 +02:00
thorkill
bb3fd0a985 Make usage of weight 2015-07-07 20:35:52 +02:00
thorkill
d49fd87dbc Attempt to fix the heap-use-after-free error in mst_kruskal
For some reason the edges ware removed in one direction resulting in e->reverse
point into invalid memory.
2015-07-07 00:05:58 +02:00
thorkill
77eac310c5 Revert "Set edge->reverse to NULL before we free it"
This reverts commit eda9f0ea8e.
2015-07-06 01:54:01 +02:00
thorkill
8dcd2a9995 Do not delete edges which differ only by weight
Added special case where we get weight update from other node.
Previous version called edge_del() which caused segmentation
faults in mst_kruskal.
2015-07-06 01:52:40 +02:00
thorkill
38c42fb973 Move the edge weight update handling to edge.c 2015-07-06 01:50:31 +02:00
thorkill
7c85db5421 Introducing new function for edge weight update 2015-07-06 01:49:45 +02:00
thorkill
b7820caf03 removed edge_clone() 2015-07-06 01:49:03 +02:00
thorkill
eda9f0ea8e Set edge->reverse to NULL before we free it 2015-07-06 01:04:11 +02:00
thorkill
e51dd1b196 Changed the name of edge from node to oldnode 2015-07-06 00:42:59 +02:00
thorkill
7dc8c736bc list_each shadowed node
move it into the loop
2015-07-05 22:32:32 +02:00
thorkill
841ca358e0 Forgot to set node->data 2015-07-05 21:58:27 +02:00
thorkill
25ad32d206 Use usage of splay_node_t 2015-07-05 21:41:49 +02:00
thorkill
bebe8e6808 Fixed edge->reverse corruption resulting in a segfault in graph()
Thanks to Guus for helping us with this one.
2015-07-05 20:54:32 +02:00
thorkill
04c1dedeb5 Extended simple.c with hash and connection tests 2015-07-05 00:32:44 +02:00
thorkill
82706970cf Removed unused declaration in bind_to_intercface() 2015-07-05 00:32:11 +02:00
thorkill
614a03c886 Do not try to zero memory on unitialized hash 2015-07-05 00:31:39 +02:00
thorkill
aea7938f19 Added sanity check in test in sssp_bfs() 2015-07-05 00:31:01 +02:00
thorkill
837469c747 Add small jitter to keyexpire_handle and edgeupdate_handler 2015-07-05 00:16:02 +02:00
thorkill
d172f2db29 Merge with guus patch for exit_edges() 2015-07-05 00:15:04 +02:00
thorkill
aa9994e49e Cleanup after merge 2015-07-04 18:52:16 +02:00
thorkill
dc5491a59e Merge branch '1.1' of github.com:gsliepen/tinc into thkr-1.1-ponyhof 2015-07-04 18:45:43 +02:00
Guus Sliepen
de7d9ee437 Call sockaddrfree(&e->local_address) in free_edge() instead of exit_edges().
The proper place to clean up resources of objects is in their
destructor. This makes sure proper cleanup when edge_del() is called as
well. At exit, free_edge() is called on all edges by free_edge_tree(),
which is called by exit_nodes().
2015-07-04 17:53:11 +02:00
Guus Sliepen
36cec9af88 Coalesce two if statements that check for the same thing. 2015-07-04 17:51:05 +02:00
Jo-Philipp Wich
14ccf50954 fix musl compatibility
Let configure include sys/if_tun.h when testing for netinet/if_ether.h
to detect the Kernel/libc header conflict on musl.

After this patch, configure will correctly detect netinet/if_ether.h as
unusable and the subsequent compilation will not attempt to use it.

Conflicts:
	src/have.h
2015-07-04 17:34:37 +02:00
Guus Sliepen
37588b8d5c Don't #include OpenSSL headers when compiling without OpenSSL. 2015-07-04 17:34:31 +02:00
thorkill
abb24e9d71 Cleanup local_address in protocol_edge.c
In line 131 local_address has been defined,
but the memory was never freed on return.
2015-07-04 03:24:13 +02:00
thorkill
92df36a610 Cleanup edges stored in edge_weight_tree on exit
protocol_edge.c: 131 defines local_address using str2sockaddr

str2sockaddr() allocates memory which has to be freed on exit.
2015-07-04 03:24:05 +02:00
thorkill
1140ca6d30 Fixed 2 leaks in setup_myself() 2015-07-04 03:23:58 +02:00
thorkill
e3ae318059 Cleanup local_address in protocol_edge.c
In line 131 local_address has been defined,
but the memory was never freed on return.
2015-07-04 03:21:01 +02:00
thorkill
d08c7cf4cf Cleanup edges stored in edge_weight_tree on exit
protocol_edge.c: 131 defines local_address using str2sockaddr

str2sockaddr() allocates memory which has to be freed on exit.
2015-07-04 02:39:12 +02:00
thorkill
6efd3ff302 Fixed 2 leaks in setup_myself() 2015-07-04 00:29:36 +02:00
thorkill
b342d0cfb6 Added simple connection tests 2015-07-02 22:06:14 +02:00
thorkill
8a6c5595b1 Added ./configure --enable-devel to enable -Werror and other developement settings 2015-07-02 21:55:50 +02:00
thorkill
94703cdfa9 getopt.c fixes for unitialized parameters on FreeBSD 2015-07-02 21:48:15 +02:00
thorkill
ad58c0f65d Revert "Marked missing parameters in getopt.c on FreeBSD"
This reverts commit 5bba2cc066.
2015-07-02 21:45:43 +02:00
thorkill
5bba2cc066 Marked missing parameters in getopt.c on FreeBSD 2015-07-02 21:42:44 +02:00