Commit Graph

821 Commits

Author SHA1 Message Date
Erik Ekman
fc1611fc40 Only accept IPv6 in server IPv6 socket
Set IPV6_V6ONLY flag on server socket. Not all operating systems
support mixing v4/v6 in one socket, so separate them all the time.
2015-06-30 21:58:16 +02:00
Erik Ekman
4d03ee7786 Allow choosing only IPv4 or IPv6 in server
IPv6 might still allow IPv4 since V6_ONLY is not set by the server.
2015-06-30 21:32:21 +02:00
Erik Ekman
e7d253b1c1 Fix compile on Darwin (hopefully) 2015-06-28 22:52:33 +02:00
Erik Ekman
b4e9148df8 Support raw mode for both IPv4 and IPv6
Read destination address of IP request packet and return it.
Check length in client and use it as IPv4 or v6 depending on length.
2015-06-28 22:41:54 +02:00
Erik Ekman
7a51b22909 Simplify cleanup code 2015-06-28 21:05:23 +02:00
Erik Ekman
ec0e3f2e51 Change sockaddr lengths back to signed
They are used to check negative return values.
2015-06-28 20:25:22 +02:00
Erik Ekman
7a117bd71e IPv6 support for DNS traffic in server
Server will by default listen on both IPv4 and IPv6.
No way to only listen on one protocol right now.

Use -L to only listen on a specific v6 address.

IP address to use for raw mode is still IPv4 only.
Use -n on server to make raw mode work from IPv6 clients,
then they will get an IPv4 address from the server for raw mode.

Tunnel data is still IPv4.
2015-06-28 20:01:48 +02:00
Erik Ekman
07c2fd4068 Prepare server code for IPv6 listening socket
Add a struct with multiple dns file descriptors (for IPv4 and IPv6)
and pass this to required areas. Choose which descriptor to use when
sending by looking at the destination address family.
2015-06-28 13:05:17 +02:00
Erik Ekman
3069665646 Speling 2015-06-28 10:36:49 +02:00
Erik Ekman
987a21a0d8 Update manpage 2015-06-27 12:17:13 +02:00
Erik Ekman
69a91d5421 Update changelog 2015-06-27 12:14:34 +02:00
Erik Ekman
582a818f2a Switch external IP service to api.ipify.org
externalip.net seems to have gone away
2015-06-27 12:11:43 +02:00
Erik Ekman
778d29825d Switch to IPv6-ready storage of user IP address 2015-06-27 11:57:39 +02:00
Erik Ekman
5233d1e858 Merge pull request #15 from cpatulea/master
Document utunX.
2015-04-08 09:37:34 +02:00
Catalin Patulea
840155ca9a Document utunX. 2015-04-08 02:59:26 -04:00
Erik Ekman
1f51bab2a3 Update changelog 2015-04-08 08:50:07 +02:00
Erik Ekman
9e105d21d4 Add explanation for tun packet headers 2015-04-08 08:42:05 +02:00
Erik Ekman
b559806a8e Merge pull request #12 from cpatulea/master
Support utun devices on Mac OS X.
2015-04-08 08:36:01 +02:00
Catalin Patulea
b38b2ca7c5 Clarify that header is for both OPENBSD and DARWIN(utun). 2015-04-08 01:40:19 -04:00
Catalin Patulea
33abc0ca26 Support utun devices on Mac OS X.
As of 10.6, OS X has native tunnel devices. They are implemented as
sockets rather than character devices, but otherwise they appear to
behave the same as Free/OpenBSD tunnels.

'-d utunX' will tell iodine to use a utun device. For backward
compatibility, we'll continue to default to the old tuntap devices for
now.

This is a port of Peter Sagerson <psagers.github@ignorare.net>'s openvpn
commit 43e5016a.
2015-03-14 17:02:08 -04:00
gregor herrmann
1160649794 fix compilation error on kFreeBSD and Hurd 2015-01-23 09:50:41 +01:00
Ryan Welton
434a023afe Fix warning for comparing enum
CC user.c
user.c:202:15: warning: comparison of unsigned
      enum expression < 0 is always false
      [-Wtautological-compare]
        if (c < 0 || c >= CONN_MAX)
            ~ ^ ~
2014-10-25 10:27:01 +02:00
Erik Ekman
9a45c4aa66 Change license wording to follow ISC license exactly
"Permission to use, copy, modify, and distribute this software" is now
"Permission to use, copy, modify, and/or distribute this software".

Add license header to source files missing one.
2014-08-07 21:18:33 +02:00
Erik Ekman
7433423836 Remove redundant strerror() in warn() calls 2014-08-07 20:03:46 +02:00
Barak A. Pearlmutter
46532539c2 Rename VERSION define
prep for autotools: autoconf defines VERSION so s/VERSION/PROTOCOL_VERSION/
2014-08-07 12:55:59 +02:00
Erik Ekman
b9a1f14e86 Merge pull request #10 from nbraud/master
Revamping the README file
2014-08-05 08:38:35 +02:00
Nicolas Braud-Santoni
81d932703b Revamping the README file 2014-08-03 21:51:01 +02:00
Erik Ekman
cea498e710 Merge pull request #9 from zx2c4/master
osflags: use pkg-config for systemd support
2014-07-25 08:26:00 +02:00
Jason A. Donenfeld
cc4bc22447 osflags: use pkg-config for systemd support
Recent versions of systemd don't ship with libsystemd-daemon.so anymore,
but instead use libsystemd.so for everything. This is obviously
problematic for using the same LDFLAGS on old systemd and new systemd.
So, they also ship compatability pkgconfig files, which use the old
names but return the new library. So, the most portable way to support
both old and new systemd is to use pkgconfig. It's not a problem either,
since systems that use systemd are bound to also have pkgconfig
installed.
2014-07-25 02:02:48 +02:00
Erik Ekman
b4c3656c3c Update changelog after release 2014-06-16 23:43:20 +02:00
Erik Ekman
eec0a868d9 Set correct sockaddr length when sending
Fix EINVAL error on NetBSD
2014-06-16 22:28:04 +02:00
Erik Ekman
b715be5cf3 Fix authentication bypass bug
The client could bypass the password check by continuing after getting error
from the server and guessing the network parameters. The server would still
accept the rest of the setup and also network traffic.

Add checks for normal and raw mode that user has authenticated before allowing
any other communication.

Problem found by Oscar Reparaz.
2014-06-16 21:43:22 +02:00
Erik Ekman
bf658b0c59 Misc cleanup of tun.c
- Make variables static
- open_tun(): First Linux code, then Windows, then BSDs
- write_tun()/read_tun(): Split Windows and normal code
2014-06-11 21:04:22 +02:00
Erik Ekman
3ebcd29b13 Add support for using an unspecified RR type
Add PRIVATE query type with id 65399 (private use range).
According to RFC3597 the reply data in a query with unspecified RR type must be handled
as unstructured binary data, which means it can contain raw packet data just like the NULL type.
Since the reply format is optimal it is ordered just after NULL in the priority order.
2014-06-09 20:06:36 +02:00
Erik Ekman
2466cd184a Change readshort() to work with unsigned values 2014-06-09 19:47:44 +02:00
Erik Ekman
1f4b9250cf Check that supplied query type is valid 2014-06-09 18:56:32 +02:00
Erik Ekman
4d7678dc5b Prefix exported functions from client.c 2014-06-09 18:11:16 +02:00
Erik Ekman
fbb5a49cf3 Fix windows build 2014-06-05 02:19:57 +02:00
Erik Ekman
3fadbfb580 Do not let sockets be inherited by sub-processes
Set FD_CLOEXEC flag on tunnel and UDP file descriptors.
Fixes ticket #99, "should not allow UDP socket to be inherited by ifconfig"
2014-06-04 17:48:43 +09:00
Erik Ekman
a23899513d Remove trailing whitespace 2014-06-01 08:46:54 +02:00
Erik Ekman
388afe3845 Update copyright 2014-06-01 08:46:54 +02:00
Erik Ekman
b7e05e0b9a Revert submake -C call
Not supported by OpenBSD make.
2014-05-31 22:58:51 +02:00
Erik Ekman
ac931e65e7 Use -C in submake calls instead of cd
Reorder more common install/uninstall/clean before specialized targets.
2014-05-31 22:57:15 +02:00
Erik Ekman
95dedf51db Simplify opening UDP socket in win32 tun reader 2014-05-31 21:22:03 +02:00
Erik Ekman
d0fb85e8cf Do not use 53 as source port for DNS/raw traffic.
For some reason this makes raw traffic get dropped.
2014-05-31 21:20:04 +02:00
Erik Ekman
5b71224def Fix segfault in windows tun reader thread
The arguments to open_dns() needs to be updated after API change.
Called with 0, INADDR_ANY used to mean port, IP address but now means
pointer to sockadddr and its length. Thanks to C for not giving any
warnings or errors..
2014-05-31 19:33:25 +02:00
Erik Ekman
c52ba7f606 Refactor targets to build crosscompiled zipfiles
Move common things into new target
Add 32/64 bit windows version with MinGW-w64
Serve textfiles with CRLF and .txt suffix
Strip windows binaries
2014-05-31 12:05:17 +02:00
Erik Ekman
00268bc160 Fix two unused variables for windows build 2014-05-31 10:19:46 +02:00
Erik Ekman
3914d37c99 Move error message generation into topdomain check method
Change isalpha() to a-z check to avoid locale issues
2014-05-31 10:07:36 +02:00
Erik Ekman
9bb2323f84 Improve check of topdomain to use
Add more checks and unit tests
2014-05-30 00:18:45 +02:00