summaryrefslogtreecommitdiffstats
path: root/daemon/session.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* drop unused #include linesVladimír Čunát2022-06-031-1/+0
| | | | | | https://clangd.llvm.org/design/include-cleaner Though somehow I'm all the time getting false positives for "daemon/bindings/impl.h"
* daemon: add PROXYv2 SSL TLV handling + minor refactoringOto Šťáva2022-02-221-3/+1
|
* daemon: correct PROXYv2 handling for TCP sessionsOto Šťáva2022-02-221-0/+20
|
* daemon: use flags from proxy header + refactor comm dataOto Šťáva2022-02-221-4/+3
|
* daemon: PROXYv2 header processingOto Šťáva2022-02-221-13/+20
|
* daemon/tls: fix TLS client resumptionOto Šťáva2022-02-181-1/+1
|
* ede: add KNOT_EDNS_EDE_NREACH_AUTHTomas Krizek2021-12-211-0/+3
|
* lib/utils: rename union inaddr to union kr_sockaddrOto Šťáva2021-12-201-2/+2
|
* spellingJosh Soref2021-11-191-2/+2
| | | | Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
* trie_del: use KNOT_EOK instead of kr_ok()Tomas Krizek2021-10-111-3/+3
|
* doh2: ensure memory from unsent streams is freedTomas Krizek2021-08-181-3/+3
| | | | | | | | | | | | | | The nghttp2 on_stream_close callback is only called for streams that are properly closed. If we need to tear down the HTTP connection due to any reason (e.g. IO error in underlying layer), some streams may not be propely closed. Due to HTTP/2 flow control, we may also wait indefinitely for the data to be written. This can also cause the stream to never be properly closed. To handle these cases, a reference of allocated data is kept and we ensure everything is freed once we're closing the http session.
* daemon/session: fix an issue with timersVladimír Čunát2021-07-281-2/+8
| | | | The practical problem was also mitigated by libuv >= 1.32.0 (2ee2d46)
* treewide: rename assumptions to kr_assert() / kr_fails_assert()Tomas Krizek2021-05-251-12/+12
| | | | | | | | | | | | | To (hopefully) improve readability, rename the typical macro usage of: if (!kr_assume(x)) y; // to if (kr_fails_assert(x)) y; As a convenience, replace the assert without a return value to a more simple version: (void)!kr_assume(x); // becomes kr_assert(x);
* daemon/session.c: replace assertsTomas Krizek2021-05-251-35/+25
|
* XDP: add backend partsVladimír Čunát2020-11-101-3/+10
| | | | | | Logging strings: I originally wanted to have four chars inside [], but it doesn't really matter in these cases where logs don't happen within a request, so "[xdp]" won due to uniformity and simplicity.
* treewide: unify ENABLE_* definesVladimír Čunát2020-10-201-4/+4
| | | | | | | | | | | | | Two styles were used: (un)defined and 0/1. We switch to 0/1. Advantage: it can be used also like `if (ENABLE_FOO)` (outside preprocessor). Except for ./meson.build it's sed \ -e 's/#ifdef ENABLE_CAP_NG/#if ENABLE_CAP_NG/g' \ -e 's/#ifdef ENABLE_DOH2/#if ENABLE_DOH2/g' \ -e 's/defined(ENABLE_COOKIES)/ENABLE_COOKIES/g' \ -e 's/#ifdef ENABLE_COOKIES/#if ENABLE_COOKIES/g' \ -i $(git grep -l ENABLE_)
* daemon: make nghttp2 optionalTomas Krizek2020-10-131-0/+8
|
* daemon/http: rename struct http_ctxTomas Krizek2020-10-131-3/+3
|
* daemon/http: improve buffer handlingTomas Krizek2020-10-131-0/+6
| | | | Fixes GET requests and handles some edge cases.
* doh: C implementation of DoH - WiPJan Hak2020-10-131-2/+19
| | | | | Working server-side GET/POST HTTPS method - Proof-of-Concept Working server-side GET/POST HTTP/2 method - WiP
* daemon/session: use common naming convention in the entire fileTomas Krizek2020-09-231-12/+12
| | | | | Rename "s" to "session" to be consistent with all the other session_*() functions to make it easier to read.
* daemon/worker: use proper name for packet in worker_submit()Tomas Krizek2020-09-231-4/+4
| | | | | The variable name query is misleading, since the passed in packet can actually be a response as well (or a malformed packet).
* daemon: handle IO error when processing wire bufferTomas Krizek2020-09-231-9/+15
| | | | | | | | | | | | | | | | | | | | | This fixes the following assert: daemon/worker.c:1157: qr_task_finalize: Assertion `!session_flags(source_session)->closing' failed. Scenario which leads to the above error: 1. We're using a stateful protocol. 2. Enough data arrive in a single tcp_recv() call to put at least two queries into the session's wire buffer. 3. session_wirebuf_process() calls worker_submit() which calls qr_task_step(). 4. In the qr_task_step() the query state changes to KR_STATE_DONE, then qr_task_finalize() is called. 5. qr_task_send() is called, but it fails. This is where qr_task_finalize() closes the session, but used to return no error. 6. When the next query is processed in session_wirebuf_process(), steps 3 and 4 are followed and qr_task_finalize() is called. 7. Since the session is already closed, the assert is triggered. Debugging this was a lot of fun... All hail the rr debugger!
* daemon: rename tls_ctx and tls_client_ctx structsTomas Krizek2020-08-251-9/+9
| | | | | | | | | | The trailing _t implies the type is a typedef like: typedef struct tls_ctx { ... } tls_ctx_t; But it is a plain struct - so remove it to avoid confusion.
* daemon: don't get worker from uv_loop_t::data anymoreVladimír Čunát2020-08-061-5/+3
|
* treewide: machine readable license for GNU GPLv3+ source codePetr Špaček2020-02-251-13/+1
| | | | | Long GNU GPLv3 boilderplate was automatically replaced with machine readable tag.
* daemon: avoid excessive getsockname() syscallsVladimír Čunát2019-10-101-5/+14
| | | | Calling this on every incoming UDP request could cost us up to 5% time.
* daemon: proper processing of unsuccessful TLS rehandshakeGrigorii Demidov2018-12-141-1/+1
|
* daemon/worker, session: correctly process connected...Grigorii Demidov2018-12-111-6/+0
| | | | ... upstreams list when closing outgoing connection
* daemon/session: session_close() alwayes delete peers addresses from the list ↵Grigorii Demidov2018-12-071-1/+1
| | | | of estblished TCP connections even if underlying transport is UDP; fixed
* bugfixes in tcp connection error handlingGrigorii Demidov2018-12-071-1/+1
|
* daemon various nitpicksVladimír Čunát2018-11-281-5/+0
| | | | | - session: data length would be difference between start and end indices, but the function is unused so why even have it?
* daemon TLS: increase wire-buffer sizeGrigorii Demidov2018-11-281-9/+26
| | | | | | When decoding large packets, gnutls gives the application chunks of size 16kb. So that tls session wirebuffer must be at least KNOT_WIRE_MAX_PKTSIZE + 16kb. (message re-formatted by vcunat)
* daemon/io: fix insufficient error handling when receiving tls dataGrigorii Demidov2018-11-281-0/+5
|
* daemon: TCP connection timeouting has changed; connection was closed after ↵Grigorii Demidov2018-10-221-4/+5
| | | | peer's inactivity before, now it is closed after incativity in both directions (peer->kresd, kresd->peer); prevents connection from closing before answer sent to client
* daemon/session.c nitpick: add missing copyright headerVladimír Čunát2018-10-121-0/+16
|
* Unificate handling of TCP timeouts for input and output connections; avoid ↵Grigorii Demidov2018-10-121-72/+84
| | | | redundant code; bugfixing
* daemon/session nitpick: avoid a warningVladimír Čunát2018-10-121-2/+2
| | | | | | | | lint:clang-scan-build reported: > warning: The code calls sizeof() on a pointer type. > This can produce an unexpected result but in our case it's intentional. (Yes, using pointers as keys in trie isn't very pretty.)
* daemon: bugfixes & improvementsGrigorii Demidov2018-10-121-2/+7
|
* daemon/session: migrate from array_t to trie_t & queue_t; daemon/worker: ↵Grigorii Demidov2018-10-121-109/+114
| | | | some simplifications
* daemon/session: fixes for bugs revealed by transport testsGrigorii Demidov2018-10-121-10/+21
|
* daemon/session: combine _new() and _set_handle()Vladimír Čunát2018-10-121-11/+9
| | | | They don't seem to be useful individually, so why not clean up.
* daemon nitpick cleanupsVladimír Čunát2018-10-121-1/+1
| | | | | | | | - Some (potentially) unused vars were left behind. - The two on_* functions are identical except for the uv types passed, and those are surely the same in the part we use, but it's not worth to deduplicate when these functions are only two and so simple. - lint:c was complaining about the uv_tcp_t malloc().
* daemon: drop RECVMMSG_BATCHVladimír Čunát2018-10-121-0/+8
| | | | | | The support hasn't landed in libuv over all the years, and we've been still reserving memory for it in advance. Also comment on the singleton buffer usage.
* worker: remove freelists for iohandle and iorequestVladimír Čunát2018-10-121-4/+1
| | | | | | | | | A quick profiling showed no change in performance, and in particular no change in time spent in malloc/free. Some of the types in the union differed in size by a multiple. If their performance won't be satisfying, replacements should be considered first (e.g. jemalloc) before rolling our own stuff.
* daemon/session: minor refactoring around session flags to reduce number of ↵Grigorii Demidov2018-10-121-47/+2
| | | | api functions
* session_kill_ioreq(): worker.c -> session.cVladimír Čunát2018-10-121-0/+55
|
* daemon: fix memory leaks & asan errors; improvements in bufferingGrigorii Demidov2018-10-121-49/+101
|
* damon/session: additional processing for DNS packets with TSIGGrigorii Demidov2018-10-121-9/+25
|
* demon: fix lint errorsGrigorii Demidov2018-10-121-22/+22
|