Commit Graph

311 Commits

Author SHA1 Message Date
Adam Ierymenko
a064e19b8a Refactor some JSON stuff for performance, and fix a build error. 2017-01-10 13:51:10 -08:00
Adam Ierymenko
6fb49f68fc Comment out and disable old auto-update code. 2017-01-10 12:20:29 -08:00
Grant Limberg
e2b1a7157e Potential fix for routing issue on Windows
Move setting _initialized = true until after WindowsEthernetTap::threadMain() has actually created and brought up the adapter.  Also in OneService::nodeVirtualNetworkConfigFunction(), wait up to 5 seconds for WindowsEthernatTap::isInitialized() to return true before attempting to configure the interface and managed routes.  Without this, the adapter doesnt actually exist yet when trying to add routes
2017-01-05 11:43:26 -08:00
Adam Ierymenko
a54c2b438c Basic support for streaming of changes via stdout from controller. 2016-12-15 15:08:47 -08:00
Adam Ierymenko
890f6f0d35 Make allow management from a local.conf parameters. 2016-12-12 16:25:41 -08:00
Adam Ierymenko
bad4b72f82 Remove debug printf. 2016-12-12 14:44:21 -08:00
Adam Ierymenko
4702c5b4ee Add local.conf option to blacklist interfaces by name. 2016-12-12 14:43:09 -08:00
Adam Ierymenko
44f0e3097e docs 2016-11-29 10:56:16 -08:00
Adam Ierymenko
ae8f51d608 . 2016-11-23 16:27:15 -08:00
Adam Ierymenko
4a7ee5472d Small fixes. 2016-11-23 16:23:44 -08:00
Adam Ierymenko
8718b33a66 docs 2016-11-23 15:57:06 -08:00
Adam Ierymenko
27f1155f1b docs and API stuff 2016-11-23 15:53:53 -08:00
Adam Ierymenko
84732fcb12 Wire through external path lookup. Static paths should now work. 2016-11-22 14:23:13 -08:00
Adam Ierymenko
42ba70e79e Replace long callback arg list with struct, and implement path whitelisting, path blacklisting, and local.conf support for roles. 2016-11-22 10:54:58 -08:00
Adam Ierymenko
97d915b06c Expose relay policy in node settings. 2016-11-21 15:35:18 -08:00
Adam Ierymenko
d159e5ca44 Allow relay policy setting in local.conf 2016-11-21 15:21:24 -08:00
Adam Ierymenko
40078a99de Make parse failure of local.conf non-fatal in case people have ancient files sitting around. 2016-11-21 14:14:43 -08:00
Adam Ierymenko
2e5de46584 local.conf and support for virtual role definition 2016-11-21 13:20:56 -08:00
Adam Ierymenko
ccdd4ffda7 Move split() to OSUtils since it is not used in core. 2016-11-18 15:49:28 -08:00
Adam Ierymenko
4ad942522b Kill unnecessary check in another spot. 2016-11-14 15:57:46 -08:00
Adam Ierymenko
b6c99ba3ef Add (currently undocumented) option to allow management from certain networks. 2016-11-14 15:47:06 -08:00
Adam Ierymenko
ee5bd57d40 We don't bind to non-local IP for TCP yet, but eliminate double check. 2016-11-14 15:29:36 -08:00
Adam Ierymenko
c61ca1dea2 Keep connections up for netconf stuff as well as frames. 2016-11-09 16:04:08 -08:00
Grant Limberg
00e1b0ed10 added docs for allowManaged, allowGlobal, allowDefault 2016-11-08 11:00:48 -08:00
Grant Limberg
4f8feaa530 update JSON API docs for OneService 2016-11-08 10:23:25 -08:00
Adam Ierymenko
8d0b2b781e Route management bug fixes. 2016-09-13 16:25:48 -07:00
Adam Ierymenko
5b6d27e659 Implement relay policy, and setting multicast limit to 0 now disables multicast on the network as would be expected. 2016-09-13 14:27:18 -07:00
Adam Ierymenko
b5c86b6ba4 Bunch more path refactoring. Peers no longer forget paths, but do not normally use expired paths. Expired paths might still be tried if nothing else is reachable. 2016-09-07 11:13:17 -07:00
Adam Ierymenko
d7f2287ce9 More tweaks to path behavior. 2016-09-05 15:47:22 -07:00
Adam Ierymenko
eebcf08084 Tweaks to new Path code for dual-stack operation, and other fixes. 2016-09-03 15:39:05 -07:00
Adam Ierymenko
8e3463d47a Add length limit to TEE and REDIRECT, and completely factor out old C json-parser to eliminate a dependency. 2016-08-24 13:37:57 -07:00
Adam Ierymenko
faa9a06bf5 Controller fixes... 2016-08-17 17:37:37 -07:00
Adam Ierymenko
a13f4d8353 We now always build the controller in ZeroTier One, at least for desktop and server targets. Also means that ZeroTier One now requires C++11. (Still keeping C++11 out of the core in node/ though.) 2016-08-17 10:42:32 -07:00
Adam Ierymenko
402d99ea8d C++11 mode build fix. 2016-08-16 14:07:11 -07:00
Adam Ierymenko
98152d974a More cleanup and removal of DeferredPackets, will do the latter in a more elegant way. 2016-08-04 11:40:38 -07:00
Adam Ierymenko
7e6e56e2bc Bunch of work on pushing and replication of tags and capabilities, and protocol cleanup. 2016-08-03 18:04:08 -07:00
Adam Ierymenko
8912515011 Fix to fix to GitHub issue #352 2016-07-12 15:00:30 -07:00
Adam Ierymenko
6ec3464ee9 JSON fix for trusted paths (does not affect normal op) 2016-07-12 13:58:15 -07:00
Adam Ierymenko
b5e9d3f6f4 Rename file to be intuitive. 2016-07-12 11:41:19 -07:00
Adam Ierymenko
9657675755 Plumbing through trusted path stuff to OneService. 2016-07-12 11:30:22 -07:00
Adam Ierymenko
cdb5ceac7b Should remove old IPs before trying to add new ones. 2016-07-12 09:43:12 -07:00
Adam Ierymenko
6535730255 GitHub issue #352 2016-07-12 08:42:36 -07:00
Adam Ierymenko
6d8de214eb Docs and controller API version 2016-07-08 13:10:02 -07:00
Adam Ierymenko
32d9850263 More new CLI work. 2016-06-23 12:37:15 -07:00
Adam Ierymenko
f765597526 Add network local.conf stuff to save network permission settings and wire it all through via the JSON API. Default route and route management stuff just about done. 2016-06-21 16:52:49 -07:00
Adam Ierymenko
674b84d908 Plumbing for network setting control, and GitHub issue #330 2016-06-21 14:58:30 -07:00
Adam Ierymenko
4f237687ce Route management now works on Windows, including default route override! 1.1.6 very close! 2016-06-21 13:54:03 -07:00
Adam Ierymenko
5b2d2efb45 Windows builds again. And there was much rejoicing. 2016-06-21 12:55:43 -07:00
Adam Ierymenko
b2d048aa0e Make Dictionary templatable so it can be used where we want a higher capacity. 2016-06-21 07:32:58 -07:00
Adam Ierymenko
3ee15e65aa Tying up default route and route mgmt loose ends. It now periodically updates shadow routes so hopefully your link will stay up as you move around. 2016-06-17 13:14:48 -07:00
Adam Ierymenko
1bf1c38b30 Default route population works on Mac! 2016-06-16 18:23:33 -07:00
Adam Ierymenko
eb4a78bcc3 Report routes in locally joined network JSON. 2016-06-16 17:40:32 -07:00
Adam Ierymenko
3c655a4b84 Default route ready to test on Mac. 2016-06-15 15:46:57 -07:00
Adam Ierymenko
b90e66f7c7 ManagedRoute, which applies C++ RAII to injected routes. Move RoutingTable to attic. 2016-06-15 15:02:40 -07:00
Adam Ierymenko
4446dbde5e Big refactor in service code to prep for plumbing through route management. 2016-06-14 10:09:26 -07:00
Adam Ierymenko
536feb632c Support yet another old version of http-parser for CentOS/EPEL. 2016-06-08 15:09:09 -07:00
Adam Ierymenko
4da9d4e53a Fix build against Debian version of libhttp-parser -- its old but it will work. 2016-06-08 12:49:07 -07:00
Adam Ierymenko
2f18a92e20 Cleanup in numerous places, reduce network chattiness around MULTICAST_LIKE, and fix a "how was that working" latent bug causing some control traffic to take the scenic route. 2016-04-19 12:09:35 -07:00
Adam Ierymenko
b3cac538cc Store lat/lon too for testing and future display use. 2016-04-18 15:48:33 -07:00
Adam Ierymenko
587b1e05d1 Replace cluster-geo subprocess with in-memory loaded CSV of GeoIP data. This is faster, cheaper, more reliable. We use https://db-ip.com/ but others would work too. 2016-04-18 11:33:54 -07:00
Adam Ierymenko
02c3727ccd . 2016-04-18 10:21:38 -07:00
Adam Ierymenko
63b62ebf4c Boost local interface check interval a bit to speed direct link provisioning on startup. 2016-04-07 12:13:18 -07:00
Adam Ierymenko
569de22481 Make port mapper names even more unique, and trial bind before binding TCP now which should work on Linux and others. 2016-04-07 09:51:14 -07:00
Adam Ierymenko
c7df61a3c3 dev branch now works again on Linux 2016-04-07 16:41:07 +00:00
Adam Ierymenko
504738b183 Binder for Windows, and use Binder to get local interface addresses to advertise. 2016-04-05 15:53:19 -07:00
Adam Ierymenko
32cd2a02c9 OneService now binds all ports to specific local interfaces instead of wildcard and rebinds on changes. (default route) 2016-04-05 15:44:08 -07:00
Adam Ierymenko
4a109658ab More refactoring and prep for explicit interface bindings (for default route support). 2016-04-05 11:59:46 -07:00
Adam Ierymenko
0e26917c72 Tweak metric and clean out attic a bit. 2016-04-01 11:07:44 -07:00
Adam Ierymenko
1fe251d0a0 stupid bug is stupid 2016-03-03 14:50:47 -08:00
Adam Ierymenko
09fc9e4d0c indent fix 2016-03-03 14:21:13 -08:00
Adam Ierymenko
fe3a84a422 Fix problems with previous commit. 2016-03-03 14:15:09 -08:00
Adam Ierymenko
ba56a5b9d1 Another NAT-t improvement:
Many NATs revert to symmetric behavior from friendlier modes if they cannot
preserve ports. This can occur if there is, for example, more than one ZT
device behind the NAT using port 9993.

Others (Airport Extreme?) seem to have bugs in which they completely freak
out if more than one device tries to do a lot of mappings using the same
internal local port.

Mostly to fix the latter case and somewhat to fix the former, we introduce
a secondary port. ZeroTier now binds 9993 (or whatever port you specify)
plus another port computed deterministically from your ZeroTier address.
This port is used for new links 1/4 of the time.

This mostly addresses the second problem above and partly helps to address
the first.

If uPnP/NAT-PMP is enabled we also still open a tertiary port because some
routers freak out if NAT-t is attempted using the same port as uPnP.

All of this is IPv4 only of course. IPv6 is sane.
2016-03-03 13:52:27 -08:00
Joseph Henry
bcaf42e075 Transfer speed increate + stability fixes 2016-01-20 13:38:14 -08:00
Adam Ierymenko
4e4fd51117 boring doc stuff 2016-01-12 14:04:55 -08:00
Adam Ierymenko
d6f0f1a82a Use network user ptr in lookup for Ethernet frame handling to eliminate map lookup. 2016-01-12 11:34:22 -08:00
Adam Ierymenko
83ef98a9dc Add a network-associated user ptr in API. 2016-01-12 11:04:35 -08:00
Adam Ierymenko
b3e3d4cacc Instead of using binary packet comparison, add a callback to the API to explicitly check whether paths should be used. Check in with this callback (if present) when learning new paths or sending initial packets. 2016-01-11 10:17:44 -08:00
Adam Ierymenko
eea634a432 Refactor to eliminate copypasta. 2016-01-11 09:11:35 -08:00
Adam Ierymenko
ab19e19f00 Fix a bug that we visually found in Windows code -- it was not advertising uPnP addresses?!? 2016-01-11 09:09:24 -08:00
Adam Ierymenko
436c1fac1d Selectively move over changes from "edge" to "dev" excluding netcon. 2015-12-21 16:15:39 -08:00
Adam Ierymenko
944fdfb65e Low-impact sanity check against GitHub issue #247 -- will likely prevent other weird recursions too. 2015-11-30 16:44:32 -08:00
Adam Ierymenko
40a4ba6e39 indentation 2015-11-30 15:15:43 -08:00
Adam Ierymenko
6768521330 Ton of uPnP work and adding NAT-PMP support, still testing... 2015-11-30 13:10:22 -08:00
Adrian Frühwirth
038476c412 Fix for GitHub issue #253.
Make 'ip' detection more robust (some distros don't ship the binary in /sbin or /usr/sbin).
Add error handling for cases where an ip add/remove fails.
2015-11-24 22:56:02 +01:00
Adam Ierymenko
37acd375d6 Fix 64-bit int warning. 2015-11-16 18:10:40 -08:00
Adam Ierymenko
ddf0cb0278 Docs and tweak some caching values. 2015-11-16 09:54:08 -08:00
Adam Ierymenko
54f68280bd Minor Windows build fixes. Builds on VS2012 again. 2015-11-12 16:48:42 -08:00
Adam Ierymenko
451b8aa7b2 Query both root and network controller for multicast last resort GATHER. 2015-11-10 17:37:38 -08:00
Adam Ierymenko
2cc50bdb10 Try bringing back TTL escalation -- may help with Docker (IP-MASQ) type NAT 2015-11-09 15:44:13 -08:00
Adam Ierymenko
35c4e28f31 Mark geo-redirected paths as suboptimal and do not report that we have a peer if all we have is one of these. Also a few other small fixes. 2015-11-09 14:25:28 -08:00
Adam Ierymenko
83c6b7ab3d Use bigger UDP buffer on bigger x64 machines. Keep old value elsewhere since these are likely to be smaller boxes. 2015-11-05 17:41:07 -08:00
Adam Ierymenko
3e22fee842 Integrate deferred background processing into main OneService implementation. 2015-11-05 12:41:14 -08:00
Adam Ierymenko
a994573a43 Eliminate some more dead code. We may do path trust, but not like that. 2015-10-29 09:42:15 -07:00
Adam Ierymenko
16bc3e0398 Factor out RemotePath subclass of Path -- no longer needed, just cruft. 2015-10-27 15:00:16 -07:00
Adam Ierymenko
7295fcfa86 Merge Phy<> from netcon. 2015-10-27 12:50:23 -07:00
Adam Ierymenko
0ffbd05c0e --wtf; prevent roots from TCP fallback 2015-10-27 12:21:57 -07:00
Adam Ierymenko
0b82c9ebad Fix infinite loop if there are no live roots (never happened before?!? wow!) 2015-10-26 16:09:56 -07:00
Adam Ierymenko
6625d79296 Fix if cluster compiled in but not enabled. 2015-10-26 13:07:00 -07:00
Adam Ierymenko
debed1ac2d Expose cluster status in /status JSON response. 2015-10-26 13:06:10 -07:00
Adam Ierymenko
29b966894c (1) Fix bug in geo-ip service that prevented cache lookup, (2) fix problem in SelfAwareness (will need to test ALL versions in the wild with this), and (3) add more TRACE instrumentation to Cluster. 2015-10-23 13:03:34 -07:00
Adam Ierymenko
2a3dd53952 . 2015-10-22 17:50:00 -07:00
Adam Ierymenko
dee6e7e3c1 . 2015-10-22 16:11:48 -07:00
Adam Ierymenko
7711eba297 More cluster wiring... 2015-10-22 16:02:01 -07:00
Adam Ierymenko
1bc451ed10 GeoIP cluster service works. 2015-10-22 10:41:15 -07:00
Adam Ierymenko
e07bae2525 Run geoip cluster service sub-process. 2015-10-22 10:18:05 -07:00
Adam Ierymenko
385f1410d2 Expose world info in JSON. 2015-10-13 12:33:15 -07:00
Adam Ierymenko
5d2f523e81 World stuff... 2015-10-13 12:10:44 -07:00
Adam Ierymenko
cae58f43f1 More World stuff, and mkworld. 2015-10-13 08:49:36 -07:00
Adam Ierymenko
7394ec6f6a Prep in controller code to run tests. 2015-10-06 15:56:18 -07:00
Adam Ierymenko
5076c49210 Peer serialization and related changes. 2015-10-01 15:40:54 -07:00
Adam Ierymenko
72e7e36a5b No reason to randomly pick uPnP secondary port. In fact it would likely cause problems on restarts and uPnP rule bloat. 2015-10-01 14:40:28 -07:00
Adam Ierymenko
a7409850d6 Get trim() out of core where it is not needed. 2015-10-01 12:37:18 -07:00
Adam Ierymenko
f69454ec98 (1) Make ZT_ naming convention consistent (get rid of ZT1_), (2) Make local interface a full sockaddr_storage instead of an int identifier, which turns out to be better for multi-homing and other uses. 2015-09-24 16:21:36 -07:00
Adam Ierymenko
423412df98 Pick a random secondary UDP port for uPnP mapped traffic because of broken routers. 2015-09-23 15:16:20 -07:00
Adam Ierymenko
7821d1cbdd . 2015-09-23 14:44:13 -07:00
Adam Ierymenko
80dc7fb675 Pick random port on -p0 2015-09-23 14:38:16 -07:00
Adam Ierymenko
367ffde00c Plumb through localInterfaceId to track local interfaces corresponding with remote addresses. 2015-09-23 13:49:56 -07:00
Adam Ierymenko
9dc2ef5549 Rename some stuff in Phy since it can be used with any stream socket. 2015-09-10 15:55:48 -07:00
Adam Ierymenko
9a723be263 Add socketpair support to Phy. 2015-09-10 13:18:57 -07:00
Adam Ierymenko
4838cbc350 Unix domain sockets in Phy<> 2015-09-02 14:32:01 -07:00
Adam Ierymenko
b4487cefc9 Document rules requirement in controller. 2015-08-25 09:46:59 -07:00
Adam Ierymenko
867258de8b Document clock convenience field. 2015-08-25 09:44:21 -07:00
Adam Ierymenko
4da794b389 Add authorizedMemberCount to controller network config records. 2015-08-19 11:43:56 -07:00
Adam Ierymenko
620562f7cf Because Windows, because Windows. Now it upgrades correctly from 1.0.1, including automatic driver update from NDIS5 to NDIS6. Also a bit more robust on creating new ports, just in case. 2015-07-30 17:00:57 -07:00
Adam Ierymenko
8169b35482 Kill the devcon.exe dependency by dynamically loading cfgmgr32, newdev, and setupapi and using these functions directly. 2015-07-30 11:31:38 -07:00
Adam Ierymenko
2599b1bacc Add CLI support for /explicit/urls (automatically outputs JSON in this case), and some cleanup. 2015-07-28 17:10:56 -07:00
Adam Ierymenko
569c5e77fd Add binary build of libminiupnpc for Mac x64. 2015-07-28 14:48:26 -07:00
Adam Ierymenko
fe6d5b1402 UPNP/NAT-PMP support with libminiupnpc (if built with it) -- GitHub issue #64 2015-07-28 14:32:02 -07:00
Adam Ierymenko
40d5c79b62 Enable SO_NO_CHECK if available to skip UDP checksum on packet send for slight performance improvement. We do our own cryptographically secure authentication so UDP checksum is worthless. 2015-07-28 10:29:25 -07:00
Adam Ierymenko
a061aa3d87 Remove "members" from Network record and instead enumerate members via specific query to /network/nwid/member sub-path. More RESTful, scalable, and compatible with how OnePoint code works. 2015-07-21 12:57:01 -07:00
Grant Limberg
5ef806c43c Fix addLocalInterfaceAddress call in OneService on Windows 2015-07-16 19:20:43 -07:00
Adam Ierymenko
0db7c94c90 Add memberRevision stuff to JSON output, and update docs. 2015-07-16 17:42:47 -07:00
Adam Ierymenko
0b354803f3 Clean up some YAGNI issues with implementation of GitHub issue #180, and make best path choice aware of path rank. 2015-07-13 10:03:04 -07:00
Adam Ierymenko
c863ff3f02 A bunch of comments and cleanup, including some to yesterday's direct path pushing changes. Move path viability check to one place, and stop trying to use link-local addresses since they are not reliable. 2015-07-07 08:54:48 -07:00
Adam Ierymenko
25a067c8c3 Eliminate debug printf(). 2015-07-06 17:37:32 -07:00
Adam Ierymenko
91fa643131 Minor fix to Windows local adapter address enumeration. 2015-07-06 17:36:58 -07:00
Adam Ierymenko
f881cdd767 Add new .h file to VS build, and Windows side of local interface address enumeration. 2015-07-06 17:22:37 -07:00
Adam Ierymenko
a87cd2d094 Unix side of local interface address awareness for GitHub issue #180. 2015-07-06 16:32:34 -07:00
Adam Ierymenko
30e4a188d0 ipLocalRoutes now exposed via network objects in JSON controller API, and documentation changes. 2015-06-29 15:34:26 -07:00
Adam Ierymenko
dbee1b38b3 Fix semantics of std::unique() to actually remove duplicates (hidden memory leak?) 2015-06-29 10:21:28 -07:00
Adam Ierymenko
7bae95836c Root server terminology cleanup, and tighten up a security check by checking full identity of peers instead of just address. 2015-06-19 10:23:25 -07:00
Kees Bos
a425bbc673 Renamed supernode to rootserver 2015-05-06 12:05:20 +02:00
Adam Ierymenko
8a9715f183 Rename ruleId to ruleNo and optimize some indexes in Sqlite3 schema. 2015-06-13 10:05:34 +02:00
Kees Bos
42390e662b Pickup return code from handleControlPlaneHttpGET and handleControlPlaneHttpPOST 2015-06-13 03:14:06 +02:00
Kees Bos
0d0af07ce9 Get deletion of networks in controller going
Multiple statements in a sqlite3_prepare_v2 is not usable. Only
the first statement will be executed.

Since the schema now uses 'ON DELETE CASCADE', there's only
one statement needed.

If multiple statements are needed, there should be either multiple
sqlite3_prepare_v2 calls be used or the sqlite3_exec function.
2015-06-11 11:49:13 +02:00
Adam Ierymenko
7213a6cf0b Make max HTTP message size (max update size) larger since Windows MSI is about 8MB already. 2015-06-03 17:20:30 -07:00
Adam Ierymenko
7e647c5303 NOHUP-ify the child process on OSX auto-update. 2015-06-03 16:37:24 -07:00
Adam Ierymenko
fe87136870 Auto-update fix -- signature is in hex. 2015-06-03 16:25:16 -07:00
Adam Ierymenko
c5a3e80113 Linux installer tweaks, and Mac updater tweak. 2015-06-02 16:54:27 -07:00
Adam Ierymenko
91f02d699e Right now only FreeBSD can use BSDEthernetTap, which will probably get renamed accordingly. NetBSD and OpenBSD do not support tap, only tun, so they will have to wait. 2015-05-25 11:11:37 -07:00