Commit Graph

688 Commits

Author SHA1 Message Date
Jason A. Donenfeld 0b828f9b96 Rework DNS and routes in network extension
The DNS resolver prior had useless comments, awful nesting, converted
bytes into strings and back into bytes, and generally made no sense.
That's been rewritten now.

But more fundumentally, this commit made the DNS resolver actually
accomplish its objective, by passing AI_ALL to it. It turns out, though,
that the Go library isn't actually using GAI in the way we need for
parsing IP addresses, so we actually need to do another round, this time
with hints flag as zero, so that we get the DNS64 address.

Additionally, since we're now binding sockets to interfaces, we can
entirely remove the excludedRoutes logic.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-28 19:38:03 +01:00
Jason A. Donenfeld 51a3e5c0b4 Version bump
A Christmas Special, for TestFlight, and possibly for release if things
go well there.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-26 01:41:22 +01:00
Jason A. Donenfeld c9c343cde2 NetworkExtension: rescope socket instead of tearing down socket
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-26 01:17:55 +01:00
Roopesh Chander c563a24348 minizip: Remove zip encryption code
We can now remove -DNOCRYPT cflag while compiling

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-25 12:48:04 +05:30
Roopesh Chander 808852c547 Tunnel edit: Fix crash
This fixes a crash that happens when you:

1. Scroll to the end of the Edit screen
2. Delete a peer
3. Toggle the Activate On Demand switch

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-24 13:01:21 +05:30
Eric Kuck 035055ef0a SwitchCell nits
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-22 15:32:29 -06:00
Eric Kuck 508ba44576 Fix typo for simulator builds
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-22 14:32:39 -06:00
Roopesh Chander 999b761ed0 Remove more comments
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-23 00:31:44 +05:30
Jason A. Donenfeld 129f94dccd Rely on availability of fd only after setting network settings
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 18:29:54 +01:00
Jason A. Donenfeld aaee3c5cbe Bump to latest wireguard-go release
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 17:38:25 +01:00
Jason A. Donenfeld dddbf3b370 Retain aggressive socket reestablishment for now
This can be reverted once we've done more testing.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 15:45:09 +01:00
Roopesh Chander d29f47fc9b Don't set username on NETunnelProviderProtocol
The username corresponds to the Account field in iOS system VPN UI,
but if we don't set it, the field is not shown, so setting it isn't
really required.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-22 16:13:31 +05:30
Roopesh Chander e6e1795d08 TunnelErrors: Add alert text for PacketTunnelProviderError
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-22 16:05:43 +05:30
Roopesh Chander fd29cf3402 TunnelStatus: Absorb NEVPNStatus+CustomStringConvertible
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-22 15:46:28 +05:30
Jason A. Donenfeld 56ad5f74e9 Also refresh status
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 07:07:53 +01:00
Jason A. Donenfeld 49bf55021f Reassign tunnelProvider if it changes from outside the app
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 06:56:12 +01:00
Eric Kuck 0bec5b04b0 All models now Equatable
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-21 22:57:17 -06:00
Jason A. Donenfeld d36e7e27ff Clean up trailing whitespace
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 05:30:35 +01:00
Jason A. Donenfeld b0b6866c51 Do not crash if we can't get socket.fileDescriptor
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 05:13:04 +01:00
Eric Kuck 9098cd1161 Removing a tunnel from iOS's settings is now immediately reflected in app
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-21 21:59:43 -06:00
Jason A. Donenfeld 8365adf435 Localize remaining strings in network extension
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 03:42:01 +01:00
Eric Kuck 9d9859248e RTL support
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-21 20:37:22 -06:00
Eric Kuck f7e9f4d631 Strongly recommended now appears as placeholder for DNS when needed
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-21 19:52:51 -06:00
Jason A. Donenfeld f2000aa1da Combine double log invocations
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 02:21:07 +01:00
Jason A. Donenfeld 82de3e3090 Bump go bridge
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 01:58:02 +01:00
Jason A. Donenfeld 41a4c6362a Attempt to strongly recommend things
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 01:55:42 +01:00
Jason A. Donenfeld aede9f6e45 Move model helpers to model directory
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 01:36:42 +01:00
Eric Kuck 1eeed89174 Fixes mock tunnels
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-21 18:35:01 -06:00
Jason A. Donenfeld c1c5f7a7c7 Do not set copyable back to true on reuse
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 01:31:59 +01:00
Jason A. Donenfeld 4ed646973e Move name from interface to tunnel
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 00:28:18 +01:00
Jason A. Donenfeld 9295895e3a Fix paren typo
"I am very anti-paren." --Eric

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-21 23:45:20 +01:00
Jason A. Donenfeld 7b9d4cb9e3 Nuke trailing spaces
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-21 23:34:56 +01:00
Eric Kuck 1fecd8eb6c providerConfiguration is now a WgQuickConfig
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-21 16:32:08 -06:00
Jason A. Donenfeld accf60b82f Do not require NetworkExtension to know its own name
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-21 22:05:47 +01:00
Eric Kuck f6af9d9ffb All migration stuff moved to one gross file
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-21 12:51:14 -06:00
Jason A. Donenfeld 78b38a4eba Simplify versioning of stored data
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-21 18:58:06 +01:00
Jason A. Donenfeld ec031b1f19 Get rid of superflous isActivateOnDemandEnabled key
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-21 18:50:32 +01:00
Eric Kuck 8553723e04 Updated NETunnelProvider save format
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-21 16:42:16 +01:00
Jason A. Donenfeld 38445114e0 NE: simplify logic
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-21 15:56:03 +01:00
Roopesh Chander a21c569e9f NE: Simplify DNS resolution
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-21 19:24:22 +05:30
Roopesh Chander 0552d75aa1 Localize all the things
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-21 18:34:09 +05:30
Roopesh Chander e47a8232d8 Tunnel detail: iPad: Handle deletion of tunnel correctly
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-21 18:02:18 +05:30
Roopesh Chander f818cdd963 NE: Update listen port only when first interface changes
When handling network path changes, change the listen port
only when the first interface has changed.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-21 17:32:44 +05:30
Roopesh Chander 28ce4d5164 NE: Change handling of bad domain names and Activate On Demand
The solution implemented in commit b8c331c causes the tunnel to
remain in 'Activating' state, without the ability to cancel that.

So, in this commit, instead of retrying DNS silently on
Activated-On-Demand tunnels, we fail the startTunnel() silently.

To summarize, if activate-on-demand is on:
- If started from the WireGuard app, show error using lastErrorFile
mechanism, suggesting a way to turn off Activate On Demand
- If not started from WireGuard app, don't call displayMessage()
(don't show error to user) and silently fail starting the tunnel

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-21 15:52:47 +05:30
Eric Kuck c2131cb757 Added missing param in MockTunnels
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-20 13:51:44 -06:00
Jason A. Donenfeld b23578dc7c wireguard-go-bridge: SDK_DIR is not defined for simulator
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-20 20:47:49 +01:00
Eric Kuck a89ad95901 Enabled more swiftlint rules
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-20 11:22:37 -06:00
Eric Kuck 5618c465a2 Added a String->[String] helper
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-20 10:46:26 -06:00
Roopesh Chander de08978a80 TunnelErrors: Remove unused error
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-20 19:44:57 +05:30
Roopesh Chander 9268c0c4bc Tunnel edit: init() need not take a tunnelConfiguration argument
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-19 18:35:53 +05:30