Commit Graph

488 Commits

Author SHA1 Message Date
Michael Scherer
27fb4c75cd Add support to have on demand socket activation of iodine 2013-12-23 22:57:40 +01:00
Michael Scherer
64ff684754 Fix gcc warning -Wsizeof-pointer-memaccess
iodined.c: In function ‘write_dns_nameenc’:
iodined.c:2030:23: attention : argument to ‘sizeof’ in ‘memset’ call is the same
expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
  memset(buf, 0, sizeof(buf));

sizeof buf will just give the size of the pointer, while buflen will clean the whole
memory.
2013-12-23 18:04:06 +01:00
Frank Denis
28ceecba37 size_t values can't be negative. 2013-05-20 10:40:44 -07: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
Frank Denis
b31e66343a -R only works on OpenBSD. 2013-05-20 10:31:39 -07:00
Frank Denis
58dac78bd8 Fix NULL pointer deref 2013-05-20 10:30:43 -07:00
Frank Denis
2d90aaaf30 Wipe the whole buffer containing the DNS name, not the size of its pointer 2013-05-20 10:28:25 -07:00
Frank Denis
ac7cbd4435 Check set[e]uid return code 2013-05-20 10:27:23 -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
Erik Ekman
c99f381719 Set WINVER to Windows XP to support getaddrinfo 2012-09-03 10:52:04 +02:00
Erik Ekman
43e4fb5448 Add automatic external IP lookup via '-n auto'
Leonard Lausen proposed iodined should use externalip.net api
to find external ip. Use -n auto to trigger a lookup.
2012-09-03 10:34:27 +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
Erik Ekman
45a5d80c49 Adjust indentation 2012-02-06 20:28:42 +01:00
Erik Ekman
24f1959bab Rename user struct to fix ubuntu arm build failure 2012-02-05 00:49:30 +01:00
Erik Ekman
423cbec41d Added android specific readme file, along with new make targets
Also updated changelog.
2012-02-05 00:36:15 +01:00
Pavel Pergamenshchik
85be9b07d1 Missing break in iodine.c command-line parsing
Bug-Ubuntu: https://bugs.launchpad.net/bugs/880508
Author: Pavel Pergamenshchik <ppergame@gmail.com>
Reviewed-by: gregor herrmann <gregoa@debian.org>
Last-Update: 2011-10-23
2012-02-04 22:38:27 +01:00
Marcel Bokhorst
a569030bb7 Android support (#105) patch from Marcel Bokhorst 2012-02-04 20:34:05 +01:00
Erik Ekman
66d9428dff Add check for SO_RTABLE support in openbsd, #95 2012-02-04 20:34:05 +01:00
Laurent Ghigonis
d4849a5dbf Add support for openbsd routing domain, #95 2012-02-04 20:34:05 +01:00
Håkan Kvist
9c3343e6ac Allow spaces in passwords, #93 2012-02-04 20:34:05 +01:00
Erik Ekman
0a968a5144 Initialize 'inside_topdomain'. Fixes #94 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
465cfe54a3 Fix build error on windows 2012-02-04 20:34:04 +01:00
jsbid1
7ae8d04955 Fix #86, patch from jsbid1 gmail.com 2012-02-04 20:34:04 +01:00
Erik Ekman
6e2cf70587 Fix osx compile, maybe also OpenBSD 2012-02-04 20:34:04 +01:00
Erik Ekman
79f0092c70 Fix compile for win32 2012-02-04 20:34:04 +01:00
J. A. Bezemer
b177901d38 Applied patch from #88, thanks a lot! 2012-02-04 20:34:04 +01:00
Erik Ekman
1a26a91db3 #82, switch to gethostbyname() for win32 support 2012-02-04 20:34:04 +01:00
Erik Ekman
c5bdf07070 #82 update docs 2012-02-04 20:34:04 +01:00
Erik Ekman
365aab1d29 #82, fix resolving given nameserver on everything but win32 2012-02-04 20:34:04 +01:00
Erik Ekman
acd264b435 Make sure replies with errors get the name parsed 2012-02-04 20:34:04 +01:00
Erik Ekman
269499ba43 Print DNS errors only when requested packet has an error 2012-02-04 20:34:04 +01:00
Erik Ekman
326da432c9 Fix buggy set lazy mode function 2012-02-04 20:34:04 +01:00
J. A. Bezemer
3c48602747 merge client code #76 2012-02-04 20:34:04 +01:00
J. A. Bezemer
d87432ec18 merge server code #76 2012-02-04 20:34:04 +01:00
J. A. Bezemer
60dfbf1b34 merge dns and user #76 2012-02-04 20:34:04 +01:00
J. A. Bezemer
05e99c7a3f start merging common and docs #76 2012-02-04 20:34:04 +01:00
Erik Ekman
92b160a416 Fix mtu fragment size probing 2012-02-04 20:34:04 +01:00
Erik Ekman
5951166b36 Fix data length in encoding dns queries 2012-02-04 20:34:04 +01:00
Erik Ekman
d4d88d2ad0 Remove arg to inline_dotify 2012-02-04 20:34:04 +01:00
J. A. Bezemer
40167437d3 update server code #75 2012-02-04 20:34:04 +01:00
J. A. Bezemer
55cfed9956 update client code #75 2012-02-04 20:34:03 +01:00
J. A. Bezemer
2c2dd6f06e update client code #75 2012-02-04 20:34:03 +01:00
J. A. Bezemer
90e25e3a2c update dns parsing #75 2012-02-04 20:34:03 +01:00
J. A. Bezemer
c2bc500cba add downenc per-user field #75 2012-02-04 20:34:03 +01:00
J. A. Bezemer
1fcab767cd Add win32 defines for TXT and SRV #75 2012-02-04 20:34:03 +01:00
J. A. Bezemer
05a23a544d add win32 defines #75 2012-02-04 20:34:03 +01:00
J. A. Bezemer
4c0fe80ba8 add txt read/write #75 2012-02-04 20:34:03 +01:00
J. A. Bezemer
fb17474438 base32 decode uppercase #75 2012-02-04 20:34:03 +01:00
Erik Ekman
b6eb8d75d4 Fix FreeBSD build error, remove more includes 2012-02-04 20:34:03 +01:00
Erik Ekman
f9c2257ba9 Prune includes 2012-02-04 20:34:03 +01:00
Erik Ekman
379ca540ef Fix OpenBSD build error 2012-02-04 20:34:03 +01:00
Erik Ekman
93a313b130 Added new test, found and fixed an actual bug 2012-02-04 20:34:03 +01:00
Erik Ekman
a1a2e3cefe Refactored to make it easier to add unit tests 2012-02-04 20:34:03 +01:00
Guillaume Rischard
3879f96a80 Fix build error on OSX 10.6 by Guillaume Rischard, #79 2012-02-04 20:34:03 +01:00
Erik Ekman
0cdd537819 #78, print server tunnel ip 2012-02-04 20:34:03 +01:00
Erik Ekman
01e558022e #77, get password from env variable 2012-02-04 20:34:03 +01:00
Erik Ekman
8074696a14 Fix password reading 2012-02-04 20:34:03 +01:00
Erik Ekman
27fdc23433 Split the client code out from the file with the main() func 2012-02-04 20:34:03 +01:00
Erik Ekman
1137ac6ac9 Updated docs 2012-02-04 20:34:03 +01:00
misc
7efdd01ae2 add -F option for writing pid file. Patch from misc@mandriva.org #70 2012-02-04 20:34:03 +01:00
Erik Ekman
2482a42d01 Fixes for unpacking raw packets 2012-02-04 20:34:03 +01:00
Erik Ekman
ef8e3b7ea4 Fix win32 build error 2012-02-04 20:34:03 +01:00
Erik Ekman
cb926cf0c9 Fix some uninitialized variable warnings 2012-02-04 20:34:03 +01:00
Victor Ostorga
24871faa99 Keep user CC and CFLAGS/LDFLAGS. 2012-02-04 20:34:03 +01:00
Erik Ekman
473bb93951 #36, Send ping message every 20 seconds 2012-02-04 20:34:03 +01:00
Erik Ekman
7e4ee6c470 #36, update printouts 2012-02-04 20:34:03 +01:00
Erik Ekman
ebc1b2f7f8 #36, Use -r to skip raw mode 2012-02-04 20:34:02 +01:00
Erik Ekman
e5370ad95b #36, basic raw mode tunnel works 2012-02-04 20:34:02 +01:00
Erik Ekman
58d9615160 #36, upstream traffic now sent in raw mode 2012-02-04 20:34:02 +01:00
Erik Ekman
02c06d742f Formatting 2012-02-04 20:34:02 +01:00
Erik Ekman
293796fcf6 Fix #65, randomize rand_seed on startup 2012-02-04 20:34:02 +01:00
Erik Ekman
938c2458b9 Exit if IP/mtu can not be configured 2012-02-04 20:34:02 +01:00
Erik Ekman
a62ae8e562 Allow bind port and listen port to be the same if listenip doesnt include localhost. Also remove newlines from warnx 2012-02-04 20:34:02 +01:00
Sebastien Raveau
d5acb508bc Add support for applying SELinux context 2012-02-04 20:34:02 +01:00
Erik Ekman
cf78fdca85 print error if tun device is already taken 2012-02-04 20:34:02 +01:00
Erik Ekman
196b37c402 return 1 if opening tun fails and args are correct 2012-02-04 20:34:02 +01:00
Erik Ekman
da50020f5b return 1 if connection failed, #62 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
f20b3c9511 Remove a global variable and some warnings 2012-02-04 20:34:02 +01:00
Erik Ekman
de976d0558 #36 client now reads raw reply 2012-02-04 20:34:02 +01:00
Erik Ekman
1235cb3e4a #36 server now responds to raw login, quite a hack 2012-02-04 20:34:02 +01:00
Erik Ekman
c92ed9bad8 #36 send raw login packet directly to server 2012-02-04 20:34:02 +01:00
Erik Ekman
950c0870b2 Added CMC to I and S packet types 2012-02-04 20:34:02 +01:00
Erik Ekman
3eef144fce #36 fetch remote ip number after login 2012-02-04 20:34:02 +01:00
Erik Ekman
27fc039700 #36, add way to request ip address from server 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
4bbf4ecd14 Check that nameserver was found 2012-02-04 20:34:01 +01:00
Erik Ekman
5dccfbecf6 Use ssize_t for read variable (ticket #57) 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
7d140addae print dot while waiting for probe responses 2012-02-04 20:34:01 +01:00
Erik Ekman
addd798712 Set interface MTU to 1200.
1188 is the uncompressed DNS reply payload size that gets through
unfragmented on Ethernet.
2012-02-04 20:34:01 +01:00
Erik Ekman
3db5cd24b7 Fix (ignore) Dont-Fragment for OpenBSD and OS X 2012-02-04 20:34:01 +01:00
Erik Ekman
1bddcd33aa Set Dont-Fragment for various os 2012-02-04 20:34:01 +01:00
Erik Ekman
789d8f3450 Use winsock2.h, use ws2tcpip.h for socklen_t 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
bc18afcc83 do proper mtu detection, ticket #54 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
84f5965825 Increase default mtu to 1500 2012-02-04 20:34:01 +01:00
Erik Ekman
751f672a27 properly encode >1024 in probe requests (fix #52) 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
9c738bbc81 #44 hide password input 2012-02-04 20:34:01 +01:00
Erik Ekman
990a03e93d #45: free the info pointer 2012-02-04 20:34:01 +01:00
Erik Ekman
13a5b7c2db #45: use static buffer 2012-02-04 20:34:01 +01:00
Erik Ekman
af1380f29d #45: Use IpHelper to get DNS server on win32 2012-02-04 20:34:01 +01:00
Erik Ekman
4ae304a9b7 Use winsock2.2 2012-02-04 20:34:01 +01:00
Erik Ekman
0b280bec2b clean up codec reverse inits 2012-02-04 20:34:01 +01:00
Erik Ekman
444299b86e #51 handle one block encode/decode for base32 2012-02-04 20:34:00 +01:00
Erik Ekman
eed52b783f #51 handle one block encode/decode for base64 2012-02-04 20:34:00 +01:00
Erik Ekman
aad34d941a Moved two global vars into main 2012-02-04 20:34:00 +01:00
Erik Ekman
9e6ae4ff1d Split handshake() function into smaller functions 2012-02-04 20:34:00 +01:00
Erik Ekman
bf46666fe8 #50 added syslog logging for version and login packets. no-op on windows 2012-02-04 20:34:00 +01:00
Erik Ekman
b6fc3fc0ef Made dns_get_id return unsigned short, added test cases 2012-02-04 20:34:00 +01:00
Erik Ekman
0f7ce5d086 Actually check length of probe responses 2012-02-04 20:34:00 +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
10fd388bb7 use socklen_t 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
b43e97aeb0 added proper warn/warnx/err/errx 2012-02-04 20:34:00 +01:00
Erik Ekman
80ae712a6f Add WSAStartup to iodined 2012-02-04 20:34:00 +01:00
Erik Ekman
ead9c5da8a Add WSAStartup 2012-02-04 20:34:00 +01:00
Erik Ekman
4734bd0ee0 Added win32 specific readme 2012-02-04 20:34:00 +01:00
Erik Ekman
94f412a8d8 Dont need plibc 2012-02-04 20:34:00 +01:00
Erik Ekman
de617fb026 Make crosscompiling easier 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
Erik Ekman
155f0c6f37 Merged branch with mingw port. Compiles now, tun work to do 2012-02-04 20:34:00 +01:00
Erik Ekman
0836ad0a5b revert cygwin stuff 2012-02-04 20:34:00 +01:00
Erik Ekman
6de3368f39 turn off root check in cygwin for now 2012-02-04 20:34:00 +01:00
Erik Ekman
97bf71e944 Make it build and fix tests in cygwin 2012-02-04 20:33:59 +01:00
Erik Ekman
352d75131f Move superuser check to common.c 2012-02-04 20:33:59 +01:00
Erik Ekman
dc17bc69fe #40, fix dots in hostname when length is 113, 170, 227... Includes test. 2012-02-04 20:33:59 +01:00
Erik Ekman
13497b1df6 #39 stop wild loop in fragsize detection mode 2012-02-04 20:33:59 +01:00
Erik Ekman
8463d2b2fd Rename protocol to version 00000500 2012-02-04 20:33:59 +01:00
Erik Ekman
78d324a6b4 Enhanced checks on incoming queries, check user exists and is active 2012-02-04 20:33:59 +01:00
Erik Ekman
bd1a8443d1 #7 finally done\! Added autoprobing of max downstream fragsize. 2012-02-04 20:33:59 +01:00
Erik Ekman
df93da00c6 #7, add probe fragsize support for server. documented 2012-02-04 20:33:59 +01:00
Erik Ekman
9383c84479 fix warnings 2012-02-04 20:33:59 +01:00
Erik Ekman
9be3ef639c Fix build on OpenBSD 2012-02-04 20:33:59 +01:00
Erik Ekman
2bccb33214 fix label 2012-02-04 20:33:59 +01:00
Erik Ekman
9ababcaa96 #7, set max fragsize with -m in the client 2012-02-04 20:33:59 +01:00
Erik Ekman
d4e077aff4 downstream fragsize is now per user 2012-02-04 20:33:59 +01:00
Erik Ekman
d2b019a6df #7, handle special case, remove up to 1 second pause when doing bulk download 2012-02-04 20:33:59 +01:00
Erik Ekman
23fad5b628 Downstream fragmentation now working. Currently fragment size is hardcoded to 1200. More tweaking left, as well as fragsize auto detection. (#7) 2012-02-04 20:33:59 +01:00
Erik Ekman
78ae87ebc8 Discard packets which only has data header 2012-02-04 20:33:59 +01:00
Erik Ekman
cc17083222 add downstream data header and basic parsing in client, for #7 2012-02-04 20:33:59 +01:00
Erik Ekman
3ed5f7e674 Create send_chunk() on server 2012-02-04 20:33:59 +01:00
Erik Ekman
43c438971b Allow setting netmask in iodined, fixes #27. The same netmask will be given to clients as well. Updated docs. 2012-02-04 20:33:59 +01:00
Erik Ekman
c7fa4ddde2 Assign client IPs within the network (fixes #28), also limit number of users depending on netmask (for #27) 2012-02-04 20:33:59 +01:00
Erik Ekman
a5031ee9dd Happy new year 2012-02-04 20:33:59 +01:00
Erik Ekman
62824e92ed Handle trans id >= 0x8000, fix bug #37 2012-02-04 20:33:58 +01:00
Erik Ekman
09c904f0c1 make OUT debug look more like IN debug 2012-02-04 20:33:58 +01:00
Erik Ekman
45d0708306 Fix for compile error on FreeBSD 2012-02-04 20:33:58 +01:00
Erik Ekman
85e75cadea make iodined build on opensolaris 2012-02-04 20:33:58 +01:00
Erik Ekman
cc075124fa Detect duplicates in upstream data, start frag at zero 2012-02-04 20:33:58 +01:00
Erik Ekman
8d27febc7d Implemented new protocol for upstream data 2012-02-04 20:33:58 +01:00
Erik Ekman
2c4c5ec1ba Added simple 5bits to 8 and reverse encoder, with test 2012-02-04 20:33:58 +01:00
Erik Ekman
9ff6683119 Removing old code 2012-02-04 20:33:58 +01:00
Erik Ekman
37b7a9fade Added notreached 2012-02-04 20:33:58 +01:00
Erik Ekman
8a093efa59 Reverted new protocol 2012-02-04 20:33:58 +01:00
Erik Ekman
7eb7c02e5f Updated encoding tests 2012-02-04 20:33:58 +01:00
Erik Ekman
e5f8b28813 Added blocksize funcs, made funcs static 2012-02-04 20:33:58 +01:00
Erik Ekman
ae942ac542 Revert client shutdown code, it seems BADIP can arrive even though everything works 2012-02-04 20:33:58 +01:00
Erik Ekman
b36ed27117 Added -n to set NS ip, updated docs, added checks 2012-02-04 20:33:58 +01:00
Erik Ekman
e7fdb0a5f5 Reverted [686], [689] and [692]. SSH login now works again. Increased version. 2012-02-04 20:33:58 +01:00
Erik Ekman
3f579d2d39 Rename codecs 2012-02-04 20:33:58 +01:00
Erik Ekman
d7f2d60d56 Use base64 is case is preserved and plus sign is allowed 2012-02-04 20:33:58 +01:00
Erik Ekman
33c1efb9ca Base64 codec now uses + as 64th char 2012-02-04 20:33:58 +01:00
Erik Ekman
8769d14cde rewrote strange message 2012-02-04 20:33:58 +01:00
Erik Ekman
b5cdb09011 Added debugging 2012-02-04 20:33:58 +01:00
Erik Ekman
9d3f87ddcc Fix issue #33, respond to NS requests 2012-02-04 20:33:57 +01:00
Erik Ekman
f4cd876ace shorten some lines 2012-02-04 20:33:57 +01:00
Erik Ekman
b38293c11b Stop client if server is restarted 2012-02-04 20:33:57 +01:00
Erik Ekman
bd45e6ccb2 formatting 2012-02-04 20:33:57 +01:00
Erik Ekman
49695a4cb4 Updated year 2012-02-04 20:33:57 +01:00
Erik Ekman
26cc53e3fa added include for iovec 2012-02-04 20:33:57 +01:00
Erik Ekman
35a8ffe46d Now fetches destination address from udp packets 2012-02-04 20:33:57 +01:00
Erik Ekman
02d40c1a7b Forward non-tunnel requests to another udp port (fixes #31) 2012-02-04 20:33:57 +01:00
Francois Revol
ec2d6657a0 Patch to make it build on BeOS R5-BONE and Haiku 2012-02-04 20:33:57 +01:00
Erik Ekman
d24dae882a Implemented filtering based on topdomain 2012-02-04 20:33:57 +01:00
Erik Ekman
a07187a629 Eliminate extra 'ping' message when server sends data to client which generates a reply 2012-02-04 20:33:57 +01:00
Erik Ekman
c82280c600 Fix #34, send pings only every 5 seconds 2012-02-04 20:33:57 +01:00
Erik Ekman
166fb4b6c7 Fixed segfault when sending version rejects: VNAK/VFUL 2012-02-04 20:33:57 +01:00
Erik Ekman
fbaccb2f53 Changed texts 2012-02-04 20:33:57 +01:00
Erik Ekman
3fc9eaeaa3 Improved latency for traffic initiated from server 2012-02-04 20:33:57 +01:00
Erik Ekman
110866d76b fixed osflags script, updated changelog 2012-02-04 20:33:57 +01:00
Erik Ekman
c01f42fd0f fix opensolaris warning 2012-02-04 20:33:57 +01:00
Erik Ekman
21ad2ef5ae added -D to usage() and help() 2012-02-04 20:33:57 +01:00
Erik Ekman
025fb1bf1f Added debug capability on server 2012-02-04 20:33:57 +01:00
Erik Ekman
539ebb27d9 Changes to allow handling of queries of type A, NS etc 2012-02-04 20:33:57 +01:00
Erik Ekman
f06b208f3e Reworked fix for #21 2012-02-04 20:33:57 +01:00
Erik Ekman
0d3494ae78 Added -c flag to disable IP/port checking in each request 2012-02-04 20:33:57 +01:00