Commit graph

323 commits

Author SHA1 Message Date
W.C.A. Wijngaards
734a248284 stream reuse, check incoming messages from rbtree in outnet_tcp_cb when
read a reply, and call that callback and remove that entry.
2020-07-09 13:49:36 +02:00
W.C.A. Wijngaards
ccc9e0749c stream reuse toggle write and read to only read mode when write is done.
tcp callback from stream read without entry linked.
2020-07-09 13:41:03 +02:00
W.C.A. Wijngaards
d89a45d1e1 in outnet_tcptimer: pick up callbacks and clean the struct pending for
use again in tcp_free list; then perform the callbacks in a cleaner state
for reentry into the outside network code.  Delete callbacks afterwards.
2020-07-09 10:28:47 +02:00
W.C.A. Wijngaards
64c8d18814 in tcp write callback routine dont reset read byte count if write and read.
in tcp write callback and write and read and write is done perform callback.
tcp connection is selected to not toggle readwrite and give closed callback.
2020-06-26 10:54:13 +02:00
W.C.A. Wijngaards
d033ce6c23 tcp callback function refactor, split read and timeout event setup, leave
unused queries that are already sent to track their reply on the query
pipeline, when serviced query is deleted deal with the write wait list,
2020-06-25 17:23:46 +02:00
W.C.A. Wijngaards
dfb6d32189 outnet_tcp_cb: add assertion and return when write packets done is handled. 2020-06-25 16:29:37 +02:00
W.C.A. Wijngaards
cbcbd5fa07 pending_tcp_query: cleaner comments. 2020-06-25 16:22:43 +02:00
W.C.A. Wijngaards
c32c43f9f2 for tcp use_free_buffer write straight away on reuse connection, if possible 2020-06-25 16:11:46 +02:00
W.C.A. Wijngaards
34c063701e in outside_network.c: also log messages that end up on the waiting list.
with dnstap.
for tcp use_free_buffer reuse existing entry if second wait entry on the
same addr as the other waiting.
2020-06-25 16:05:25 +02:00
W.C.A. Wijngaards
39a50f30a3 tcp callback handle timeout event for read and reuse keepalive. 2020-06-25 14:26:29 +02:00
W.C.A. Wijngaards
75da272afe reuse tcp id_cmp function. clear list and tree after delete. clear when
decommisioned. callbacks when closed for lru space, and when closed because
not kept open.
2020-06-24 16:28:42 +02:00
W.C.A. Wijngaards
04d805b0eb reuse tcp lookup with correct address as key. 2020-06-24 12:57:15 +02:00
W.C.A. Wijngaards
8ca34be36a fix reuse tcp crash, use addr in reuse struct, free leaked tcp entries. 2020-06-24 10:09:49 +02:00
W.C.A. Wijngaards
6f9310173d Fix grammar. 2020-06-23 17:32:33 +02:00
W.C.A. Wijngaards
c809bb9ece tcp reuse timeout event cleanup and callbacks. 2020-06-23 15:29:40 +02:00
W.C.A. Wijngaards
d96e718f80 fix crash on cleanup. 2020-06-19 18:04:12 +02:00
W.C.A. Wijngaards
0e0c57734a fix uninit after malloc for on_tcp_waiting_list. 2020-06-19 17:40:45 +02:00
W.C.A. Wijngaards
a1babfff1e add bool if on tcp waiting list, so that pkt can be stored.
remove pkt args from outnet_tcp_take_into_use, use w.pkt.
2020-06-19 17:31:36 +02:00
W.C.A. Wijngaards
a695ba447c set timeout to wait for reuse
add comm_point indicator for write events for reuse stream writes.
2020-06-09 16:15:03 +02:00
W.C.A. Wijngaards
d8b7b5ee27 fix to set pending pointer in reuse tcp structure
fix debug output of reuse tcp and test leak of process
2020-06-09 09:14:01 +02:00
W.C.A. Wijngaards
fd723aed27 tcp connection is stored and picked up for reuse
fix that comm_point_start_listening does not close the same fd that is started.
2020-06-03 17:24:26 +02:00
W.C.A. Wijngaards
7cc6a89e21 fix spare id random selection. 2020-06-03 14:23:06 +02:00
W.C.A. Wijngaards
150e1b0491 spare id random selection better. 2020-06-03 14:03:34 +02:00
W.C.A. Wijngaards
0f3c638193 find reuse find tcp loop code for multiple connections to the same destination
find spare id value in reused connection.
2020-06-03 12:10:31 +02:00
W.C.A. Wijngaards
d9afcae346 add debug printout 2020-06-03 09:38:02 +02:00
W.C.A. Wijngaards
aad363ddd1 rename next,prev to lru_next,lru_prev for clarity. 2020-05-26 13:41:07 +02:00
W.C.A. Wijngaards
a83f5d7260 Merge branch 'master' into stream-reuse 2020-05-20 15:39:50 +02:00
gthess
334498d9b9
Merge pull request #221 from NLnetLabs/more-SNI
More SNI support on TLS
2020-04-17 11:37:47 +02:00
George Thessalonikefs
e430e95d30 - Add SNI support on more TLS connections (fixes #193).
- Add SNI support to unbound-anchor.
2020-04-16 14:39:05 +02:00
George Thessalonikefs
e18ab07c62 - Add doxygen documentation for DSCP. 2020-04-16 13:58:35 +02:00
Willem Toorop
4f78b37c61 Down- and upstream padding a la RFC7830 & RFC8467 2020-04-02 18:34:03 +02:00
Yaroslav K
cfddbcb5be add setting IP DiffServ Codepoint (DSCP, previously TOS) on sockets 2020-03-23 19:37:43 +00:00
Ralph Dolmans
87474563ff Merge branch 'kernel-random-port' of https://github.com/fobser/unbound into fobser-kernel-random-port 2020-03-19 15:48:12 +01:00
Florian Obser
5aaa5e253d Allow the kernel to provide random source ports.
On some operating systems, for example OpenBSD since some decades, the
kernel binds to a random source port if asked for any port (port
number 0). There is no need to replicate this functionality in
userland.
2020-02-20 14:54:06 +01:00
W.C.A. Wijngaards
184f26355a Fix ifdef of X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS, and
Merge branch 'master' into framestreams
2020-02-18 08:33:58 +01:00
W.C.A. Wijngaards
6accd3d681 - protect X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS with ifdef for
different openssl versions.
2020-02-18 08:31:38 +01:00
W.C.A. Wijngaards
b4f055effc Merge branch 'master' into framestreams 2020-02-17 15:25:47 +01:00
George Thessalonikefs
4b354d38c1 - Remove unused variable. 2020-02-17 12:56:20 +01:00
W.C.A. Wijngaards
465af58457 dnstap io, fix to compile without ssl. 2020-02-14 13:23:58 +01:00
W.C.A. Wijngaards
6c14c7520b Merge branch 'master' into stream-reuse 2020-02-12 11:58:17 +01:00
W.C.A. Wijngaards
ad180402ea dnstap io, set tls auth name in outgoing ssl 2020-02-05 16:17:21 +01:00
Ralph Dolmans
810862dc65 - Stop working on socket when socket() call returns an error.
- Check malloc return values in TLS session ticket code
2020-01-30 19:15:58 +01:00
W.C.A. Wijngaards
57aefd102e Stream reuse branch, for TCP and TLS stream reuse.
This is for upstream pipes and using them again for the next query.

Signposted code for reuse_tcp structure in outside_network.h
2020-01-16 17:12:32 +01:00
W.C.A. Wijngaards
554e4a939c - Fix fix for #78 to also free service callback struct. 2019-09-19 10:03:47 +02:00
W.C.A. Wijngaards
1a4eaaabc5 - Fix #78: Memory leak in outside_network.c. 2019-09-19 09:11:23 +02:00
Wouter Wijngaards
f5a197f96e
Update services/outside_network.c
Co-Authored-By: wtoorop <willem@nlnetlabs.nl>
2019-04-29 11:25:45 +02:00
Wouter Wijngaards
a9c8d00d63
Update services/outside_network.c
Co-Authored-By: wtoorop <willem@nlnetlabs.nl>
2019-04-29 11:25:04 +02:00
W.C.A. Wijngaards
6ce60bcb61 Fixup fd pass. 2019-04-29 10:40:12 +02:00
W.C.A. Wijngaards
af11b54071 Review changes for the XoT branch
With doc, SSL setup function, and function parameter doc.
2019-04-29 10:25:19 +02:00
Willem Toorop
92121f7878 Report XoT failure as XoT failure, not https 2019-04-03 12:41:14 +02:00
Willem Toorop
48ad6477eb AXFR over TLS
Enable by specifying an auth name, like this:
```
auth-zone:
        name: nlnetlabs.nl
        master: 185.49.140.60#ns.nlnetlabs.nl
```
2019-03-24 10:43:57 +01:00
Wouter Wijngaards
bb5251da66 - Add log message, at verbosity 4, that says the query is encrypted
with TLS, if that is enabled for the query.


git-svn-id: file:///svn/unbound/trunk@5136 be551aaa-1e26-0410-a405-d3ace91eadb9
2019-03-18 08:41:39 +00:00
Ralph Dolmans
723845b350 - Fix case in which query timeout can result in marking delegation as
edns_lame_known.


git-svn-id: file:///svn/unbound/trunk@5089 be551aaa-1e26-0410-a405-d3ace91eadb9
2019-01-30 13:44:19 +00:00
Ralph Dolmans
f30fe71395 - Get ready for the DNS flag day: remove EDNS lame procedure, do not re-query
without EDNS after timeout.


git-svn-id: file:///svn/unbound/trunk@5037 be551aaa-1e26-0410-a405-d3ace91eadb9
2019-01-16 10:23:13 +00:00
Wouter Wijngaards
1b72e814e7 - Fixup openssl 1.0.2 compile
git-svn-id: file:///svn/unbound/trunk@5019 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-12-10 14:36:43 +00:00
Wouter Wijngaards
71b078611f - Fix #4206: support openssl 1.0.2 for TLS hostname verification,
alongside the 1.1.0 and later support that is already there.


git-svn-id: file:///svn/unbound/trunk@5018 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-12-10 14:27:24 +00:00
Wouter Wijngaards
b23c373f4d - Refuse to start with no ports.
git-svn-id: file:///svn/unbound/trunk@4997 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-11-29 14:26:16 +00:00
Wouter Wijngaards
2d28fba3bf - Squelch log of failed to tcp initiate after TCP Fastopen failure.
git-svn-id: file:///svn/unbound/trunk@4937 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-10-08 13:27:53 +00:00
Wouter Wijngaards
377d5b426a - Add SSL cleanup for tcp timeout.
git-svn-id: file:///svn/unbound/trunk@4915 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-09-25 09:01:13 +00:00
Wouter Wijngaards
f82a128909 - Perform TLS SNI indication of the host that is being contacted
for DNS over TLS service.  It sets the configured tls auth name.
  This is useful for hosts that apart from the DNS over TLS services
  also provide other (web) services.


git-svn-id: file:///svn/unbound/trunk@4914 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-09-25 08:31:42 +00:00
Wouter Wijngaards
9b6caf5a5b - Fix that with harden-below-nxdomain and qname minisation enabled
some iterator states for nonresponsive domains can get into a
  state where they waited for an empty list.
- Stop UDP to TCP failover after timeouts that causes the ping count
  to be reset by the TCP time measurement (that exists for TLS),
  because that causes the UDP part to not be measured as timeout.


git-svn-id: file:///svn/unbound/trunk@4912 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-09-17 11:25:52 +00:00
Wouter Wijngaards
4bf9d12419 - Fix for 4126 that the #define for UNKNOWN_SERVER_NICENESS can be more
easily changed to adjust default rtt assumptions.


git-svn-id: file:///svn/unbound/trunk@4779 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-07-12 14:15:03 +00:00
Wouter Wijngaards
5d298ed474 - Fix permission denied printed for auth zone probe random port nrs.
git-svn-id: file:///svn/unbound/trunk@4769 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-07-03 13:58:49 +00:00
Wouter Wijngaards
23f475bccc - Tentative fix for permission denied on IPv6 address on FreeBSD.
git-svn-id: file:///svn/unbound/trunk@4754 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-06-26 08:01:44 +00:00
Wouter Wijngaards
b9607297e9 - For TCP and TLS connections that don't establish, perform address
update in infra cache, so future selections can exclude them.


git-svn-id: file:///svn/unbound/trunk@4693 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-05-25 06:21:39 +00:00
Wouter Wijngaards
6fefbb4115 - Fix fail to reject dead peers in forward-zone, with ssl-upstream.
git-svn-id: file:///svn/unbound/trunk@4670 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-05-02 06:36:02 +00:00
Wouter Wijngaards
9d28279475 - Can set tls authentication with forward-addr: IP#tls.auth.name
And put the public cert bundle in tls-cert-bundle: "ca-bundle.pem".


git-svn-id: file:///svn/unbound/trunk@4631 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-04-19 12:10:05 +00:00
Wouter Wijngaards
5c8819f1ac - Fix for windows compile.
git-svn-id: file:///svn/unbound/trunk@4563 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-03-06 09:18:53 +00:00
Wouter Wijngaards
54bd1fdd62 - tls-cert-bundle option in unbound.conf enables TLS authentication.
git-svn-id: file:///svn/unbound/trunk@4532 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-02-13 10:35:09 +00:00
Wouter Wijngaards
ad89368b4e auth zone work.
git-svn-id: file:///svn/unbound/trunk@4521 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-02-08 11:59:30 +00:00
Wouter Wijngaards
75eb720ab5 auth zone work on http feature.
git-svn-id: file:///svn/unbound/trunk@4517 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-02-07 16:10:31 +00:00
Wouter Wijngaards
cc9a0671f3 auth zone socket creation fix.
git-svn-id: file:///svn/unbound/trunk@4489 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-02-01 15:43:00 +00:00
Wouter Wijngaards
84e819dc31 auth zone move file descriptor functionality to outside network
for the unit test


git-svn-id: file:///svn/unbound/trunk@4482 be551aaa-1e26-0410-a405-d3ace91eadb9
2018-01-31 14:59:17 +00:00
Wouter Wijngaards
30da6bde6f - authzone work, transfer connect.
git-svn-id: file:///svn/unbound/trunk@4420 be551aaa-1e26-0410-a405-d3ace91eadb9
2017-12-12 15:39:45 +00:00
Wouter Wijngaards
7d17a926ac - Spelling fixes, from Phil Porada.
git-svn-id: file:///svn/unbound/trunk@4344 be551aaa-1e26-0410-a405-d3ace91eadb9
2017-09-15 14:29:28 +00:00
Wouter Wijngaards
b320c7ebd5 - Fix issue on macOX 10.10 where TCP fast open is detected but not
implemented causing TCP to fail. The fix allows fallback to regular
  TCP in this case and is also more robust for cases where connectx()
  fails for some reason.


git-svn-id: file:///svn/unbound/trunk@4304 be551aaa-1e26-0410-a405-d3ace91eadb9
2017-08-21 11:44:46 +00:00
Wouter Wijngaards
7ebe1fe115 - More fixes in depth for buffer checks in 0x20 qname checks.
git-svn-id: file:///svn/unbound/trunk@4225 be551aaa-1e26-0410-a405-d3ace91eadb9
2017-06-13 14:34:44 +00:00
Wouter Wijngaards
843bd4156e - Fix #1280: Unbound fails assert when response from authoritative
contains malformed qname.  When 0x20 caps-for-id is enabled, when
  assertions are not enabled the malformed qname is handled correctly.
- 1.6.3 tag created, with only #1280 fix, trunk is 1.6.4 development.


git-svn-id: file:///svn/unbound/trunk@4224 be551aaa-1e26-0410-a405-d3ace91eadb9
2017-06-13 14:25:47 +00:00
Wouter Wijngaards
4e502fd624 - Set SO_REUSEADDR on outgoing tcp connections to fix the bind before
connect limited tcp connections.  With the option tcp connections
  can share the same source port (for different destinations).


git-svn-id: file:///svn/unbound/trunk@4151 be551aaa-1e26-0410-a405-d3ace91eadb9
2017-05-08 10:41:03 +00:00
Wouter Wijngaards
ad2e157763 - Fix tcp-mss failure printout text.
git-svn-id: file:///svn/unbound/trunk@4150 be551aaa-1e26-0410-a405-d3ace91eadb9
2017-05-08 07:15:48 +00:00
Wouter Wijngaards
c010e93d4a - Fix to rename internally used types from _t to _type, because _t
type names are reserved by POSIX.
- iana portlist update


git-svn-id: file:///svn/unbound/trunk@3989 be551aaa-1e26-0410-a405-d3ace91eadb9
2017-01-19 10:25:41 +00:00
Wouter Wijngaards
cd7db58ce3 - configure --enable-systemd and lets unbound use systemd sockets if
you enable use-systemd: yes in unbound.conf.
  Also there are contrib/unbound.socket and contrib/unbound.service:
  systemd files for unbound, install them in /usr/lib/systemd/system.
  Contributed by Sami Kerola and Pavel Odintsov.



git-svn-id: file:///svn/unbound/trunk@3975 be551aaa-1e26-0410-a405-d3ace91eadb9
2017-01-03 13:43:29 +00:00
George Thessalonikefs
7b948b0647 - Added generic EDNS code for registering known EDNS option codes,
bypassing the cache response stage and uniquifying mesh states. Four EDNS
  option lists were added to module_qstate (module_qstate.edns_opts_*) to
  store EDNS options from/to front/back side.
- Added two flags to module_qstate (no_cache_lookup, no_cache_store) that
  control the modules' cache interactions.
- Added code for registering inplace callback functions. The registered
  functions can be called just before replying with local data or Chaos,
  replying from cache, replying with SERVFAIL, replying with a resolved
  query, sending a query to a nameserver. The functions can inspect the
  available data and maybe change response/query related data (i.e. append
  EDNS options).
- Updated Python module for the above.
- Updated Python documentation.



git-svn-id: file:///svn/unbound/trunk@3947 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-12-06 13:42:51 +00:00
Wouter Wijngaards
2127c65561 - Fix dnstap relaying "random" messages instead of resolver/forwarder
responses, from Nikolay Edigaryev.


git-svn-id: file:///svn/unbound/trunk@3869 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-09-27 11:56:55 +00:00
Wouter Wijngaards
42f14e7c4d - Fix #802: workaround for function parameters that are "unused"
without log_assert.


git-svn-id: file:///svn/unbound/trunk@3823 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-07-22 07:05:52 +00:00
Wouter Wijngaards
e71f0b2f34 - Fix #798: Client-side TCP fast open fails (Linux).
git-svn-id: file:///svn/unbound/trunk@3819 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-07-18 13:54:32 +00:00
Wouter Wijngaards
95e9dff362 - TCP Fast open patch from Sara Dickinson.
git-svn-id: file:///svn/unbound/trunk@3814 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-07-14 07:06:34 +00:00
Wouter Wijngaards
48ca4dc880 lint.
git-svn-id: file:///svn/unbound/trunk@3813 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-07-07 10:31:50 +00:00
Wouter Wijngaards
1394dcba69 - Fix #787: outgoing-interface netblock/64 ipv6 option to use linux
freebind to use 64bits of entropy for every query with random local
  part.


git-svn-id: file:///svn/unbound/trunk@3804 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-07-04 14:51:30 +00:00
Wouter Wijngaards
031caba9c0 - and also generic edns options for upstream messages (and replies).
after parse use edns_opt_find(edns.opt_list, LDNS_EDNS_NSID),
  to insert use edns_opt_append(edns, region, code, len, bindata) on
  the opt_list passed to send_query, or in edns_opt_inplace_reply.


git-svn-id: file:///svn/unbound/trunk@3742 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-05-31 16:55:22 +00:00
Wouter Wijngaards
3904c2be9a fixup upstream edns opts.
git-svn-id: file:///svn/unbound/trunk@3741 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-05-31 15:52:33 +00:00
Wouter Wijngaards
3e41fd11fc - Fix #759: 0x20 capsforid no longer checks type PTR, for
compatibility with cisco dns guard.  This lowers false positives.


git-svn-id: file:///svn/unbound/trunk@3715 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-04-28 07:24:50 +00:00
Wouter Wijngaards
636e2ef520 please lint.
git-svn-id: file:///svn/unbound/trunk@3704 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-04-18 12:39:16 +00:00
Wouter Wijngaards
f64c2d8d08 Slightly more general (i.e. for TYPE0 too).
git-svn-id: file:///svn/unbound/trunk@3703 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-04-18 12:23:21 +00:00
Wouter Wijngaards
0d5d685514 Explain what we do.
git-svn-id: file:///svn/unbound/trunk@3702 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-04-18 12:00:57 +00:00
Wouter Wijngaards
e77a3a9941 - Fix some malformed reponses to edns queries get fallback to nonedns.
git-svn-id: file:///svn/unbound/trunk@3701 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-04-18 11:56:55 +00:00
Wouter Wijngaards
9f8b2bb468 - ip_freebind: yesno option in unbound.conf sets IP_FREEBIND for
binding to an IP address while the interface or address is down.


git-svn-id: file:///svn/unbound/trunk@3673 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-03-15 09:35:48 +00:00
Wouter Wijngaards
4f1625afb7 - Fix #747: assert in outnet_serviced_query_stop.
git-svn-id: file:///svn/unbound/trunk@3646 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-03-07 10:00:08 +00:00
Wouter Wijngaards
dd8b5729f2 Fix signed-unsigned lint warnings in tcp-mss.
git-svn-id: file:///svn/unbound/trunk@3592 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-01-05 10:08:37 +00:00
Wouter Wijngaards
5d0ad681a2 - #731: tcp-mss, outgoing-tcp-mss options for unbound.conf, patch
from Daisuke Higashi.


git-svn-id: file:///svn/unbound/trunk@3591 be551aaa-1e26-0410-a405-d3ace91eadb9
2016-01-05 10:03:59 +00:00