Commit Graph

65 Commits

Author SHA1 Message Date
Erik Ekman a8a20f570e Formatting: spaces around operators 2020-07-24 19:15:02 +02:00
Erik Ekman 19d0d1be64 Formatting: Space between 'if' and parenthesis 2020-07-24 18:56:30 +02:00
Erik Ekman cde0b7632d Set additional record count properly in NS reply
For when there is no IPv4 address to return.
2020-07-23 22:12:07 +02:00
Erik Ekman ec6a1ac308 Fix IPv4 address in replies to A or NS queries (github issue #38)
The destination field in struct query was changed from in_addr_t to
struct sockaddr_storage, wihtout updating the functions sending it
in src/dns.c.

Only add extra A answer for NS queries if destination refers to an
IPv4 address, and fail if trying to encode a reply to an A query
if destination is not IPv4.

This means NS requests received over IPv6 will not contain an address
and A requests will be ignored, unless the -n option is used, or the
www subdomain is requested which sets a fixed address (127.0.0.1).
2020-07-23 21:49:46 +02:00
Erik Ekman 2032b44949 Look up external IP via DNS instead of HTTP
Use myip.opendns.com via their resolver.

The code is now TCP free again :)
2020-05-24 16:06:41 +02: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 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
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 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 2466cd184a Change readshort() to work with unsigned values 2014-06-09 19:47:44 +02: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 d6c3426b84 Set C standard to C99
Also include strings.h where strcasecmp() is used
2014-05-29 18:38:43 +02:00
Barak A. Pearlmutter f73fb9f8d0 rewrite comparison to avoid negative unsigned numbers
Note that GCC -O2 is happy to optimize away (x<0) when x is an
unsigned quantity.  This was actually occurring in CHECKLEN(0),
causing the compiler to issue a warning.
2014-04-06 13:41:17 +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
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 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
J. A. Bezemer 60dfbf1b34 merge dns and user #76 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
J. A. Bezemer 90e25e3a2c update dns parsing #75 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 b6fc3fc0ef Made dns_get_id return unsigned short, added test cases 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 97bf71e944 Make it build and fix tests in cygwin 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 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 8769d14cde rewrote strange message 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 49695a4cb4 Updated year 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
Erik Ekman 539ebb27d9 Changes to allow handling of queries of type A, NS etc 2012-02-04 20:33:57 +01:00
Erik Ekman d50533e26e Rewrote strange warning message 2012-02-04 20:33:56 +01:00
Matus Harvan 4a16503ea5 buffer overflow in dns.c pointed out by Matus Harvan, also strncpy cleanups 2012-02-04 20:33:55 +01:00
Erik Ekman fc3de73f85 fixed #17: report RCODE error msgs 2012-02-04 20:33:55 +01:00
Erik Ekman faea33eaae Move dns_build_hostname to iodine.c 2007-06-07 18:57:18 +00:00
Erik Ekman 15a83534a8 new year 2007-03-21 00:00:27 +00:00
Erik Ekman ad07e40988 Use -pedantic, fixed all warnings 2007-02-11 13:54:40 +00:00
Bjorn Andersson eb082ac9ce code cleanup 2007-02-10 22:52:36 +00:00
Bjorn Andersson 16e9df4164 moved method that encoded strings to dnsnames to read.c and renamed it to putname 2007-02-10 22:30:40 +00:00
Erik Ekman a49e400ea9 splint said that these headers where not used 2007-02-10 22:13:42 +00:00
Erik Ekman 9355cd7829 #10 fixed basic ack. pings bigger than 110 still lost 2007-02-05 19:44:46 +00:00
Erik Ekman 9b438c20d4 #3 remove dnsd_send from dns.c, move to iodined.c 2007-02-05 17:49:30 +00:00
Bjorn Andersson db62c7f82c extracted common code from send_* in iodine.c 2007-02-04 23:12:08 +00:00
Erik Ekman da636b1f47 #3 fix issue with topdomain. Also make sure ping packet is type NULL 2007-02-04 23:08:09 +00:00