Commit graph

265 commits

Author SHA1 Message Date
Anton Lindqvist
422213c171 add missing null check
I have a unbound forward zone configured on my router for my $DAYJOB.
The address associated with the zone is only accessible when the router
is connected to a VPN. If the VPN connection is absent, trying to
resolve any domain that must be handled by the zone crashes unbound.
Turns out there's a missing NULL check in `comm_point_send_udp_msg()`.
The same routine already has `if (addr) {} else {}` branches so I guess
protecting the call to `log_addr()` using the same conditional is
reasonable

I have also committed the same fix to unbound shipped with OpenBSD[1].

[1] https://marc.info/?l=openbsd-cvs&m=160993335615698&w=2
2021-01-06 12:44:26 +01:00
W.C.A. Wijngaards
44075a06a5 - Fix #379: zone loading over HTTP appears to have buffer issues. 2021-01-06 10:36:23 +01:00
W.C.A. Wijngaards
4d51c6b86e - For #376: Fix that comm point event is not double removed or double
added to event map.
2021-01-04 14:05:50 +01:00
George Thessalonikefs
08968baec1 - Fix error cases when udp-connect is set and send() returns an error
(modified patch from Xin Li @delphij).
2020-12-16 17:11:41 +01:00
Wouter Wijngaards
48c038391a
Merge pull request #373 from fobser/void-arithmetic
Warning: arithmetic on a pointer to void is a GNU extension.
2020-12-11 14:07:30 +01:00
Wouter Wijngaards
29b5b25852
Merge pull request #335 from fobser/static
Sprinkle in some static to prevent missing prototype warnings.
2020-12-11 14:03:46 +01:00
Florian Obser
15e1b16da0 Warning: arithmetic on a pointer to void is a GNU extension. 2020-12-11 14:00:20 +01:00
W.C.A. Wijngaards
7077660932 - Fix to squelch permission denied and other errors from remote host,
they are logged at higher verbosity but not on low verbosity.
2020-12-11 10:30:54 +01:00
W.C.A. Wijngaards
9eeb95a960 - Fix update, with write event check with streamreuse and fastopen. 2020-12-02 16:17:26 +01:00
W.C.A. Wijngaards
0502ab3026 - Fix for #283: fix stream reuse and tcp fast open. 2020-12-02 15:42:24 +01:00
W.C.A. Wijngaards
e049fb303c - Fix on windows to ignore connection failure on UDP, unless verbose. 2020-12-02 11:58:24 +01:00
W.C.A. Wijngaards
16c496bff6 - Fix #356: deadlock when listening tcp. 2020-12-02 10:10:27 +01:00
W.C.A. Wijngaards
1ebf851bf0 - Fix #360: for the additionally reported TCP Fast Open makes TCP
connections fail, in that case we print a hint that this is
  happening with the error in the logs.
2020-12-02 09:51:26 +01:00
W.C.A. Wijngaards
67a0614db7 - Fix that after failed read, the readagain cannot activate. 2020-11-26 12:12:52 +01:00
W.C.A. Wijngaards
4a8669612a - Fix to omit UDP receive errors from log, if verbosity low.
These happen because of udp-connect.
2020-11-26 09:39:54 +01:00
W.C.A. Wijngaards
e50152aa1f - Fix readagain and writeagain callback functions for comm point
cleanup.
2020-11-25 13:46:28 +01:00
W.C.A. Wijngaards
15e8f5c6d4 - Fix udp-connect on FreeBSD, do send calls on connected UDP socket. 2020-11-25 09:55:01 +01:00
W.C.A. Wijngaards
5924a591be - with udp-connect ignore connection refused with UDP timeouts. 2020-11-25 09:41:06 +01:00
Florian Obser
9fb65e2b9e Sprinkle in some static to prevent missing prototype warnings. 2020-10-28 14:15:23 +01:00
W.C.A. Wijngaards
78e9b8949c Merge branch 'master' into stream-reuse
Resolved comm_point_start_listening conflict for socket close.
2020-10-21 09:54:03 +02:00
W.C.A. Wijngaards
531ce9e85c Fixup for clear of tcp handler structure. 2020-10-19 13:36:53 +02:00
W.C.A. Wijngaards
68c57314c4 - Fix to set the tcp handler event toggle flag back to default when
the handler structure is reused.
2020-10-19 12:55:43 +02:00
W.C.A. Wijngaards
ab9d732796 - Log ip address when http session recv fails, eg. due to tls fail. 2020-10-19 11:06:55 +02:00
W.C.A. Wijngaards
a3e2bfbb0c - Fix #330: [Feature request] Add unencrypted DNS over HTTPS support.
This adds the option http-notls-downstream: yesno to change that,
  and the dohclient test code has the -n option.
2020-10-19 10:24:03 +02:00
Ralph Dolmans
4ae823fbc2 Merge branch 'master' into doh 2020-09-16 18:38:51 +02:00
Ralph Dolmans
42a35ac26e - Final round of DoH review feedback processing. 2020-09-16 18:25:02 +02:00
Ralph Dolmans
a3be2b73b6 Properly handle http_endpoint malloc failure. 2020-09-10 13:05:55 +02:00
W.C.A. Wijngaards
47a5dc8cae - Refactor to use sock_strerr shorthand function. 2020-08-31 09:12:01 +02:00
W.C.A. Wijngaards
a6dc0743b4 - Merge PR #293: Add missing prototype. Also refactor to use the new
shorthand function to clean up the code.
2020-08-31 08:41:34 +02:00
W.C.A. Wijngaards
8b43b94b22 Merge branch 'master' into stream-reuse 2020-07-22 09:53:57 +02:00
Ralph Dolmans
14a0433470 - Merge PR #234 - Ensure proper alignment of cmsg buffers by Jérémie
Courrèges-Anglas.
- Fix PR #234 log_assert sizeof to use union buffer.
2020-07-17 13:07:03 +02:00
W.C.A. Wijngaards
766005a356 stream reuse, in callbacks, removed whitespace. 2020-07-13 15:45:16 +02:00
W.C.A. Wijngaards
19a35fb839 stream reuse, write and read again if more data can go over the channel,
this amortizes the event loop mechanism for busy channels, for performance.
2020-07-13 15:16:59 +02:00
W.C.A. Wijngaards
9914b7216b stream reuse, remove debug output 2020-07-10 16:06:17 +02:00
W.C.A. Wijngaards
7a69ff4182 fix that ssl_handle_it() uses tcp_is_reading in tcp_write_and_read mode.
fix that netevent tcp_write_and_read mode does not close due to error from
assert that not both write and read happen at the same time.
2020-07-10 15:37:30 +02:00
W.C.A. Wijngaards
e95edd3d36 debug prints in verbose output. 2020-07-09 13:41:50 +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
cfe009a31c tcp read and write handling of write events in netevent for tcp and ssl. 2020-06-26 16:05:15 +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
39a50f30a3 tcp callback handle timeout event for read and reuse keepalive. 2020-06-25 14:26:29 +02:00
Ralph Dolmans
0fbfce4c99 - Add DoH tests 2020-06-24 14:04:34 +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
Ralph Dolmans
8fc2320b5c - Add mem.http.query_buffer and mem.http.response_buffer stats
- Add configurable limits for http-query-buffer-size and
  http-response-buffer-size
- Make http endpoint, max_streams, and TCP_NODELAY for HTTP sockets
  configurable.
2020-05-12 18:12:19 +02:00
Jeremie Courreges-Anglas
8175161059 Ensure proper alignment of cmsg buffers
The cmsg macros expect a control message buffer to be aligned like
a struct cmsghdr.  The current layout around those stack-allocated
buffers probably provides the required alignment (usually 4 bytes).
Use a union to enforce proper alignment, in case future changes modify
the stack layout.

Spotted when chasing an unrelated bug with Otto Moerbeek (@omoerbeek).
2020-05-10 17:23:33 +02:00
Ralph Dolmans
e7601870cc Merge branch 'master' into doh 2020-05-07 17:12:26 +02:00
Ralph Dolmans
8dae5d9f81 - Add DNS-over-HTTPS support 2020-05-07 16:36:26 +02:00
Willem Toorop
af0bd5b0b4 Send tcp_req_info->spool_buffer as dnstap CLIENT_RESPONSE
When tcp_req_info exists. This fixes that dnstap CLIENT_RESPONSE messages did not contain the response message when answering on statful transport for uncached responses.
2020-03-30 12:19:17 +02:00
Willem Toorop
9d9eee8402 Fix uncached CLIENT_RESPONSE'es on stateful transports
Because repinfo->c->buffer does not contain the response when the it did not came from cache.
Only after tcp_req_info_send_reply is called, is the response on the buffer which is used to fill the dnstap protobuf's.
2020-03-30 11:39:07 +02:00
W.C.A. Wijngaards
25a88d6d54 dnstap io, check peer verification in dtstream dtio_ssl_handshake. 2020-02-12 15:23:58 +01:00
W.C.A. Wijngaards
dc31cf3652 dnstap unbound-dnstap-sock, read from TLS. 2020-01-31 14:03:28 +01:00