Neil Alexander
cd86c33850
Try to tidy up a bit, move checks for if we are already calling/connected
...
Something I noticed when working on reconfigure support for the "Listen"
option is that we have some rather huge weaknesses in our multicasting
design. Right now if we change our Listen address, it's not really
possible for remote nodes to know whether they are still connected to
us, so they start connecting in response to our changed beacons. They
can't know that they already know about us until *after* the handshake
but this registers in the local client log as repeated Connect/Disconnects
even though the existing peerings never actually drop.
2018-12-30 21:11:16 +00:00
Neil Alexander
80c9a1bc12
Don't track localAddr in conns as it is irrelevant
2018-12-30 16:48:34 +00:00
Neil Alexander
cb4495902b
Allow updating Listen during runtime
2018-12-30 15:21:09 +00:00
Neil Alexander
f96747181d
Allow updating AdminListen during runtime
2018-12-30 12:26:55 +00:00
Neil Alexander
7fae1c993a
Handle errors from reconfigure tasks
2018-12-30 12:04:42 +00:00
Neil Alexander
2925920c70
Use mutex in switch/tcp init
2018-12-29 19:53:31 +00:00
Neil Alexander
fa7c4117b4
Use Core.config in init functions
2018-12-29 19:14:26 +00:00
Neil Alexander
219fb96553
Support notifying components for config reload, listen for SIGHUP
2018-12-29 18:51:51 +00:00
Neil Alexander
4e03bdb054
Don't process ICMPv6 messages when in TUN mode
2018-12-26 22:45:21 +00:00
Neil Alexander
74692b689a
Fix OpenBSD (tested and working on 6.4)
2018-12-26 12:25:28 +00:00
Neil Alexander
b3d6c9a385
Print when peermacs learned
2018-12-26 11:57:08 +00:00
Neil Alexander
9eeb482587
Use ICMPv6 NDP target instead of source address when populating peermacs
2018-12-26 11:51:21 +00:00
Arceliar
50ed92d6d2
insert a copy when calling dht.insertPeer
2018-12-26 00:18:51 -06:00
Tristan B. Kildaire
b66049c14f
Typo fix
...
Typo fix in function's header comment.
2018-12-22 11:31:52 +02:00
Neil Alexander
0dfdc789d3
Merge pull request #275 from neilalexander/nodeinfomask
...
Allow hiding nodeinfo defaults
2018-12-22 08:54:37 +00:00
Arceliar
59093aa43b
clean up node info immediately if it reaches the timeout or if it needs refreshing but won't be pinged due to being unimportant
2018-12-21 17:45:24 -06:00
Neil Alexander
f6b0075989
Case-insensitive checking of null if string, don't print the nodeinfo again
2018-12-21 10:04:32 +00:00
Neil Alexander
586deed0f9
Add NodeInfoPrivacy option for not including defaults, and also check for null/"null" instead of "hide"
2018-12-21 09:56:34 +00:00
Arceliar
f59852b1e1
adjust how dht throttle works, it should now back off faster, and back off even more if things are not in use
2018-12-20 20:16:51 -06:00
Neil Alexander
60549cfa09
Adds special keyword 'hide' for masking built-in nodeinfo defaults
2018-12-20 23:49:15 +00:00
Arceliar
dfcdafa55c
move special peer/dht insert logic form router.go to dht.go
2018-12-20 17:37:59 -06:00
Neil Alexander
8ec4c66f65
Multithread the admin socket
2018-12-17 19:06:52 +00:00
Neil Alexander
6e87791e50
Merge pull request #256 from Arceliar/tcp
...
Minor TCP change
2018-12-17 10:20:23 +00:00
Arceliar
300f471bab
don't SetKeepAlive[Period] on tcp connections, since the behavior is platform specific
2018-12-16 18:32:50 -06:00
Arceliar
db034ce6bd
replace panics with warning messages if the tun reader/writer return an error
2018-12-16 17:23:07 -06:00
Arceliar
d9f212dd39
don't panic if we write to a closed tun device because tun.close() was called
2018-12-16 17:01:59 -06:00
Arceliar
28c7d75a20
fix conflicts with nodeinfo and update that for new crypto type names
2018-12-15 18:11:02 -06:00
Arceliar
89f9f5defb
fix merge conflicts
2018-12-15 17:57:36 -06:00
Neil Alexander
e0ff3ca587
Rename Metadata to NodeInfo
2018-12-15 22:37:11 +00:00
Neil Alexander
226c72df16
Set max metadata size to 16kb
2018-12-15 13:18:35 +00:00
Neil Alexander
07c26176b6
Fix core.SetMetadata
2018-12-15 12:21:00 +00:00
Neil Alexander
9a5cf96c29
Rename admin socket getMeta to getMetadata
2018-12-15 12:18:52 +00:00
Neil Alexander
92bb63f196
Use metadata from config file
2018-12-15 11:38:51 +00:00
Neil Alexander
d9884a5cac
Make use of metadata cache
2018-12-15 11:15:48 +00:00
Neil Alexander
d07e0ddfa0
Default metadata
2018-12-15 10:56:46 +00:00
Neil Alexander
8b63e841ea
Make threadsafe, add cache
2018-12-15 10:39:31 +00:00
Arceliar
4875ab8954
peer thread safey for dhtInfo updates
2018-12-14 21:44:31 -06:00
Arceliar
570e85c297
remove debug code
2018-12-14 21:12:25 -06:00
Arceliar
ea4ca02681
fix code after moving address/crypto/util
2018-12-14 20:49:18 -06:00
Neil Alexander
cdd2e7910a
Merge remote-tracking branch 'origin/develop' into metadata
2018-12-15 00:48:54 +00:00
Neil Alexander
d5031a5cb6
Metadata exchange without sessions
2018-12-15 00:48:27 +00:00
Arceliar
2c68d41409
move files, still need to fix exports and compile errors
2018-12-14 18:30:36 -06:00
Arceliar
abd8b69979
send a switch message immediately when peering, and use OS-level TCP keep-alive (shouldn't matter right now, since we have application-level keep-alive that preempts it, but important later)
2018-12-14 18:15:35 -06:00
Neil Alexander
f9dc300787
Define Adapter base type/interface
2018-12-14 18:29:00 +00:00
Neil Alexander
8045cb4dc3
Define generic adapter type, rename tunDevice to tunAdapter
2018-12-14 18:21:08 +00:00
Neil Alexander
f28360ce4d
Fix debug builds (foiled by debug builds every time)
2018-12-14 18:10:39 +00:00
Neil Alexander
2a38ad07cd
Don't send ICMPv6 back when tun disabled
2018-12-14 18:08:40 +00:00
Neil Alexander
9eaa2566c1
Parameterise tun.init
2018-12-14 18:08:13 +00:00
Neil Alexander
3ca5f10733
Don't try to correct peers with no schemes in addPeer
2018-12-14 17:52:54 +00:00
Neil Alexander
10157483f9
Move tunDevice into router
2018-12-14 17:35:02 +00:00
Neil Alexander
a9907a7878
Fix debug builds after 64060a4
2018-12-12 22:59:55 +00:00
Neil Alexander
64060a447c
Remove metadata-peer association until we have some sensible way to cache it
2018-12-12 22:58:16 +00:00
Neil Alexander
74de8c9416
Consistent function naming for metadata
2018-12-12 22:48:04 +00:00
Neil Alexander
042a3400fe
Wrap the metadata with a mutex to guarantee thread safety across core/router/sessions
2018-12-12 22:40:49 +00:00
Neil Alexander
97464feba9
Working metadata exchange
2018-12-12 19:51:28 +00:00
Neil Alexander
6200136fce
Merge branch 'descriptive' into metadata
2018-12-12 18:04:49 +00:00
Arceliar
6901e2fc9a
Merge pull request #238 from neilalexander/afunix
...
Use AF_UNIX socket by default for admin API
2018-12-10 17:34:36 -06:00
Neil Alexander
90ace46587
Enforce CKR cache size more strongly
2018-12-10 22:30:31 +00:00
Neil Alexander
65e34bbbab
Enforce maximum CKR routing cache size
2018-12-10 22:19:08 +00:00
Neil Alexander
f09adc2192
Update getRoutes format
2018-12-10 22:04:37 +00:00
Neil Alexander
dff1dca19c
Add DefaultConfigFile to defaults for yggdrasilctl
2018-12-10 10:20:59 +00:00
Neil Alexander
8aaaeb26eb
Default to /var/run/yggdrasil.sock for admin on Linux, BSDs
2018-12-10 00:37:32 +00:00
Neil Alexander
bbe2f56b74
Default to /var/run/yggdrasil.sock for admin on darwin/macOS
2018-12-10 00:31:31 +00:00
Neil Alexander
74a904d04c
Don't os.Chmod if we suspect the socket belongs to an abstract namespace
2018-12-10 00:26:12 +00:00
Neil Alexander
06c6dfc67f
Complain if socket file already exists
2018-12-10 00:19:21 +00:00
Neil Alexander
f791df4977
Try to chmod 660 the admin socket if using AF_UNIX
2018-12-10 00:00:23 +00:00
Neil Alexander
6801d713a7
Also don't start if AdminListen is empty
2018-12-09 17:53:31 +00:00
Neil Alexander
80d087404f
Allow disabling admin socket with AdminListen="none"
2018-12-09 17:46:48 +00:00
Neil Alexander
02f98a2592
Only show build name and version if it is known
2018-12-08 11:01:05 +00:00
Arceliar
af478e0e45
fix very special case bug when trying to dhtPing the root via the admin api
2018-12-08 00:42:13 -06:00
Arceliar
bd2d706745
fix bug from go vet while I'm at it
2018-12-07 20:36:30 -06:00
Arceliar
586781b49c
convert to go module
2018-12-07 19:56:04 -06:00
Neil Alexander
5149c6c349
Show build name and version at startup if available
2018-12-07 22:24:01 +00:00
Neil Alexander
3524c6eff6
Add build name and version to getSelf call on admin socket
2018-12-07 22:22:46 +00:00
Neil Alexander
8e784438c7
Imprint build name and version number if available
2018-12-07 22:20:11 +00:00
Arceliar
fe772dd38e
switch bugfixes
2018-12-05 18:22:39 -06:00
Arceliar
09228554cb
Merge pull request #223 from neilalexander/reusemulticast
...
Try to SO_REUSEPORT on multicast socket
2018-12-05 18:15:21 -06:00
Neil Alexander
ae48a1721e
Try to SO_REUSEADDR on Windows
2018-12-05 23:10:50 +00:00
Neil Alexander
eae8f9a666
Try to SO_REUSEPORT on UNIX platforms
2018-12-05 22:39:04 +00:00
Arceliar
3d4b49b693
reset the switch speed info for a peer whenever it changes coords, instead of only if they're a parent and change coords. Also, make sure packets in the sim preserve order when sending, to avoid races when testing
2018-12-03 19:21:23 -06:00
Arceliar
684632eb3d
Merge pull request #215 from Arceliar/switch
...
Latency-based parent selection for the switch
2018-12-02 17:26:26 -06:00
Neil Alexander
5a89a869be
Set queueTotalMaxSize before switch worker starts
2018-12-02 23:24:54 +00:00
Neil Alexander
b5f4637b5c
Enforce min 4MB switch queue total size
2018-12-02 23:20:11 +00:00
Neil Alexander
319457ae27
Update comment for MaxTotalQueueSize
2018-12-02 23:03:10 +00:00
Neil Alexander
86da073226
Add SwitchOptions and MaxTotalQueueSize
2018-12-02 22:49:27 +00:00
Arceliar
dcfe55dae8
store 'faster' relationships between all pairs of peers, to make fallback easier when a parent goes offline
2018-12-02 16:36:25 -06:00
Arceliar
38093219fd
dimensionless way to track how often nodes are faster than the current parent
2018-12-02 14:46:58 -06:00
Arceliar
b3e2b8e6a5
Update admin.go
...
Replace `nil` with `[]string{}` for `list`'s argument list.
2018-11-26 19:15:27 -06:00
Neil Alexander
099fee9cae
Rename destPubKey to box_pub_key in addRoute etc
2018-11-26 17:58:54 +00:00
Neil Alexander
315aadae06
Rename help to list
2018-11-26 17:51:30 +00:00
Neil Alexander
8239989c36
Send box_pub_key with getSessions, getDHT, getSwitchPeers and getPeers
2018-11-26 17:38:02 +00:00
Neil Alexander
5b10af7399
Rename key to box_pub_key in admin socket for consistency
2018-11-26 17:34:26 +00:00
Arceliar
d8d1e63c36
fix infinite loop from interaction between dht.isImportant and dht.insert
2018-11-25 20:33:33 -06:00
Arceliar
0ec6207e05
better response format and yggdrasilctl printing
2018-11-25 18:25:31 -06:00
Arceliar
a34ca40594
use a buffered channel to avoid races, and run gofmt
2018-11-25 17:59:36 -06:00
Arceliar
7954fa3c33
store one callback instead of many, needed to prevent search failures if there are multiple outstanding packets
2018-11-25 17:08:45 -06:00
Arceliar
9937a6102e
add callbacks to maintenance map cleanup
2018-11-25 16:29:47 -06:00
Arceliar
12e635f946
adjust dhtPing response so 'nodes' defaults to an empty list instead of null
2018-11-25 16:16:06 -06:00
Arceliar
d520a8a1d5
refactor dht code to call arbitrary callbacks instead of only searches.checkDHTRes, and add admin API fuction to dhtPing a node (with an optional target NodeID)
2018-11-25 16:10:32 -06:00
Arceliar
e17efb6e91
don't penalize dht timeouts a second time
2018-11-25 13:21:13 -06:00
Arceliar
9046dbde4f
remove sigManager, it seems safer to just burn the CPU than to store a map of strings of potentially arbitrary length
2018-11-25 13:06:54 -06:00
Arceliar
4e156bd4f7
better cleanup of maps
2018-11-25 12:25:38 -06:00
Arceliar
8d6beebac4
clean up old requests during dht maintenance
2018-11-24 20:04:14 -06:00
Neil Alexander
5a7c2b250c
Merge pull request #209 from Arceliar/switch-tune
...
Adjust switch parent selection behavior
2018-11-24 23:21:45 +00:00
Arceliar
6d0e40045a
cleanup/fixes from go vet
2018-11-22 21:41:16 -06:00
Arceliar
4870a2e149
removeSourceSubnet and removeRoute via the admin api
2018-11-22 21:30:56 -06:00
Arceliar
5953027411
switch from []byte to boxPubKey in ckr code, and start adding admin functions for existing code (yggdrasilctl.go still needs pretty printing support for the responses to the new get functions)
2018-11-21 00:10:20 -06:00
Arceliar
5fa23b1e38
move router.recvPacket calls into the main router goroutine, to make the ckr checks threadsafe
2018-11-20 22:04:18 -06:00
Arceliar
e9cff0506c
comment the switch a little better and limit how much uptime can affect which peer is used as a parent
2018-11-19 21:30:52 -06:00
Arceliar
ef6cece720
fix sim and tune dht to bootstrap a little faster
2018-11-16 19:32:12 -06:00
Neil Alexander
fc5a5830aa
Merge pull request #203 from Arceliar/chord
...
Chord
2018-11-14 20:13:42 +00:00
Arceliar
8cf8b0ec41
fix bug in recvPacket for packets coming from a subnet
2018-11-11 00:00:47 -06:00
Arceliar
1b1b776097
fix crash when starting in tun mode
2018-11-10 22:39:15 -06:00
Neil Alexander
6fab0e9507
Fix CKR (IPv4/IPv6) in TAP mode so frames sent to node MAC, base MAC/LL from node IPv6 address
2018-11-10 18:33:52 +00:00
Neil Alexander
adc32fe92f
Track further neighbor state, don't send more NDPs than needed
2018-11-10 17:32:03 +00:00
Neil Alexander
d50e1bc803
More complete NDP implementation for TAP mode, which tracks individual MAC addresses for neighbors
2018-11-10 15:46:10 +00:00
Arceliar
15d5b3f82c
comments and minor cleanup
2018-11-09 23:02:38 -06:00
Neil Alexander
685b565512
Check IP header lengths correctly per protocol
2018-11-07 10:29:08 +00:00
Neil Alexander
9542bfa902
Check the session perm pub key against the CKR key
2018-11-07 10:16:46 +00:00
Neil Alexander
fbfae473d4
Use full node ID for CKR routes instead of truncated node IDs from the address/subnet
2018-11-07 10:04:31 +00:00
Neil Alexander
39dab53ac7
Update comments in configuration and some godoc descriptions
2018-11-06 22:57:53 +00:00
Neil Alexander
a3a53f92c3
Reinstate length/bounds check in tun.go
2018-11-06 22:35:28 +00:00
Neil Alexander
0240375417
IPv4 CKR support in router
2018-11-06 20:49:19 +00:00
Neil Alexander
424faa1c51
Support IPv4 in ckr.go
2018-11-06 20:04:49 +00:00
Neil Alexander
cb7a5f17d9
Check destination address upon receive in router
2018-11-06 19:23:20 +00:00
Neil Alexander
2f75075da3
Fix Yggdrasil subnet routing
2018-11-06 14:28:57 +00:00
Neil Alexander
bc62af7f7d
Enable CKR properly from config
2018-11-06 12:32:16 +00:00
Neil Alexander
bc578f571c
Some output at startup
2018-11-06 11:56:32 +00:00
Neil Alexander
f0947223bb
Only validate CKR routes if CKR enabled
2018-11-06 11:11:57 +00:00
Neil Alexander
19e6aaf9f5
Remove sourceSubnet from router
2018-11-06 00:06:37 +00:00
Neil Alexander
e3d4aed44a
Configure IPv6Sources
2018-11-06 00:05:01 +00:00
Neil Alexander
8c2327a2bf
Add source addresses option and more intelligent source checking
2018-11-05 23:59:41 +00:00
Neil Alexander
cfdbc481a5
Modify source address check for CKR
2018-11-05 23:22:45 +00:00
Neil Alexander
7218b5a56c
Don't look up public keys for Yggdrasil native addresses
2018-11-05 23:12:26 +00:00
Neil Alexander
c7f2427de1
Check CKR routes when receiving packets in router
2018-11-05 22:58:58 +00:00
Neil Alexander
87b0f5fe24
Use CKR in router when sending packets
2018-11-05 22:39:30 +00:00
Neil Alexander
295e9c9a10
Cache crypto-key routes (until routing table changes)
2018-11-05 17:31:10 +00:00
Neil Alexander
ec751e8cc7
Don't allow Yggdrasil ranges as crypto-key routes
2018-11-05 17:03:58 +00:00
Neil Alexander
52206dc381
Add initial crypto-key routing handlers
2018-11-05 16:40:47 +00:00
Arceliar
a008b42f99
cleanup and some bugfixes, cache important dht nodes until something gets added/removed
2018-10-29 22:24:18 -05:00
Arceliar
671c7f2a47
don't update recv time for known nodes that ping us or known peers
2018-10-28 15:04:44 -05:00
Arceliar
c0531627bc
fix some chord dht bootstrapping bugs, no known cases where it now fails
2018-10-24 22:03:27 -05:00
Arceliar
253861ebd3
reverse dht ownership order from predecessor to successor, this plays nicer with the default 0 bits in unknown node IDs
2018-10-21 18:15:04 -05:00
Arceliar
5e3959f1d0
yet more debugging
2018-10-21 17:40:43 -05:00
Neil Alexander
20c4b7027a
Fix merge conflicts with endpoints branch
2018-10-21 23:24:29 +01:00
Neil Alexander
aab0502a4a
Remove friendlyname traces, preserve endpoints
2018-10-21 23:20:14 +01:00
Neil Alexander
a1b72c16d8
Some attempt at exchanging session metadata over the wire (broken)
2018-10-21 22:58:27 +01:00
Arceliar
f0bd40ff68
more testing
2018-10-21 15:10:18 -05:00
Arceliar
bcbd24120d
keep track of all keys we're supposed to care about in the dht, don't give special treatment to successors/predecessors
2018-10-21 14:57:04 -05:00
Arceliar
efe6cec11a
more debugging, trying to understand bootstrap issues
2018-10-21 12:28:21 -05:00