Commit Graph

61 Commits

Author SHA1 Message Date
Erik Ekman 17169e3444 tun: Add openvpn componentid prefix
Some drivers use root prefix. See https://patchwork.openvpn.net/patch/555/

Hopefully helping with bugs #46 and #73.
2022-07-18 23:31:13 +02:00
Erik Ekman d02f1b4f41 tun: Fix warning
tun.c:389:19: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
        if (addr.sc_unit < 0) {
            ~~~~~~~~~~~~ ^ ~
2021-05-14 13:38:51 +02:00
Erik Ekman 02173b8352 Fix iteration of utun devices on macos
Pass the constructed name instead of NULL to open_utun

Also add some error handling to utun_unit.
2021-05-13 20:13:00 +02:00
Erik Ekman a9045705ba tun: Automatically attempt to use utun on mac
Once /dev/tunX has been tried without success
2021-01-21 17:40:22 +01:00
Erik Ekman aeacfbc2c0 Formatting: No spaces after '(' or before ')' 2020-07-24 19:02:41 +02:00
Erik Ekman 19d0d1be64 Formatting: Space between 'if' and parenthesis 2020-07-24 18:56:30 +02:00
Erik Ekman d8f3ac8971 Add helper function tun_uses_header()
Remove code duplication and hide some ifdefs
2020-07-03 17:06:14 +02:00
Erik Ekman 07b2978326 Only check for utun if tun_device was given
Fixes github issue #37 hopefully.
2020-07-03 16:53:30 +02:00
Daniel Schaefer d2f671bdc7 Define searchpath for route with macro
Allows it to be easily overridden using the compiler commmandline.
Just like IFCONFIGPATH.
2019-08-24 16:43:34 +02:00
Erik Ekman 9e105d21d4 Add explanation for tun packet headers 2015-04-08 08:42:05 +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
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
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 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 95dedf51db Simplify opening UDP socket in win32 tun reader 2014-05-31 21:22:03 +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 00268bc160 Fix two unused variables for windows build 2014-05-31 10:19:46 +02:00
Erik Ekman b079b0eda5 Fix build error and a warning on OpenBSD 2014-05-29 16:18:59 +02:00
Erik Ekman eca80f769b Merge branch 'master' of https://github.com/jedisct1/iodine 2014-04-06 13:31:34 +02:00
Erik Ekman a1d88c4f0a IPv6 support for client (#107)
The iodine client now supports both IPv4 and IPv6 nameservers for
sending DNS queries to an IPv4 iodined. The nameserver will
transparently handle translation between IP protocols.

Windows port needs Vista or later to support IPv6.
2014-02-05 22:36:53 +01:00
Frank Denis 1523a4f035 snprintf() is a macro on some operating systems
and having #ifdef statements in macro parameters has undefined behavior.
2013-05-20 10:39:05 -07:00
Erik Ekman 59dbaf2b50 Merge pull request #1 from zschoche/master
Bugfix for Mountain Lion
2013-01-15 00:26:02 -08:00
Jason A. Donenfeld ade78ac8a2 More generic way of finding ifconfig. 2012-09-09 14:02:54 +02:00
Philipp Zschoche e1e438497a after update to OSX 10.8 I've gotten these error:
route: writing to routing socket: Can't assign requested address
add net 192.168.99.2: gateway 192.168.99.2: Can't assign requested address

This change fix that!
2012-07-31 22:09:53 +02:00
Erik Ekman b30abea6b0 Reorganize imports for OpenBSD 2012-02-10 23:26:27 +01:00
Marcel Bokhorst a569030bb7 Android support (#105) patch from Marcel Bokhorst 2012-02-04 20:34:05 +01:00
Erik Ekman 0be4332193 Fix things mentioned in #91 2012-02-04 20:34:05 +01:00
Erik Ekman b22e3da5a0 #89, use remote ip as second ip in ifconfig on FreeBSD 2012-02-04 20:34:05 +01:00
Erik Ekman cf78fdca85 print error if tun device is already taken 2012-02-04 20:34:02 +01:00
Erik Ekman e84b317e0e Small tweaks 2012-02-04 20:34:02 +01:00
Erik Ekman 8fc8ce587c Any number of TAP32 interfaces supported, use -d to choose. #46 2012-02-04 20:34:02 +01:00
Erik Ekman e59aaa523e Fixed #47, support any TAP device name 2012-02-04 20:34:02 +01:00
Erik Ekman 96ee6f9630 Use recv on windows and read for the others 2012-02-04 20:34:01 +01:00
Luigi Rizzo 8b95bded10 Use read instead of recv, #58. 2012-02-04 20:34:01 +01:00
Erik Ekman a3a20a2b09 #53 Support TAP32 version 0901 as well 2012-02-04 20:34:01 +01:00
Erik Ekman 54195968c7 Use winsock2.h, use ws2tcpip.h for socklen_t 2012-02-04 20:34:01 +01:00
Erik Ekman 7b30a2e504 actually accept mtu=1500 2012-02-04 20:34:01 +01:00
Erik Ekman 3e07afd13b change all printf to fprintf on stderr for #49 2012-02-04 20:34:01 +01:00
Erik Ekman 1b7e9bed43 give error when no TAP adapters found, and clean better 2012-02-04 20:34:00 +01:00
Erik Ekman b3e8cf0554 #43: Basic windows support operational 2012-02-04 20:34:00 +01:00
Erik Ekman 3ad63f8791 cleanup of tun.c 2012-02-04 20:34:00 +01:00
Erik Ekman 94f412a8d8 Dont need plibc 2012-02-04 20:34:00 +01:00
Erik Ekman 937eaa8007 #43 Now works on windows, if you set your ip correctly and use a /30 netmask 2012-02-04 20:34:00 +01:00
Erik Ekman 568c4b18f4 #43: Fixed write function, downstream tunneling works now on win32 2012-02-04 20:34:00 +01:00
Erik Ekman 540f411474 Added setting of ip, does not seem to work though 2012-02-04 20:34:00 +01:00
Erik Ekman e4e38c9593 Opening of device done, and it is set as active 2012-02-04 20:34:00 +01:00