![]() |
The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
|
Tests for the dedup bio expiring entries after a reply. 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/util/rb.h>#include <freeradius-devel/bio/dedup.h>
Include dependency graph for bio_dedup_tests.c:Go to the source code of this file.
Macros | |
| #define | _BIO_PRIVATE 1 |
Functions | |
| static fr_bio_dedup_entry_t * | dedup_get_item (UNUSED fr_bio_t *bio, UNUSED void *pctx) |
| static bool | dedup_receive (UNUSED fr_bio_t *bio, fr_bio_dedup_entry_t *dedup_ctx, UNUSED void *pctx) |
| static void | dedup_release (UNUSED fr_bio_t *bio, UNUSED fr_bio_dedup_entry_t *dedup_ctx, fr_bio_dedup_release_reason_t reason) |
| static fr_bio_t * | stub_alloc (TALLOC_CTX *ctx) |
| static ssize_t | stub_read (UNUSED fr_bio_t *bio, UNUSED void *pctx, void *buffer, size_t size) |
| The stub transport returns a copy of request on every read, and reports every write as complete. | |
| static ssize_t | stub_write_all (UNUSED fr_bio_t *bio, UNUSED void *pctx, void const *buffer, size_t size) |
| static ssize_t | stub_write_block (UNUSED fr_bio_t *bio, UNUSED void *pctx, UNUSED void const *buffer, UNUSED size_t size) |
| A stub transport write function which always returns IO_WOULD_BLOCK. | |
| static ssize_t | stub_write_one (UNUSED fr_bio_t *bio, UNUSED void *pctx, void const *buffer, UNUSED size_t size) |
| A stub transport write function which accepts one byte of each write. | |
| static fr_bio_t * | test_dedup_alloc (TALLOC_CTX *ctx, fr_bio_dedup_config_t *cfg) |
| Allocate a dedup bio with two entries and a one-second lifetime, in front of the stub transport. | |
| static void | test_entries_are_reused (void) |
| The expiry timer returns each expired entry to the free list, so the dedup bio reads more requests than the dedup bio has entries. | |
| static void | test_equal_expiry (void) |
| Two entries with the same expiry time both expire. | |
| static bool | test_pending_reply (fr_bio_t *dedup, fr_bio_t *stub, uint8_t *buffer, size_t size) |
| Read a request, and respond while the stub transport is blocked, so that the reply goes on the pending list. | |
| static bool | test_read_request (fr_bio_t *dedup, uint8_t *buffer, size_t size) |
| Read one request through the dedup bio, and attach reply to the dedup entry of the request. | |
| static void | test_respond_expires (void) |
| The dedup entry for a reply sent with fr_bio_dedup_respond() expires once the lifetime is over. | |
| static void | test_resume_partial (void) |
| When the stub transport writes only part of a pending reply, the next resume writes the rest. | |
| static void | test_resume_sends_pending (void) |
| write_resume sends a pending reply, and the dedup entry then expires once the lifetime is over. | |
| static void | test_resume_still_blocked (void) |
| write_resume keeps the pending reply when the stub transport is still blocked. | |
| static void | test_run_timers (fr_bio_dedup_config_t *cfg) |
| Run every timer which is due within the next five seconds. | |
| static void | test_write_expires (void) |
| The dedup entry for a reply sent with fr_bio_write() expires once the lifetime is over. | |
| static int | test_write_resume (fr_bio_t *dedup) |
| Call the dedup bio's write_resume callback, as fr_bio_packet_write_resume() does. | |
Variables | |
| static int | expired_count |
| static int | packet_ctx |
| the tests pass only the address of packet_ctx | |
| static uint8_t | reply [4] = { 5, 6, 7, 8 } |
| static uint8_t | request [4] = { 1, 2, 3, 4 } |
| static fr_bio_dedup_entry_t * | saved_item |
| static size_t | stub_bytes |
| bytes of reply data which the stub transport has accepted | |
| TEST_LIST | |
Tests for the dedup bio expiring entries after a reply.
Definition in file bio_dedup_tests.c.
| #define _BIO_PRIVATE 1 |
Definition at line 27 of file bio_dedup_tests.c.
|
static |
|
static |
|
static |
|
static |
Definition at line 93 of file bio_dedup_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
The stub transport returns a copy of request on every read, and reports every write as complete.
Definition at line 58 of file bio_dedup_tests.c.
Here is the caller graph for this function:
|
static |
A stub transport write function which always returns IO_WOULD_BLOCK.
Definition at line 78 of file bio_dedup_tests.c.
Here is the caller graph for this function:
|
static |
A stub transport write function which accepts one byte of each write.
Definition at line 85 of file bio_dedup_tests.c.
Here is the caller graph for this function:
|
static |
Allocate a dedup bio with two entries and a one-second lifetime, in front of the stub transport.
Definition at line 108 of file bio_dedup_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
The expiry timer returns each expired entry to the free list, so the dedup bio reads more requests than the dedup bio has entries.
The UDP bio of the RADIUS server has 256 entries. Without the fix for dedup.md finding 1, the UDP bio returned fr_bio_error(OOM) for every request after 256 replies.
Definition at line 214 of file bio_dedup_tests.c.
Here is the call graph for this function:
|
static |
Two entries with the same expiry time both expire.
See finding 1 in dedup.md. The expiry tree compared only the expiry time, so the tree treated the second entry as a duplicate, and never inserted the second entry.
Definition at line 246 of file bio_dedup_tests.c.
Here is the call graph for this function:
|
static |
Read a request, and respond while the stub transport is blocked, so that the reply goes on the pending list.
Definition at line 296 of file bio_dedup_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:Read one request through the dedup bio, and attach reply to the dedup entry of the request.
Definition at line 129 of file bio_dedup_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
The dedup entry for a reply sent with fr_bio_dedup_respond() expires once the lifetime is over.
Regression test for dedup.md finding 1. fr_bio_dedup_respond() and fr_bio_dedup_write() did not arm the expiry timer, so no entry expired.
Definition at line 156 of file bio_dedup_tests.c.
Here is the call graph for this function:
|
static |
When the stub transport writes only part of a pending reply, the next resume writes the rest.
Definition at line 365 of file bio_dedup_tests.c.
Here is the call graph for this function:
|
static |
write_resume sends a pending reply, and the dedup entry then expires once the lifetime is over.
Definition at line 306 of file bio_dedup_tests.c.
Here is the call graph for this function:
|
static |
write_resume keeps the pending reply when the stub transport is still blocked.
Definition at line 337 of file bio_dedup_tests.c.
Here is the call graph for this function:
|
static |
Run every timer which is due within the next five seconds.
Definition at line 144 of file bio_dedup_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
The dedup entry for a reply sent with fr_bio_write() expires once the lifetime is over.
Definition at line 183 of file bio_dedup_tests.c.
Here is the call graph for this function:
|
static |
Call the dedup bio's write_resume callback, as fr_bio_packet_write_resume() does.
Definition at line 284 of file bio_dedup_tests.c.
Here is the caller graph for this function:
|
static |
Definition at line 32 of file bio_dedup_tests.c.
|
static |
the tests pass only the address of packet_ctx
Definition at line 37 of file bio_dedup_tests.c.
|
static |
Definition at line 36 of file bio_dedup_tests.c.
|
static |
Definition at line 35 of file bio_dedup_tests.c.
|
static |
Definition at line 33 of file bio_dedup_tests.c.
|
static |
bytes of reply data which the stub transport has accepted
Definition at line 66 of file bio_dedup_tests.c.
| TEST_LIST |
Definition at line 393 of file bio_dedup_tests.c.
1.9.8