Commit Graph

63 Commits

Author SHA1 Message Date
Erik Ekman f1e7823a3d Add helper for matching topdomain and getting data length 2021-08-25 01:13:48 +02:00
Erik Ekman 589027568b Add option to allow wildcard as start of topdomain 2021-08-24 23:32:57 +02:00
Erik Ekman 569a86a140 Fix Android cross-compile
./common.h:136:29: error: unknown type name 'va_list'
 void vwarn(const char *fmt, va_list list);
                             ^
2021-08-16 14:45:02 +02:00
Erik Ekman dc307b7183 Add prototypes for vwarn/vwarnx
Fixes this warning:
common.c:406:1: warning: no previous prototype for 'vwarn' [-Wmissing-prototypes]
  406 | vwarn(const char *fmt, va_list list)
      | ^~~~~
common.c:429:1: warning: no previous prototype for 'vwarnx' [-Wmissing-prototypes]
  429 | vwarnx(const char *fmt, va_list list)
      | ^~~~~~

Also move err() to have non-x versions first.
2021-01-31 14:08:27 +01:00
Ralf Ramsauer 79455c380d consequently use tabs, and no spaces
and wrap lines at 80 characters

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-04-10 21:26:13 +02:00
Ralf Ramsauer 52c4940523 Warn, warn warn.
iodine does not seem to follow any styling guidelines (mixture of
different function prototypes, ...).  So let's introduce some.  This
will improve overall code quality and readability.

Additionally, warnings will improve code quality as well. Let's turn on
very pedantic warnings, and fix everything where the compiler barks
back.

Introduce the following function definition scheme:
  type function_name(type name, type1 name1 ...)
  {
  }
This allows us to copy and paste the definition to the declaration by
selecting one single line.

Furthermore, limit line length to 80 characters.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 21:30:01 -08:00
Ralf Ramsauer 1c86bf347f iodine/iodined: do not print usage if no superuser
There is no value in printing the usage in this case, as the usage
doesn't give the user any hint on how to solve this issue.

Furthermore, replace the Windows implementation with an empty inline
function, which will result in no code.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 02:17:27 -08:00
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 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 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
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 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 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 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 f02339b3b2 IPv6: Create single way to format IP addresses 2014-02-06 19:44:26 +01: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
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
J. A. Bezemer b177901d38 Applied patch from #88, thanks a lot! 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
J. A. Bezemer 05e99c7a3f start merging common and docs #76 2012-02-04 20:34:04 +01:00
Erik Ekman 379ca540ef Fix OpenBSD build error 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
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 473bb93951 #36, Send ping message every 20 seconds 2012-02-04 20:34:03 +01:00
Erik Ekman 58d9615160 #36, upstream traffic now sent in raw mode 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 c92ed9bad8 #36 send raw login packet directly to server 2012-02-04 20:34:02 +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 b43e97aeb0 added proper warn/warnx/err/errx 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 352d75131f Move superuser check to common.c 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 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 85e75cadea make iodined build on opensolaris 2012-02-04 20:33:58 +01:00
Erik Ekman 9ff6683119 Removing old code 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 49695a4cb4 Updated year 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 791c3de84c reapplied maxims patches 2012-02-04 20:33:56 +01:00
Erik Ekman 07e98f181c reverting the code after 0.4.1, except for some patches 2012-02-04 20:33:56 +01:00
Maxim Bourmistrov 7565a2d554 Added checks on topdomain name based on patch from Maxim Bourmistrov 2012-02-04 20:33:56 +01:00
Erik Ekman bc5f0a7fb7 #7 Move packet handling out of iodine.c and into packet.c 2012-02-04 20:33:56 +01:00