The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
BIO patricia trie filtering handlers. More...
#include <freeradius-devel/util/value.h>
#include <freeradius-devel/util/trie.h>
#include <freeradius-devel/bio/bio_priv.h>
#include <freeradius-devel/bio/fd_priv.h>
#include <freeradius-devel/bio/network.h>
Go to the source code of this file.
Data Structures | |
struct | fr_bio_network_t |
The network filtering bio. More... | |
Functions | |
fr_bio_t * | fr_bio_network_alloc (TALLOC_CTX *ctx, fr_ipaddr_t const *allow, fr_ipaddr_t const *deny, fr_bio_read_t discard, fr_bio_t *next) |
Allocate a bio for filtering IP addresses. More... | |
static ssize_t | fr_bio_network_read (fr_bio_t *bio, void *packet_ctx, void *buffer, size_t size) |
Read a UDP packet, and only return packets from allowed sources. More... | |
fr_trie_t * | fr_bio_network_trie_alloc (TALLOC_CTX *ctx, int af, fr_ipaddr_t const *allow, fr_ipaddr_t const *deny) |
Create a patricia trie for doing network filtering. More... | |
BIO patricia trie filtering handlers.
Definition in file network.c.
struct fr_bio_network_t |
Data Fields | ||
---|---|---|
fr_bio_read_t | discard | callback to run when discarding a packet due to filtering |
FR_BIO_COMMON | ||
size_t | offset | where fr_bio_fd_packet_ctx_t is stored |
fr_trie_t const * | trie | patricia trie for filtering |
fr_bio_t* fr_bio_network_alloc | ( | TALLOC_CTX * | ctx, |
fr_ipaddr_t const * | allow, | ||
fr_ipaddr_t const * | deny, | ||
fr_bio_read_t | discard, | ||
fr_bio_t * | next | ||
) |
Allocate a bio for filtering IP addresses.
This is used for unconnected UDP bios, where we filter packets based on source IP address.
It is also used for accept bios, where we filter new connections based on source IP address. The caller should chain this bio to the next FD bio, and then fr_bio_read() from the top-level bio. The result will be filtered or "clean" FDs.
A patricia trie (but not the bio) could also be used in an haproxy "activate" callback, where the callback gets the haproxy socket info, and then checks if the source is allowed. However, that patricia trie is a property of the main "accept" bio, and should be managed by the activate() callback for the haproxy bio.
Definition at line 92 of file network.c.
fr_trie_t* fr_bio_network_trie_alloc | ( | TALLOC_CTX * | ctx, |
int | af, | ||
fr_ipaddr_t const * | allow, | ||
fr_ipaddr_t const * | deny | ||
) |