Commit Graph

863 Commits

Author SHA1 Message Date
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 8d4b43e178 Update tests to latest changes
Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
[Erik Ekman: reverted login test changes]
2017-04-10 21:25:42 +02:00
Ralf Ramsauer 8c5127b375 don't zero-initialise variable
For global variables, the C standard ensures that this variable will be
zeroed on startup.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 21:30:50 -08:00
Ralf Ramsauer 119d1b2da1 dns: improve code style
Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 21:30:50 -08:00
Ralf Ramsauer 4591cafd27 encoding: simplify {places,eats}_dots
Why not using constant bools?

Much simpler than complex function calls, that eventually return
constant values.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 21:30:50 -08:00
Ralf Ramsauer 0eb3b65158 encoding: use simple int's instead of accessor functions
Why are those values exposed to the outer world? They seem not be in use
anyway.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 21:30:50 -08:00
Ralf Ramsauer 317511e3ca nitpick: coding style
Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 21:30:50 -08:00
Ralf Ramsauer 844a2798eb encoder: use explicit variable names in operation structure
This makes it obvious, what each variable stands for.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 21:30:49 -08:00
Ralf Ramsauer 6b438e7517 encoder: further simplifications
Get rid of unique header files for each encoder, consolidate them to
where they are actually needed: encoding.h.

This also simplifies the generation of the base64u decoder, as its
header file does not need to be generated any longer.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 21:30:49 -08:00
Ralf Ramsauer b517121f1c base encoder: simplify structures
We don't need complex getters. Just expose basic operations as they are.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 21:30:49 -08:00
Ralf Ramsauer d05923d2b1 global: constify things
const everything, that should be const.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 21:30:49 -08: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 ccc49f16f7 util: add missing #includes
Detected by activating stronger warnings. If include is missing,
prototypes might diverge.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 14:23:02 -08:00
Ralf Ramsauer ac6db12ddb iodine, iodined: print intentional help to stdout
Like other unix tools: don't print application output, if the user asks
intentionally for help.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 10:39:38 -08:00
Ralf Ramsauer f8f87e3a54 iodine: remove spurious newline
Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 10:39:38 -08:00
Ralf Ramsauer 84ded018cf iodine: add usage for -4 and -6 command line arguments
Those arguments were introduced, but not documented.

Fixes: 619ede5d ("Add options to force IP version for client DNS traffic")
Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 10:39:28 -08:00
Ralf Ramsauer 5fd0874aba iodine: improve help output format
Analogously to the patch for iodined before:
  - remove redundant fprint calls
  - maximum character width: 80 characters (improved readability)
  - add additional newlines

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 02:17:27 -08:00
Ralf Ramsauer 43dad946c6 common: no need for \n in check_superuser
warnx adds the \n for us.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 02:17:27 -08:00
Ralf Ramsauer b884bfecfb iodined: improve usage() readability
Best readability is at 80 characters maximum per line.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 02:17:27 -08:00
Ralf Ramsauer 829a822de3 iodined: improve help output format
Standardise output format:
  - remove redundant fprint calls
  - maximum character width: 80 characters (improved readability)
  - add additional newlines

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 02:17:27 -08:00
Ralf Ramsauer fe0dbccbc5 iodine/iodined: get rid of redundant local __progname definition
Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 02:17:27 -08:00
Ralf Ramsauer 2efa4dfb35 iodine: consolidate help() and usage()
This avoids redundancies.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 02:17:27 -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
Ralf Ramsauer c83d2ae03c client: constify test patterns
There is no reason, why those patterns should not be const.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 02:17:27 -08:00
Ralf Ramsauer 77dd915ad5 Documentation: remove trailing whitespaces
Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
2017-03-11 02:17:27 -08:00
Jes Bodi Klinke 68443abd60 Fixed non-standard passing of va_list into functions declared with ... 2016-11-29 11:10:38 -08:00
Erik Ekman 52e9b3479f Merge pull request #23 from jovial/master
Fix -4 and -6 flags
2016-11-23 10:10:19 +01:00
Will Szumski 1ad7c05b92 Do not validate the autodetected IPs of additional address families when using -4 (IPV4 only) and -6 (IPv6 only) flags 2016-11-23 01:00:11 +00:00
Masaq- a96e2e7a69 Refuse attempts to set options after option negotiation has completed. 2016-10-22 04:46:48 +00:00
Erik Ekman 8e15a73a77 Merge pull request #20 from lexa/master
Add support for socket activation by ipv6 socket
2016-05-17 18:00:04 +02:00
Aleksei Fedotov 2edb879845 Listen on two different sockets for ipv6 and ipv4
Option BindIPv6Only is needed to restrict ipv6 to sending IPv6 packets
only, without it IPv6 socket can be used to send and receive packet to
and from an IPv6 address or an IPv4-mapped IPv6 address.
2016-05-11 00:20:30 +03:00
Aleksei Fedotov 4987aa536d Add support for socket activation by ipv6 socket
iodined may accept ipv4 and ipv6 sockets via systemd socket activation,
we need to figure out type of sockets.
2016-05-10 14:09:21 +03:00
Erik Ekman 36df8dc16b Merge pull request #19 from hardfalcon/master
Fix compilation with systemd>=230 and systemd versions without compat-libs
2016-05-02 17:51:02 +02:00
Pascal Ernster 7b1df75e3a Fix compilation with systemd>=230 and for older systemd versions without compat-libs 2016-04-30 18:27:15 +02:00
Erik Ekman 482d005d11 Add notice about NDIS6 tap driver 2015-09-29 10:02:19 +02:00
Erik Ekman 9c8a941729 Fix make command for old android 2015-08-07 09:54:49 +02:00
Erik Ekman a8a5fbbf0d Second attempt at PIE binary for new android
Github PR #14
2015-08-05 20:04:03 +02:00
Erik Ekman e5843a9143 Use english locale for date in latest-file 2015-08-05 19:54:09 +02:00
Erik Ekman c269a00344 Add support for Android L
Build position-indepent executables, required for Android L (5.0+)
They also work with kitkat.

Add new maketarget "cross-android-old" that builds without PIE
for older versions.

Include both new and old versions in latest-android.zip. Add arm64.

Hopefully solves github PR #14.
2015-08-05 19:36:28 +02:00
Erik Ekman d8bf5cc85b Fix test build after removed test 2015-07-19 10:03:27 +02:00
Erik Ekman f61ed01a3c Remove unused method users_waiting_on_reply() 2015-07-19 09:48:36 +02:00
Erik Ekman 7d915500b7 Drop old mingw 2015-06-30 23:35:35 +02: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 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