![]() |
The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
|
Tests for the datagram boundaries which the TLS dbuff bio records. More...
#include <freeradius-devel/util/test/acutest_common_init.h>#include <freeradius-devel/util/test/acutest_helpers.h>#include <freeradius-devel/tls/bio.h>
Include dependency graph for tls_bio_tests.c:Go to the source code of this file.
Functions | |
| static size_t | cap_test_len (size_t i) |
| Vary the datagram length, so that a mis-ordered queue is visible. | |
| static BIO * | datagram_bio_alloc (fr_tls_bio_dbuff_t **out) |
| Allocate a bio with datagram boundaries turned on. | |
| static BIO * | stream_bio_alloc (fr_tls_bio_dbuff_t **out) |
| Allocate a bio, without datagram boundaries. | |
| static void | test_clear_discards_boundaries (void) |
| Clearing the buffer discards the boundaries with the data. | |
| static void | test_enable_is_idempotent (void) |
| Enabling datagram mode twice is not an error. | |
| static void | test_flight_after_flight (void) |
| A flight which is fully drained is followed by another. | |
| static void | test_flight_keeps_its_boundaries (void) |
| Writes of different lengths come back in the order they were written. | |
| static void | test_one_write_one_datagram (void) |
| One write is one datagram. | |
| static void | test_over_send (void) |
| Sending more datagrams than were written is harmless. | |
| static void | test_partial_drain (void) |
| Draining part of a flight leaves the rest in order. | |
| static void | test_partial_write_records_nothing (void) |
| A datagram which does not fit records no boundary at all. | |
| static void | test_queue_cap (void) |
| The queue is capped, a write past the cap fails, and draining makes room. | |
| static void | test_stream_has_no_boundaries (void) |
| Without datagram mode the bio reports no boundaries at all. | |
| static void | tls_bio_test_init (void) |
| Build the BIO_METHOD which fr_tls_bio_dbuff_alloc() clones. | |
Variables | |
| TEST_LIST | |
Tests for the datagram boundaries which the TLS dbuff bio records.
The bio is the boundary between OpenSSL and the application. OpenSSL calls BIO_write() once per datagram, and a datagram transport has to send each of those as its own datagram. These tests write to the bio directly, so they need no socket, no session, and no handshake.
Definition in file tls_bio_tests.c.
Vary the datagram length, so that a mis-ordered queue is visible.
A test which writes the same length every time cannot tell a correctly ordered queue from a shuffled one. The period is 7 and the test below drains 3, so a queue which is off by 3 reads differently at every entry. A period which divides the drain hides exactly the bug this is here to find.
Definition at line 256 of file tls_bio_tests.c.
Here is the caller graph for this function:
|
static |
Allocate a bio with datagram boundaries turned on.
Definition at line 60 of file tls_bio_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Allocate a bio, without datagram boundaries.
Definition at line 51 of file tls_bio_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Clearing the buffer discards the boundaries with the data.
Definition at line 367 of file tls_bio_tests.c.
Here is the call graph for this function:
|
static |
Enabling datagram mode twice is not an error.
Definition at line 388 of file tls_bio_tests.c.
Here is the call graph for this function:
|
static |
A flight which is fully drained is followed by another.
This is what actually happens on a connection: OpenSSL writes a flight, the application sends all of it, and the next flight arrives later. The queue has to be reusable rather than fill up once.
Definition at line 156 of file tls_bio_tests.c.
Here is the call graph for this function:
|
static |
Writes of different lengths come back in the order they were written.
This is the case the whole change exists for: OpenSSL writes a flight as several datagrams of unequal length, and joining them back together would produce one datagram larger than the MTU OpenSSL was given.
Definition at line 123 of file tls_bio_tests.c.
Here is the call graph for this function:
|
static |
One write is one datagram.
Definition at line 98 of file tls_bio_tests.c.
Here is the call graph for this function:
|
static |
Sending more datagrams than were written is harmless.
Definition at line 229 of file tls_bio_tests.c.
Here is the call graph for this function:
|
static |
Draining part of a flight leaves the rest in order.
Definition at line 195 of file tls_bio_tests.c.
Here is the call graph for this function:
|
static |
A datagram which does not fit records no boundary at all.
The buffer here cannot extend, so a write larger than the room left copies part of the data. Half a datagram is not a datagram, so the write has to fail rather than queue a length with nothing behind it.
Definition at line 326 of file tls_bio_tests.c.
Here is the call graph for this function:
|
static |
The queue is capped, a write past the cap fails, and draining makes room.
Filling the queue and then draining part of it is what makes the entries wrap, so this is also the test which covers moving them back down.
Definition at line 266 of file tls_bio_tests.c.
Here is the call graph for this function:
|
static |
Without datagram mode the bio reports no boundaries at all.
Definition at line 75 of file tls_bio_tests.c.
Here is the call graph for this function:
|
static |
Build the BIO_METHOD which fr_tls_bio_dbuff_alloc() clones.
The server calls this from fr_tls_init(). These tests do not start a server, so they call it themselves. acutest runs each test in its own process, so the flag is per test rather than per run.
Definition at line 39 of file tls_bio_tests.c.
Here is the caller graph for this function:| TEST_LIST |
Definition at line 407 of file tls_bio_tests.c.
1.9.8