![]() |
The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
|
Tests for the retry bio running out of entries. More...
#include <freeradius-devel/util/test/acutest_common_init.h>#include <freeradius-devel/util/test/acutest_helpers.h>#include <freeradius-devel/bio/bio_priv.h>#include <freeradius-devel/bio/null.h>#include <freeradius-devel/bio/retry.h>
Include dependency graph for bio_retry_tests.c:Go to the source code of this file.
Macros | |
| #define | _BIO_PRIVATE 1 |
Functions | |
| static int | cb_noop (fr_bio_t *bio) |
| static void | cb_noop_void (fr_bio_t *bio) |
| static int | cb_write_blocked (fr_bio_t *bio) |
| static int | cb_write_resume (fr_bio_t *bio) |
| static void | retry_release (UNUSED fr_bio_t *bio, UNUSED fr_bio_retry_entry_t *retry_ctx, UNUSED fr_bio_retry_release_reason_t reason) |
| static bool | retry_response (UNUSED fr_bio_t *bio, UNUSED fr_bio_retry_entry_t **item_p, UNUSED void *packet_ctx, UNUSED const void *buffer, UNUSED size_t size) |
| static void | retry_sent (UNUSED fr_bio_t *bio, UNUSED void *packet_ctx, UNUSED const void *buffer, UNUSED size_t size, fr_bio_retry_entry_t *retry_ctx) |
| static fr_bio_t * | stub_alloc (TALLOC_CTX *ctx) |
| static ssize_t | stub_write_all (UNUSED fr_bio_t *bio, UNUSED void *packet_ctx, void const *buffer, size_t size) |
| A transport which accepts every write in full, and never has anything to read. | |
| static ssize_t | stub_write_one (UNUSED fr_bio_t *bio, UNUSED void *packet_ctx, void const *buffer, UNUSED size_t size) |
| A transport which accepts one byte of each write, so the retry bio saves the rest of the packet. | |
| static void | test_all_used_resumes (void) |
| Running out of entries blocks writes, and freeing an entry resumes writes. | |
| static void | test_block_expires_overdue (void) |
| Blocking writes expires an overdue entry, and the expiry sees writes as blocked. | |
| static void | test_block_stops_retries (void) |
| When one retransmission blocks writes, the other retransmissions due in the same pass wait. | |
| static void | test_partial_oom_releases (void) |
| When the retry bio cannot save the rest of a partly written packet, the retry bio releases the entry of the packet. | |
| static void | test_partial_retransmit (void) |
| The retry bio saves the rest of a partly written retransmission once, and a flush sends the rest once. | |
| static void | test_resume_can_write (void) |
| The application may write from inside the resume callback, so fr_bio_retry_release() must put the freed entry on the free list before calling the resume callback. | |
| static fr_bio_t * | test_retry_alloc (TALLOC_CTX *ctx, fr_bio_retry_config_t *cfg) |
| static fr_bio_t * | test_retry_alloc_full (TALLOC_CTX *ctx, fr_bio_retry_config_t *cfg, fr_time_delta_t mrd, size_t max_saved) |
| Allocate a retry bio with one entry, in front of a stub. | |
| static fr_bio_t * | test_retry_alloc_mrd (TALLOC_CTX *ctx, fr_bio_retry_config_t *cfg, fr_time_delta_t mrd) |
Variables | |
| static int | blocked_count |
| static uint8_t | packet1 [4] = { 1, 2, 3, 4 } |
| static uint8_t | packet2 [4] = { 5, 6, 7, 8 } |
| static int | release_count |
| static int | resume_count |
| static fr_bio_t * | resume_write_bio |
| when set, cb_write_resume() writes packet2 to this bio | |
| static ssize_t | resume_write_rcode |
| static fr_bio_retry_entry_t * | saved_item |
| static size_t | stub_bytes |
| bytes of packet data which the stub has accepted | |
| static fr_bio_cb_funcs_t | test_cb |
| TEST_LIST | |
Tests for the retry bio running out of entries.
Definition in file bio_retry_tests.c.
| #define _BIO_PRIVATE 1 |
Definition at line 26 of file bio_retry_tests.c.
|
static |
Definition at line 42 of file bio_retry_tests.c.
|
static |
Definition at line 43 of file bio_retry_tests.c.
|
static |
Definition at line 44 of file bio_retry_tests.c.
|
static |
|
static |
|
static |
Definition at line 104 of file bio_retry_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
A transport which accepts every write in full, and never has anything to read.
Definition at line 86 of file bio_retry_tests.c.
Here is the caller graph for this function:
|
static |
A transport which accepts one byte of each write, so the retry bio saves the rest of the packet.
Definition at line 96 of file bio_retry_tests.c.
Here is the caller graph for this function:
|
static |
Running out of entries blocks writes, and freeing an entry resumes writes.
See finding 1 in retry.md. Only fr_bio_retry_write_resume() clears write_blocked, and fr_bio_retry_write_resume() runs only when the socket becomes writable. If running out of entries set write_blocked, then the application would never resume writes.
Definition at line 168 of file bio_retry_tests.c.
Here is the call graph for this function:
|
static |
Blocking writes expires an overdue entry, and the expiry sees writes as blocked.
See finding 1 in retry.md. Arming the expiry list runs any expiry which is already due, and fr_bio_retry_expiry_timer() asserts that writes are blocked. fr_bio_retry_write_blocked() used to set the flag only after arming the list.
Definition at line 322 of file bio_retry_tests.c.
Here is the call graph for this function:
|
static |
When one retransmission blocks writes, the other retransmissions due in the same pass wait.
See finding 1 in retry.md. fr_bio_retry_write_blocked() disarms the retry list, and the timer list used to keep running the other entries which were due in the same pass.
Definition at line 370 of file bio_retry_tests.c.
Here is the call graph for this function:
|
static |
When the retry bio cannot save the rest of a partly written packet, the retry bio releases the entry of the packet.
See 'A related defect: a failed save kept the entry' in retry.md. Without the release, the entry stays on both timer lists after the sent() callback has passed the entry to the application. The write returns OOM, so an application which then frees the packet leaves the retry bio holding a pointer to freed memory.
Definition at line 281 of file bio_retry_tests.c.
Here is the call graph for this function:
|
static |
The retry bio saves the rest of a partly written retransmission once, and a flush sends the rest once.
See finding 2 in retry.md. Before the fix, fr_bio_retry_rewrite() saved the rest of the packet, and then fr_bio_retry_write_item() saved the rest of the packet again.
Definition at line 237 of file bio_retry_tests.c.
Here is the call graph for this function:
|
static |
The application may write from inside the resume callback, so fr_bio_retry_release() must put the freed entry on the free list before calling the resume callback.
Definition at line 205 of file bio_retry_tests.c.
Here is the call graph for this function:
|
static |
Definition at line 157 of file bio_retry_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Allocate a retry bio with one entry, in front of a stub.
Only test_partial_retransmit() runs the timer list, so no timer fires in the other tests.
Definition at line 121 of file bio_retry_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 152 of file bio_retry_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 31 of file bio_retry_tests.c.
|
static |
Definition at line 39 of file bio_retry_tests.c.
|
static |
Definition at line 40 of file bio_retry_tests.c.
|
static |
Definition at line 33 of file bio_retry_tests.c.
|
static |
Definition at line 32 of file bio_retry_tests.c.
|
static |
when set, cb_write_resume() writes packet2 to this bio
Definition at line 36 of file bio_retry_tests.c.
|
static |
Definition at line 37 of file bio_retry_tests.c.
|
static |
Definition at line 34 of file bio_retry_tests.c.
|
static |
bytes of packet data which the stub has accepted
Definition at line 82 of file bio_retry_tests.c.
|
static |
Definition at line 56 of file bio_retry_tests.c.
| TEST_LIST |
Definition at line 401 of file bio_retry_tests.c.
1.9.8