The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
rlm_redis_ippool.c File Reference

IP Allocation module with a redis backend. More...

#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/server/modpriv.h>
#include <freeradius-devel/unlang/xlat_func.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/base16.h>
#include <freeradius-devel/util/token.h>
#include <freeradius-devel/redis/base.h>
#include <freeradius-devel/redis/cluster_async.h>
#include "redis_ippool.h"
+ Include dependency graph for rlm_redis_ippool.c:

Go to the source code of this file.

Data Structures

struct  redis_ippool_alloc_call_env_t
 Call environment used when calling redis_ippool allocate method. More...
 
struct  redis_ippool_alloc_rctx_t
 Resume context for async calls to alloc script. More...
 
struct  redis_ippool_bulk_release_call_env_t
 Call environment used when calling redis_ippool bulk release method. More...
 
struct  redis_ippool_info_rctx_t
 Resume context for methods which retrieve info and produce pairs. More...
 
struct  redis_ippool_load_rctx_t
 Resume context for loading scripts in response to NOSCRIPT reply. More...
 
struct  redis_ippool_release_call_env_t
 Call environment used when calling redis_ippool release method. More...
 
struct  redis_ippool_release_rctx_t
 Resume context for async calls to update script. More...
 
struct  redis_ippool_show_call_env_t
 Call environment used when calling redis_ippool show method. More...
 
struct  redis_ippool_stats_call_env_t
 Call environment used when calling redis_ippool stats method. More...
 
struct  redis_ippool_tool_rctx_t
 Resume context for IP pool updating xlats. More...
 
struct  redis_ippool_update_call_env_t
 Call environment used when calling redis_ippool update method. More...
 
struct  redis_ippool_update_rctx_t
 Resume context for async calls to update script. More...
 
struct  redis_pools_list_rctx_t
 Resume context for pool list module method. More...
 
struct  redis_wait_rctx_t
 Resume context for validating WAIT replies. More...
 
struct  rlm_redis_ippool_t
 rlm_redis module instance More...
 
struct  rlm_redis_ippool_thread_t
 

Macros

#define ADD_REDIS_COMMAND(_fmt, ...)
 
#define CHECK_POOL_NAME
 
#define EOL   "\n"
 
#define POPULATE_PAIR(_da, _i, _parent)
 
#define REDIS_IPPOOL_SCRIPT_LOAD(_cmds, _script, _script_len, _ret)
 

Functions

static int _redis_ippool_alloc_ctx_free (redis_ippool_alloc_rctx_t *rctx)
 
static int _redis_ippool_info_rctx_free (redis_ippool_info_rctx_t *rctx)
 
static int _redis_ippool_release_rctx_free (redis_ippool_release_rctx_t *rctx)
 
static int _redis_ippool_tool_rctx_free (redis_ippool_tool_rctx_t *rctx)
 
static int _redis_ippool_update_rctx_free (redis_ippool_update_rctx_t *rctx)
 
static int _redis_pools_list_rctx_free (redis_pools_list_rctx_t *rctx)
 
static void ipaddr_inc (fr_ipaddr_t *addr, size_t inc)
 Increment an IP address by a given number of addresses.
 
static void ippool_action_print (request_t *request, ippool_action_t action, fr_log_lvl_t lvl, fr_value_box_t const *key_prefix, fr_value_box_t const *ip, fr_value_box_t const *owner, fr_value_box_t const *gateway_id, uint32_t expires)
 
static unlang_action_t ippool_script_enqueue (TALLOC_CTX *ctx, fr_redis_command_set_t **out_cmds, fr_redis_async_cmd_t **out_cmd, request_t *request, rlm_redis_ippool_thread_t *thread, uint8_t const *key, size_t key_len, char const *cmd, int cmd_len, fr_redis_command_complete_t complete, module_method_t resume, unlang_module_signal_t cancel, void *rctx, redis_wait_rctx_t *wait_rctx)
 Enqueue a script to run against a redis cluster.
 
static void ippool_wait_check (request_t *request, UNUSED fr_redis_command_t *cmd, redisReply *reply, void *rctx)
 Check the requisite number of slaves replicated the lease info.
 
static void lua_script_load (fr_redis_trunk_t *rtrunk, UNUSED void *uctx)
 
static void lua_script_load_results (request_t *request, UNUSED fr_redis_command_t *cmd, redisReply *reply, UNUSED void *rctx)
 
static unlang_action_t mod_alloc (unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static void mod_alloc_cancel (module_ctx_t const *mctx, request_t *request, UNUSED fr_signal_t action)
 
static unlang_action_t mod_alloc_resume (unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static int mod_bootstrap (module_inst_ctx_t const *mctx)
 
static unlang_action_t mod_bulk_release (unlang_result_t *p_result, UNUSED module_ctx_t const *mctx, request_t *request)
 
static int mod_coord_attach (module_thread_inst_ctx_t const *mctx)
 
static int mod_detach (module_detach_ctx_t const *mctx)
 
static void mod_info_cancel (module_ctx_t const *mctx, request_t *request, UNUSED fr_signal_t action)
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 
static int mod_load (void)
 
static void mod_pools_list_result (request_t *request, UNUSED fr_redis_command_t *cmd, redisReply *reply, void *rctx)
 Parse the results from Redis SCAN command used to list pools.
 
static unlang_action_t mod_release (unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static void mod_release_cancel (module_ctx_t const *mctx, request_t *request, UNUSED fr_signal_t action)
 
static unlang_action_t mod_release_resume (unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static unlang_action_t mod_show (unlang_result_t *p_result, UNUSED module_ctx_t const *mctx, request_t *request)
 
static void mod_show_result (request_t *request, UNUSED fr_redis_command_t *cmd, redisReply *reply, void *rctx)
 
static unlang_action_t mod_show_resume (unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static unlang_action_t mod_stats (unlang_result_t *p_result, UNUSED module_ctx_t const *mctx, request_t *request)
 
static void mod_stats_result (request_t *request, UNUSED fr_redis_command_t *cmd, redisReply *reply, void *rctx)
 
static int mod_thread_detach (module_thread_inst_ctx_t const *mctx)
 
static int mod_thread_instantiate (module_thread_inst_ctx_t const *mctx)
 
static unlang_action_t mod_update (unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static void mod_update_cancel (module_ctx_t const *mctx, request_t *request, UNUSED fr_signal_t action)
 
static unlang_action_t mod_update_resume (unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
 
 REDIS_ASYNC_COORD_CALLBACKS (rlm_redis_ippool_thread_t)
 
static xlat_action_t redis_ippool_add_common (request_t *request, rlm_redis_ippool_t *inst, rlm_redis_ippool_thread_t *t, fr_value_box_t *pool, fr_value_box_t *start, fr_value_box_t *end, fr_value_box_t *range, uint8_t prefix, size_t num_addr, size_t step)
 Common code for adding addresses to a pool.
 
static xlat_action_t redis_ippool_addresses_add_xlat (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static int redis_ippool_addresses_arg_parse (request_t *request, uint8_t *prefix_out, size_t *step, size_t *num_addr, fr_value_box_t *start, fr_value_box_t *end, fr_value_box_t *prefix_in)
 Parse argments provided to IP pool manipulation xlats which work on start and end addresses.
 
static xlat_action_t redis_ippool_addresses_modify_xlat (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static xlat_action_t redis_ippool_addresses_release_xlat (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static xlat_action_t redis_ippool_addresses_remove_xlat (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static void redis_ippool_allocate_results (request_t *request, UNUSED fr_redis_command_t *cmd, redisReply *reply, void *rctx)
 Callback to process results from allocation script.
 
static xlat_action_t redis_ippool_assign_xlat (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static void redis_ippool_common_cancel (xlat_ctx_t const *xctx, request_t *request, UNUSED fr_signal_t action)
 Common cancellation function for xlats using redi_ippool_tool_rctx_t.
 
static xlat_action_t redis_ippool_common_resume (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *in)
 Common resume function for pool manipulation xlats.
 
static void redis_ippool_list_cancel (xlat_ctx_t const *xctx, request_t *request, UNUSED fr_signal_t action)
 
static xlat_action_t redis_ippool_list_next_scan (request_t *request, rlm_redis_ippool_thread_t *thread, redis_pools_list_rctx_t *rctx)
 Enqueue the next SCAN command.
 
static xlat_action_t redis_ippool_list_resume (UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *in)
 
static xlat_action_t redis_ippool_list_start (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, UNUSED fr_value_box_list_t *in)
 
static xlat_action_t redis_ippool_list_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static void redis_ippool_load_cancel (module_ctx_t const *mctx, request_t *request, UNUSED fr_signal_t action)
 
static unlang_action_t redis_ippool_load_resume (unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static xlat_action_t redis_ippool_modify_common (request_t *request, rlm_redis_ippool_t *inst, rlm_redis_ippool_thread_t *t, fr_value_box_t *pool, fr_value_box_t *start, fr_value_box_t *end, fr_value_box_t *range, uint8_t prefix, size_t num_addr, size_t step)
 Common code for modifying the range assigned to addresses.
 
static unlang_action_t redis_ippool_rcode_check (request_t *request, fr_redis_command_set_t *cmds, fr_redis_async_cmd_t *cmd, module_ctx_t const *mctx, module_method_t resume, unlang_module_signal_t cancel, char const *script, size_t script_len)
 Check the return code from an async redis command.
 
static xlat_action_t redis_ippool_release_common (request_t *request, rlm_redis_ippool_t *inst, rlm_redis_ippool_thread_t *t, fr_value_box_t *pool, fr_value_box_t *start, fr_value_box_t *end, uint8_t prefix, size_t num_addr, size_t step)
 Common code for releasing address assignments.
 
static void redis_ippool_release_results (request_t *request, UNUSED fr_redis_command_t *cmd, redisReply *reply, void *rctx)
 Callback to process results from release script.
 
static xlat_action_t redis_ippool_remove_common (request_t *request, rlm_redis_ippool_t *inst, rlm_redis_ippool_thread_t *t, fr_value_box_t *pool, fr_value_box_t *start, fr_value_box_t *end, uint8_t prefix, size_t num_addr, size_t step)
 Common code for removing addresses from a pool.
 
static xlat_action_t redis_ippool_subnet_add_xlat (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static int redis_ippool_subnet_arg_parse (request_t *request, fr_value_box_t *start, fr_value_box_t *end, uint8_t *prefix_out, size_t *step, size_t *num_addr, fr_value_box_t *subnet, fr_value_box_t *prefix_in)
 Parse argments provided to IP pool manipulation xlats which work on subnets.
 
static xlat_action_t redis_ippool_subnet_modify_xlat (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static xlat_action_t redis_ippool_subnet_release_xlat (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static xlat_action_t redis_ippool_subnet_remove_xlat (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static xlat_action_t redis_ippool_unassign_xlat (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static void redis_ippool_update_results (request_t *request, UNUSED fr_redis_command_t *cmd, redisReply *reply, void *rctx)
 Callback to process results from allocation script.
 
static void redis_xlat_array_results (request_t *request, UNUSED fr_redis_command_t *cmd, redisReply *reply, void *rctx)
 Callback to be used when Redis commands are expected to return an array.
 
static void redis_xlat_common_results (request_t *request, UNUSED fr_redis_command_t *cmd, redisReply *reply, void *rctx)
 Callback to be used when Redis commands are expected to return a single integer.
 
static uint32_t uint32_gen_mask (uint8_t bits)
 

Variables

static fr_dict_attr_t const * attr_ippool_lease
 
static fr_dict_attr_t const * attr_ippool_lease_active
 
static fr_dict_attr_t const * attr_ippool_lease_address
 
static fr_dict_attr_t const * attr_ippool_lease_device
 
static fr_dict_attr_t const * attr_ippool_lease_expires
 
static fr_dict_attr_t const * attr_ippool_lease_gateway
 
static fr_dict_attr_t const * attr_ippool_lease_range
 
static fr_dict_attr_t const * attr_ippool_name
 
static fr_dict_attr_t const * attr_ippool_stats
 
static fr_dict_attr_t const * attr_ippool_stats_dynamic
 
static fr_dict_attr_t const * attr_ippool_stats_dynamic_expire1d
 
static fr_dict_attr_t const * attr_ippool_stats_dynamic_expire1h
 
static fr_dict_attr_t const * attr_ippool_stats_dynamic_expire1m
 
static fr_dict_attr_t const * attr_ippool_stats_dynamic_expire30m
 
static fr_dict_attr_t const * attr_ippool_stats_dynamic_free
 
static fr_dict_attr_t const * attr_ippool_stats_dynamic_total
 
static fr_dict_attr_t const * attr_ippool_stats_static
 
static fr_dict_attr_t const * attr_ippool_stats_static_free
 
static fr_dict_attr_t const * attr_ippool_stats_static_renew1d
 
static fr_dict_attr_t const * attr_ippool_stats_static_renew1h
 
static fr_dict_attr_t const * attr_ippool_stats_static_renew1m
 
static fr_dict_attr_t const * attr_ippool_stats_static_renew30m
 
static fr_dict_attr_t const * attr_ippool_stats_static_total
 
static fr_dict_attr_t const * attr_ippool_stats_total
 
static fr_dict_t const * dict_freeradius
 
static fr_dict_t const * dict_redis
 
static char lua_alloc_cmd []
 Lua script for allocating new leases.
 
static char lua_alloc_digest [(SHA1_DIGEST_LENGTH *2)+1]
 
static char lua_assign_cmd []
 Lua script for assigning a static lease.
 
static char lua_release_cmd []
 Lua script for releasing leases.
 
static char lua_release_digest [(SHA1_DIGEST_LENGTH *2)+1]
 
static char lua_release_xlat_cmd []
 Lua script for releasing a lease.
 
static char lua_remove_cmd []
 Lua script for removing a lease.
 
static char lua_unassign_cmd []
 Lua script for un-assigning a static lease.
 
static char lua_update_cmd []
 Lua script for updating leases.
 
static char lua_update_digest [(SHA1_DIGEST_LENGTH *2)+1]
 
static conf_parser_t module_config []
 
static conf_parser_t redis_config []
 
static xlat_arg_parser_t const redis_ippool_addresses_add_args []
 
static xlat_arg_parser_t const redis_ippool_addresses_modify_args []
 
static xlat_arg_parser_t const redis_ippool_addresses_release_args []
 
static xlat_arg_parser_t const redis_ippool_addresses_remove_args []
 
static const call_env_method_t redis_ippool_alloc_method_env
 
static xlat_arg_parser_t const redis_ippool_assign_args []
 
static const call_env_method_t redis_ippool_bulk_release_method_env
 
static const call_env_method_t redis_ippool_release_method_env
 
static const call_env_method_t redis_ippool_show_method_env
 
static const call_env_method_t redis_ippool_stats_method_env
 
static xlat_arg_parser_t const redis_ippool_subnet_add_args []
 
static xlat_arg_parser_t const redis_ippool_subnet_modify_args []
 
static xlat_arg_parser_t const redis_ippool_subnet_release_args []
 
static xlat_arg_parser_t const redis_ippool_subnet_remove_args []
 
static xlat_arg_parser_t const redis_ippool_unassign_args []
 
static const call_env_method_t redis_ippool_update_method_env
 
module_rlm_t rlm_redis_ippool
 
fr_dict_autoload_t rlm_redis_ippool_dict []
 
fr_dict_attr_autoload_t rlm_redis_ippool_dict_attr []
 

Detailed Description

IP Allocation module with a redis backend.

Id
fe09d366ede2ac29afa925986e19b050a548add7
Author
Arran Cudbard-Bell

Performs lease management using a Redis backed.

Creates three types of objects:

Definition in file rlm_redis_ippool.c.


Data Structure Documentation

◆ redis_ippool_alloc_call_env_t

struct redis_ippool_alloc_call_env_t

Call environment used when calling redis_ippool allocate method.

Definition at line 184 of file rlm_redis_ippool.c.

+ Collaboration diagram for redis_ippool_alloc_call_env_t:
Data Fields
tmpl_t * allocated_address_attr Attribute to populate with allocated IP.
fr_value_box_t association_time How log should a device be associated with an IP address.

This allows for "sticky" addressing, where the device -> IP association lasts longer than the lease time.

tmpl_t * expiry_attr Time at which the lease will expire.
fr_value_box_t gateway_id Gateway identifier, usually NAS-Identifier or Option 82 gateway.

Used for bulk lease cleanups.

fr_value_box_t lease_time How long an IP address should be allocated for.
fr_value_box_t offer_time How long we should reserve a lease for during the pre-allocation stage (typically responding to DHCP discover).
fr_value_box_t owner Unique lease owner identifier.

Could be mac-address or a combination of User-Name and something unique to the device.

fr_value_box_t pool_name Name of the pool we're allocating IP addresses from.
tmpl_t * range_attr Attribute to write the range ID to.
fr_value_box_t requested_address The address the client is requesting.

◆ redis_ippool_alloc_rctx_t

struct redis_ippool_alloc_rctx_t

Resume context for async calls to alloc script.

Definition at line 235 of file rlm_redis_ippool.c.

+ Collaboration diagram for redis_ippool_alloc_rctx_t:
Data Fields
fr_redis_async_cmd_t * cmd Redis async command.
char * cmd_str Formatted redis command.
fr_redis_command_set_t * cmds Command set to be run.
redis_ippool_alloc_call_env_t * env Callenv for the current allocation.
ippool_rcode_t ret Return code for the allocation result.
redis_wait_rctx_t wait_rctx WAIT resume context.

◆ redis_ippool_bulk_release_call_env_t

struct redis_ippool_bulk_release_call_env_t

Call environment used when calling redis_ippool bulk release method.

Definition at line 366 of file rlm_redis_ippool.c.

+ Collaboration diagram for redis_ippool_bulk_release_call_env_t:
Data Fields
fr_value_box_t gateway_id Gateway identifier, usually NAS-Identifier or Option 82 gateway.

Used for bulk lease cleanups.

fr_value_box_t pool_name Name of the pool we're allocating IP addresses from.

◆ redis_ippool_info_rctx_t

struct redis_ippool_info_rctx_t

Resume context for methods which retrieve info and produce pairs.

Definition at line 312 of file rlm_redis_ippool.c.

+ Collaboration diagram for redis_ippool_info_rctx_t:
Data Fields
fr_redis_async_cmd_t * cmd Redis async command.
char ** cmd_str Formatted redis commands.
fr_redis_command_set_t * cmds Command set to run.
fr_value_box_t ** lookup Value boxes holding lookup keys.
size_t lookup_no Incremented on processing each reply.
fr_pair_list_t results Temporary list to hold results.

◆ redis_ippool_load_rctx_t

struct redis_ippool_load_rctx_t

Resume context for loading scripts in response to NOSCRIPT reply.

Definition at line 223 of file rlm_redis_ippool.c.

+ Collaboration diagram for redis_ippool_load_rctx_t:
Data Fields
unlang_module_signal_t cancel Cancel function for EVAL command.
fr_redis_async_cmd_t * cmd Async command for loading script.
fr_redis_command_set_t * cmds Command set for loading script.
fr_redis_async_cmd_t * eval_cmd Original EVAL async command which returned NOSCRIPT.
void * eval_rctx Resume context for original EVAL command.
module_method_t resume Resume function for EVAL command.

◆ redis_ippool_release_call_env_t

struct redis_ippool_release_call_env_t

Call environment used when calling redis_ippool release method.

Definition at line 285 of file rlm_redis_ippool.c.

+ Collaboration diagram for redis_ippool_release_call_env_t:
Data Fields
fr_value_box_t association_time How long should a device be associated with an IP address.
fr_value_box_t gateway_id Gateway identifier, usually NAS-Identifier or Option 82 gateway.

Used for bulk lease cleanups.

fr_value_box_t owner Unique lease owner identifier.

Could be mac-address or a combination of User-Name and something unique to the device.

fr_value_box_t pool_name Name of the pool we're releasing the IP addresses to.
fr_value_box_t requested_address Address being released.

◆ redis_ippool_release_rctx_t

struct redis_ippool_release_rctx_t

Resume context for async calls to update script.

Definition at line 330 of file rlm_redis_ippool.c.

+ Collaboration diagram for redis_ippool_release_rctx_t:
Data Fields
fr_redis_async_cmd_t * cmd Redis async command.
char * cmd_str Formatted redis command.
fr_redis_command_set_t * cmds Command set to be run.
redis_ippool_release_call_env_t * env Callenv for the current allocation.
ippool_rcode_t ret Return code for the allocation result.
redis_wait_rctx_t wait_rctx WAIT resume context.

◆ redis_ippool_show_call_env_t

struct redis_ippool_show_call_env_t

Call environment used when calling redis_ippool show method.

Definition at line 304 of file rlm_redis_ippool.c.

+ Collaboration diagram for redis_ippool_show_call_env_t:
Data Fields
fr_value_box_t pool_name Name of the pool we're looking up the address in.
fr_value_box_list_t requested_address Address(es) to fetch details of.

◆ redis_ippool_stats_call_env_t

struct redis_ippool_stats_call_env_t

Call environment used when calling redis_ippool stats method.

Definition at line 323 of file rlm_redis_ippool.c.

+ Collaboration diagram for redis_ippool_stats_call_env_t:
Data Fields
fr_value_box_t pool_name Name of the pool we're getting stats for.

◆ redis_ippool_tool_rctx_t

struct redis_ippool_tool_rctx_t

Resume context for IP pool updating xlats.

Definition at line 342 of file rlm_redis_ippool.c.

+ Collaboration diagram for redis_ippool_tool_rctx_t:
Data Fields
uint32_t changes Number of changes reported by redis.
fr_redis_async_cmd_t * cmd Redis async command.
char ** cmd_str Formatted redis commands for this xlat.
fr_redis_command_set_t * cmds Redis command set to run.

◆ redis_ippool_update_call_env_t

struct redis_ippool_update_call_env_t

Call environment used when calling redis_ippool update method.

Definition at line 247 of file rlm_redis_ippool.c.

+ Collaboration diagram for redis_ippool_update_call_env_t:
Data Fields
tmpl_t * allocated_address_attr Attribute to populate with allocated IP.
fr_value_box_t association_time How long should a device be associated with an IP address.
tmpl_t * expiry_attr Time at which the lease will expire.
fr_value_box_t gateway_id Gateway identifier, usually NAS-Identifier or Option 82 gateway.

Used for bulk lease cleanups.

fr_value_box_t lease_time How long an IP address should be allocated for.
fr_value_box_t owner Unique lease owner identifier.

Could be mac-address or a combination of User-Name and something unique to the device.

fr_value_box_t pool_name Name of the pool we're allocating IP addresses from.
tmpl_t * range_attr Attribute to write the range ID to.
fr_value_box_t requested_address Address being updated.

◆ redis_ippool_update_rctx_t

struct redis_ippool_update_rctx_t

Resume context for async calls to update script.

Definition at line 273 of file rlm_redis_ippool.c.

+ Collaboration diagram for redis_ippool_update_rctx_t:
Data Fields
fr_redis_async_cmd_t * cmd Redis async command.
char * cmd_str Formatted redis command.
fr_redis_command_set_t * cmds Command set to be run.
redis_ippool_update_call_env_t * env Callenv for the current allocation.
ippool_rcode_t ret Return code for the allocation result.
redis_wait_rctx_t wait_rctx WAIT resume context.

◆ redis_pools_list_rctx_t

struct redis_pools_list_rctx_t

Resume context for pool list module method.

Definition at line 351 of file rlm_redis_ippool.c.

+ Collaboration diagram for redis_pools_list_rctx_t:
Data Fields
fr_redis_async_cmd_t * cmd Redis async command.
char * cmd_str Current preformatted Redis command.
fr_redis_command_set_t * cmds Command set to be run.
TALLOC_CTX * ctx Context to allocate pool names in.
uint8_t current_node Node number currently being queried.
char cursor[19] Cursor value returned in last result.
uint8_t node_count How many nodes are in nodes.
fr_redis_io_conf_t * nodes List of nodes to query.
fr_value_box_list_t pools Temporary list to store pool names.

◆ redis_wait_rctx_t

struct redis_wait_rctx_t

Resume context for validating WAIT replies.

Definition at line 216 of file rlm_redis_ippool.c.

Data Fields
bool fail
int wait_num

◆ rlm_redis_ippool_t

struct rlm_redis_ippool_t

rlm_redis module instance

Definition at line 125 of file rlm_redis_ippool.c.

+ Collaboration diagram for rlm_redis_ippool_t:
Data Fields
fr_redis_conf_t conf Connection parameters for the Redis server.

Must be first field in this struct.

fr_coord_pair_reg_t * coord_pair_reg Coord pair registration.
fr_coord_reg_t * coord_reg Coordinator registration.
bool copy_on_update Copy the address provided by ip_address to the allocated_address_attr if updates are successful.
bool ipv4_integer Whether IPv4 addresses should be cast to integers, for renew operations.
char const * name Instance name.
CONF_SECTION * tls_conf TLS CONF_SECTION.
char * wait_cmd Preformatted redis "WAIT" command.
int wait_cmd_len Length of wait_cmd.
uint32_t wait_num How many slaves we want to acknowledge allocations or updates.
fr_time_delta_t wait_timeout How long we wait for slaves to acknowledge writing.

◆ rlm_redis_ippool_thread_t

struct rlm_redis_ippool_thread_t

Definition at line 151 of file rlm_redis_ippool.c.

+ Collaboration diagram for rlm_redis_ippool_thread_t:
Data Fields
fr_coord_worker_t * cw Coord-worker for fetching cluster map.
rlm_redis_ippool_t * inst Module instance.
fr_redis_ct_t * rtcluster Per thread Redis cluster.

Macro Definition Documentation

◆ ADD_REDIS_COMMAND

#define ADD_REDIS_COMMAND (   _fmt,
  ... 
)
Value:
cmd_len = redisFormatCommand(&rctx->cmd_str[cmd_no], _fmt, __VA_ARGS__); \
if (cmd_len < 0) RETURN_UNLANG_FAIL; \
if (fr_redis_command_preformatted_add(cmds, rctx->cmd_str[cmd_no++], cmd_len, NULL, NULL) != FR_REDIS_PIPELINE_OK) goto error
fr_redis_pipeline_status_t fr_redis_command_preformatted_add(fr_redis_command_set_t *cmds, char const *cmd_str, size_t cmd_len, fr_redis_command_complete_t complete, void *rctx)
Add an preformatted command to the command set as formatted by redisCommandFormat or it's variants.
Definition pipeline.c:479
@ FR_REDIS_PIPELINE_OK
No failure.
Definition pipeline.h:44
#define RETURN_UNLANG_FAIL
Definition rcode.h:63

Definition at line 2113 of file rlm_redis_ippool.c.

◆ CHECK_POOL_NAME

#define CHECK_POOL_NAME
Value:
if (env->pool_name.vb_length > IPPOOL_MAX_KEY_PREFIX_SIZE) { \
REDEBUG("Pool name too long. Expected %u bytes, got %ld bytes", \
IPPOOL_MAX_KEY_PREFIX_SIZE, env->pool_name.vb_length); \
} \
if (env->pool_name.vb_length == 0) { \
RDEBUG2("Empty pool name. Doing nothing"); \
}
#define RETURN_UNLANG_NOOP
Definition rcode.h:69
#define IPPOOL_MAX_KEY_PREFIX_SIZE

Definition at line 1294 of file rlm_redis_ippool.c.

◆ EOL

#define EOL   "\n"

Definition at line 456 of file rlm_redis_ippool.c.

◆ POPULATE_PAIR

#define POPULATE_PAIR (   _da,
  _i,
  _parent 
)
Value:
MEM(vp = fr_pair_afrom_da(_parent, _da)); \
vp->vp_uint64 = reply->element[_i]->integer; \
fr_pair_append(&_parent->vp_group, vp)
#define MEM(x)
Definition debug.h:38
fr_pair_t * fr_pair_afrom_da(TALLOC_CTX *ctx, fr_dict_attr_t const *da)
Dynamically allocate a new attribute and assign a fr_dict_attr_t.
Definition pair.c:290
fr_pair_t * vp

◆ REDIS_IPPOOL_SCRIPT_LOAD

#define REDIS_IPPOOL_SCRIPT_LOAD (   _cmds,
  _script,
  _script_len,
  _ret 
)
Value:
do { \
char const **argv; \
size_t *argv_len; \
MEM(argv = talloc_array(_cmds, char const *, 3)); \
MEM(argv_len = talloc_array(_cmds, size_t, 3)); \
argv[0] = "SCRIPT"; \
argv[1] = "LOAD"; \
argv[2] = _script; \
argv_len[0] = (sizeof("SCRIPT") - 1); \
argv_len[1] = (sizeof("LOAD") - 1); \
argv_len[2] = _script_len; \
if (fr_redis_command_argv_add(_cmds, 3, argv, argv_len, lua_script_load_results, NULL) != FR_REDIS_PIPELINE_OK) { \
talloc_free(_cmds); \
return _ret; \
} \
} while (0)
fr_redis_pipeline_status_t fr_redis_command_argv_add(fr_redis_command_set_t *cmds, size_t argc, char const **argv, size_t *argv_len, fr_redis_command_complete_t complete, void *rctx)
Add a command with arguments to the command set.
Definition pipeline.c:436
static void lua_script_load_results(request_t *request, UNUSED fr_redis_command_t *cmd, redisReply *reply, UNUSED void *rctx)

Definition at line 1345 of file rlm_redis_ippool.c.

Function Documentation

◆ _redis_ippool_alloc_ctx_free()

static int _redis_ippool_alloc_ctx_free ( redis_ippool_alloc_rctx_t rctx)
static

Definition at line 1460 of file rlm_redis_ippool.c.

+ Here is the caller graph for this function:

◆ _redis_ippool_info_rctx_free()

static int _redis_ippool_info_rctx_free ( redis_ippool_info_rctx_t rctx)
static

Definition at line 2023 of file rlm_redis_ippool.c.

+ Here is the caller graph for this function:

◆ _redis_ippool_release_rctx_free()

static int _redis_ippool_release_rctx_free ( redis_ippool_release_rctx_t rctx)
static

Definition at line 1728 of file rlm_redis_ippool.c.

+ Here is the caller graph for this function:

◆ _redis_ippool_tool_rctx_free()

static int _redis_ippool_tool_rctx_free ( redis_ippool_tool_rctx_t rctx)
static

Definition at line 2005 of file rlm_redis_ippool.c.

+ Here is the caller graph for this function:

◆ _redis_ippool_update_rctx_free()

static int _redis_ippool_update_rctx_free ( redis_ippool_update_rctx_t rctx)
static

Definition at line 1618 of file rlm_redis_ippool.c.

+ Here is the caller graph for this function:

◆ _redis_pools_list_rctx_free()

static int _redis_pools_list_rctx_free ( redis_pools_list_rctx_t rctx)
static

Definition at line 1982 of file rlm_redis_ippool.c.

+ Here is the caller graph for this function:

◆ ipaddr_inc()

static void ipaddr_inc ( fr_ipaddr_t addr,
size_t  inc 
)
static

Increment an IP address by a given number of addresses.

Definition at line 2285 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ippool_action_print()

static void ippool_action_print ( request_t request,
ippool_action_t  action,
fr_log_lvl_t  lvl,
fr_value_box_t const *  key_prefix,
fr_value_box_t const *  ip,
fr_value_box_t const *  owner,
fr_value_box_t const *  gateway_id,
uint32_t  expires 
)
static

Definition at line 912 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ippool_script_enqueue()

static unlang_action_t ippool_script_enqueue ( TALLOC_CTX *  ctx,
fr_redis_command_set_t **  out_cmds,
fr_redis_async_cmd_t **  out_cmd,
request_t request,
rlm_redis_ippool_thread_t thread,
uint8_t const *  key,
size_t  key_len,
char const *  cmd,
int  cmd_len,
fr_redis_command_complete_t  complete,
module_method_t  resume,
unlang_module_signal_t  cancel,
void *  rctx,
redis_wait_rctx_t wait_rctx 
)
static

Enqueue a script to run against a redis cluster.

Parameters
[in]ctxTo allocate redis command set.
[out]out_cmdsWhere to write a pointer to the command set.
[out]out_cmdWhere to write a pointer to the async command
[in]requestThe current request.
[in]threadRedis ippool thread
[in]keyto use to determine the cluster node.
[in]key_lenlength of the key.
[in]cmdPre-formatted redis command to call script
[in]cmd_lenlength of the pre-formatted command.
[in]completeCallback to run when cmd is completed
[in]resumeResume function to run after script completed.
[in]rctxto pass to complete and resume.
Returns
unlang_action_t

Definition at line 983 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ippool_wait_check()

static void ippool_wait_check ( request_t request,
UNUSED fr_redis_command_t cmd,
redisReply *  reply,
void *  rctx 
)
inlinestatic

Check the requisite number of slaves replicated the lease info.

Parameters
requestThe current request.
cmdThe Redis command triggering this callback
replywe got from the server.
rctxWAIT resume context.

Definition at line 893 of file rlm_redis_ippool.c.

+ Here is the caller graph for this function:

◆ lua_script_load()

static void lua_script_load ( fr_redis_trunk_t rtrunk,
UNUSED void *  uctx 
)
static

Definition at line 3149 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lua_script_load_results()

static void lua_script_load_results ( request_t request,
UNUSED fr_redis_command_t cmd,
redisReply *  reply,
UNUSED void *  rctx 
)
static

Definition at line 1333 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:

◆ mod_alloc()

static unlang_action_t mod_alloc ( unlang_result_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 1467 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:

◆ mod_alloc_cancel()

static void mod_alloc_cancel ( module_ctx_t const *  mctx,
request_t request,
UNUSED fr_signal_t  action 
)
static

Definition at line 1425 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mod_alloc_resume()

static unlang_action_t mod_alloc_resume ( unlang_result_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 1434 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mod_bootstrap()

static int mod_bootstrap ( module_inst_ctx_t const *  mctx)
static

Definition at line 3305 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:

◆ mod_bulk_release()

static unlang_action_t mod_bulk_release ( unlang_result_t p_result,
UNUSED module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 1785 of file rlm_redis_ippool.c.

◆ mod_coord_attach()

static int mod_coord_attach ( module_thread_inst_ctx_t const *  mctx)
static

Definition at line 3178 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:

◆ mod_detach()

static int mod_detach ( module_detach_ctx_t const *  mctx)
static

Definition at line 3293 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:

◆ mod_info_cancel()

static void mod_info_cancel ( module_ctx_t const *  mctx,
request_t request,
UNUSED fr_signal_t  action 
)
static

Definition at line 2035 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Definition at line 3199 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:

◆ mod_load()

static int mod_load ( void  )
static

Definition at line 3366 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:

◆ mod_pools_list_result()

static void mod_pools_list_result ( request_t request,
UNUSED fr_redis_command_t cmd,
redisReply *  reply,
void *  rctx 
)
static

Parse the results from Redis SCAN command used to list pools.

Definition at line 1794 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mod_release()

static unlang_action_t mod_release ( unlang_result_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 1735 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:

◆ mod_release_cancel()

static void mod_release_cancel ( module_ctx_t const *  mctx,
request_t request,
UNUSED fr_signal_t  action 
)
static

Definition at line 1681 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mod_release_resume()

static unlang_action_t mod_release_resume ( unlang_result_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 1690 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mod_show()

static unlang_action_t mod_show ( unlang_result_t p_result,
UNUSED module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 2117 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:

◆ mod_show_result()

static void mod_show_result ( request_t request,
UNUSED fr_redis_command_t cmd,
redisReply *  reply,
void *  rctx 
)
static

Definition at line 2060 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mod_show_resume()

static unlang_action_t mod_show_resume ( unlang_result_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 2044 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mod_stats()

static unlang_action_t mod_stats ( unlang_result_t p_result,
UNUSED module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 2220 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:

◆ mod_stats_result()

static void mod_stats_result ( request_t request,
UNUSED fr_redis_command_t cmd,
redisReply *  reply,
void *  rctx 
)
static

Definition at line 2174 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mod_thread_detach()

static int mod_thread_detach ( module_thread_inst_ctx_t const *  mctx)
static

Definition at line 3282 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:

◆ mod_thread_instantiate()

static int mod_thread_instantiate ( module_thread_inst_ctx_t const *  mctx)
static

Definition at line 3165 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:

◆ mod_update()

static unlang_action_t mod_update ( unlang_result_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 1625 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:

◆ mod_update_cancel()

static void mod_update_cancel ( module_ctx_t const *  mctx,
request_t request,
UNUSED fr_signal_t  action 
)
static

Definition at line 1542 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mod_update_resume()

static unlang_action_t mod_update_resume ( unlang_result_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 1551 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ REDIS_ASYNC_COORD_CALLBACKS()

REDIS_ASYNC_COORD_CALLBACKS ( rlm_redis_ippool_thread_t  )

◆ redis_ippool_add_common()

static xlat_action_t redis_ippool_add_common ( request_t request,
rlm_redis_ippool_t inst,
rlm_redis_ippool_thread_t t,
fr_value_box_t pool,
fr_value_box_t start,
fr_value_box_t end,
fr_value_box_t range,
uint8_t  prefix,
size_t  num_addr,
size_t  step 
)
static

Common code for adding addresses to a pool.

Definition at line 2593 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_addresses_add_xlat()

static xlat_action_t redis_ippool_addresses_add_xlat ( UNUSED TALLOC_CTX *  ctx,
UNUSED fr_dcursor_t out,
xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 2710 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_addresses_arg_parse()

static int redis_ippool_addresses_arg_parse ( request_t request,
uint8_t prefix_out,
size_t step,
size_t num_addr,
fr_value_box_t start,
fr_value_box_t end,
fr_value_box_t prefix_in 
)
static

Parse argments provided to IP pool manipulation xlats which work on start and end addresses.

Parameters
[in]requestThe current request, for debugging.
[out]prefix_outWhere to write the parsed value of prefix.
[out]stepWhere to write the step size for multiple addresses.
[out]num_addrWhere to write the number of addresses
[in]startThe provided start address.
[in]endThe provided end address.
[in]prefix_inoptinal prefix argument.

Definition at line 2435 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_addresses_modify_xlat()

static xlat_action_t redis_ippool_addresses_modify_xlat ( UNUSED TALLOC_CTX *  ctx,
UNUSED fr_dcursor_t out,
xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 3026 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_addresses_release_xlat()

static xlat_action_t redis_ippool_addresses_release_xlat ( UNUSED TALLOC_CTX *  ctx,
UNUSED fr_dcursor_t out,
xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 2916 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_addresses_remove_xlat()

static xlat_action_t redis_ippool_addresses_remove_xlat ( UNUSED TALLOC_CTX *  ctx,
UNUSED fr_dcursor_t out,
xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 2813 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_allocate_results()

static void redis_ippool_allocate_results ( request_t request,
UNUSED fr_redis_command_t cmd,
redisReply *  reply,
void *  rctx 
)
static

Callback to process results from allocation script.

Definition at line 1017 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_assign_xlat()

static xlat_action_t redis_ippool_assign_xlat ( UNUSED TALLOC_CTX *  ctx,
UNUSED fr_dcursor_t out,
xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 3051 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_common_cancel()

static void redis_ippool_common_cancel ( xlat_ctx_t const *  xctx,
request_t request,
UNUSED fr_signal_t  action 
)
static

Common cancellation function for xlats using redi_ippool_tool_rctx_t.

Definition at line 2495 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_common_resume()

static xlat_action_t redis_ippool_common_resume ( TALLOC_CTX *  ctx,
fr_dcursor_t out,
xlat_ctx_t const *  xctx,
UNUSED request_t request,
UNUSED fr_value_box_list_t *  in 
)
static

Common resume function for pool manipulation xlats.

Where the number of changes is to be returned

Definition at line 2507 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_list_cancel()

static void redis_ippool_list_cancel ( xlat_ctx_t const *  xctx,
request_t request,
UNUSED fr_signal_t  action 
)
static

Definition at line 1857 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_list_next_scan()

static xlat_action_t redis_ippool_list_next_scan ( request_t request,
rlm_redis_ippool_thread_t thread,
redis_pools_list_rctx_t rctx 
)
static

Enqueue the next SCAN command.

This will either be on the same node, with the cursor value returned by the last SCAN, or starting on a new node.

Definition at line 1910 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_list_resume()

static xlat_action_t redis_ippool_list_resume ( UNUSED TALLOC_CTX *  ctx,
fr_dcursor_t out,
xlat_ctx_t const *  xctx,
UNUSED request_t request,
UNUSED fr_value_box_list_t *  in 
)
static

Definition at line 1866 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_list_start()

static xlat_action_t redis_ippool_list_start ( UNUSED TALLOC_CTX *  ctx,
UNUSED fr_dcursor_t out,
xlat_ctx_t const *  xctx,
request_t request,
UNUSED fr_value_box_list_t *  in 
)
static

Definition at line 1954 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_list_xlat()

static xlat_action_t redis_ippool_list_xlat ( TALLOC_CTX *  ctx,
fr_dcursor_t out,
xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 1989 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_load_cancel()

static void redis_ippool_load_cancel ( module_ctx_t const *  mctx,
request_t request,
UNUSED fr_signal_t  action 
)
static

Definition at line 1305 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_load_resume()

static unlang_action_t redis_ippool_load_resume ( unlang_result_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 1314 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_modify_common()

static xlat_action_t redis_ippool_modify_common ( request_t request,
rlm_redis_ippool_t inst,
rlm_redis_ippool_thread_t t,
fr_value_box_t pool,
fr_value_box_t start,
fr_value_box_t end,
fr_value_box_t range,
uint8_t  prefix,
size_t  num_addr,
size_t  step 
)
static

Common code for modifying the range assigned to addresses.

Definition at line 2935 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_rcode_check()

static unlang_action_t redis_ippool_rcode_check ( request_t request,
fr_redis_command_set_t cmds,
fr_redis_async_cmd_t cmd,
module_ctx_t const *  mctx,
module_method_t  resume,
unlang_module_signal_t  cancel,
char const *  script,
size_t  script_len 
)
inlinestatic

Check the return code from an async redis command.

Redirecting to another node in response to ASK / MOVED codes.

Definition at line 1366 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_release_common()

static xlat_action_t redis_ippool_release_common ( request_t request,
rlm_redis_ippool_t inst,
rlm_redis_ippool_thread_t t,
fr_value_box_t pool,
fr_value_box_t start,
fr_value_box_t end,
uint8_t  prefix,
size_t  num_addr,
size_t  step 
)
static

Common code for releasing address assignments.

Definition at line 2832 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_release_results()

static void redis_ippool_release_results ( request_t request,
UNUSED fr_redis_command_t cmd,
redisReply *  reply,
void *  rctx 
)
static

Callback to process results from release script.

Definition at line 1262 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_remove_common()

static xlat_action_t redis_ippool_remove_common ( request_t request,
rlm_redis_ippool_t inst,
rlm_redis_ippool_thread_t t,
fr_value_box_t pool,
fr_value_box_t start,
fr_value_box_t end,
uint8_t  prefix,
size_t  num_addr,
size_t  step 
)
static

Common code for removing addresses from a pool.

Definition at line 2729 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_subnet_add_xlat()

static xlat_action_t redis_ippool_subnet_add_xlat ( UNUSED TALLOC_CTX *  ctx,
UNUSED fr_dcursor_t out,
xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 2684 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_subnet_arg_parse()

static int redis_ippool_subnet_arg_parse ( request_t request,
fr_value_box_t start,
fr_value_box_t end,
uint8_t prefix_out,
size_t step,
size_t num_addr,
fr_value_box_t subnet,
fr_value_box_t prefix_in 
)
static

Parse argments provided to IP pool manipulation xlats which work on subnets.

Parameters
[in]requestThe current request, for debugging.
[out]startWhere to write the start address.
[out]endWhere to write the end address.
[out]prefix_outWhere to write the parsed value of prefix.
[out]stepWhere to write the step size for multiple addresses.
[out]num_addrWhere to write the number of addresses
[in]subnetto parse.
[in]prefix_inoptinal prefix argument.

Definition at line 2319 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_subnet_modify_xlat()

static xlat_action_t redis_ippool_subnet_modify_xlat ( UNUSED TALLOC_CTX *  ctx,
UNUSED fr_dcursor_t out,
xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 3000 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_subnet_release_xlat()

static xlat_action_t redis_ippool_subnet_release_xlat ( UNUSED TALLOC_CTX *  ctx,
UNUSED fr_dcursor_t out,
xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 2891 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_subnet_remove_xlat()

static xlat_action_t redis_ippool_subnet_remove_xlat ( UNUSED TALLOC_CTX *  ctx,
UNUSED fr_dcursor_t out,
xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 2788 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_unassign_xlat()

static xlat_action_t redis_ippool_unassign_xlat ( UNUSED TALLOC_CTX *  ctx,
UNUSED fr_dcursor_t out,
xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 3107 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_ippool_update_results()

static void redis_ippool_update_results ( request_t request,
UNUSED fr_redis_command_t cmd,
redisReply *  reply,
void *  rctx 
)
static

Callback to process results from allocation script.

Definition at line 1172 of file rlm_redis_ippool.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redis_xlat_array_results()

static void redis_xlat_array_results ( request_t request,
UNUSED fr_redis_command_t cmd,
redisReply *  reply,
void *  rctx 
)
static

Callback to be used when Redis commands are expected to return an array.

Where the first element is expected to be an integer indicating the number of changes made. Typically this is when a MULTI ... EXEC is used and this parses the reply from EXEC.

Definition at line 2574 of file rlm_redis_ippool.c.

+ Here is the caller graph for this function:

◆ redis_xlat_common_results()

static void redis_xlat_common_results ( request_t request,
UNUSED fr_redis_command_t cmd,
redisReply *  reply,
void *  rctx 
)
static

Callback to be used when Redis commands are expected to return a single integer.

With the value indicating the number of changes made.

Definition at line 2554 of file rlm_redis_ippool.c.

+ Here is the caller graph for this function:

◆ uint32_gen_mask()

static uint32_t uint32_gen_mask ( uint8_t  bits)
static

Definition at line 880 of file rlm_redis_ippool.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ attr_ippool_lease

fr_dict_attr_t const* attr_ippool_lease
static

Definition at line 69 of file rlm_redis_ippool.c.

◆ attr_ippool_lease_active

fr_dict_attr_t const* attr_ippool_lease_active
static

Definition at line 71 of file rlm_redis_ippool.c.

◆ attr_ippool_lease_address

fr_dict_attr_t const* attr_ippool_lease_address
static

Definition at line 70 of file rlm_redis_ippool.c.

◆ attr_ippool_lease_device

fr_dict_attr_t const* attr_ippool_lease_device
static

Definition at line 73 of file rlm_redis_ippool.c.

◆ attr_ippool_lease_expires

fr_dict_attr_t const* attr_ippool_lease_expires
static

Definition at line 72 of file rlm_redis_ippool.c.

◆ attr_ippool_lease_gateway

fr_dict_attr_t const* attr_ippool_lease_gateway
static

Definition at line 74 of file rlm_redis_ippool.c.

◆ attr_ippool_lease_range

fr_dict_attr_t const* attr_ippool_lease_range
static

Definition at line 75 of file rlm_redis_ippool.c.

◆ attr_ippool_name

fr_dict_attr_t const* attr_ippool_name
static

Definition at line 68 of file rlm_redis_ippool.c.

◆ attr_ippool_stats

fr_dict_attr_t const* attr_ippool_stats
static

Definition at line 76 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_dynamic

fr_dict_attr_t const* attr_ippool_stats_dynamic
static

Definition at line 78 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_dynamic_expire1d

fr_dict_attr_t const* attr_ippool_stats_dynamic_expire1d
static

Definition at line 84 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_dynamic_expire1h

fr_dict_attr_t const* attr_ippool_stats_dynamic_expire1h
static

Definition at line 83 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_dynamic_expire1m

fr_dict_attr_t const* attr_ippool_stats_dynamic_expire1m
static

Definition at line 81 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_dynamic_expire30m

fr_dict_attr_t const* attr_ippool_stats_dynamic_expire30m
static

Definition at line 82 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_dynamic_free

fr_dict_attr_t const* attr_ippool_stats_dynamic_free
static

Definition at line 80 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_dynamic_total

fr_dict_attr_t const* attr_ippool_stats_dynamic_total
static

Definition at line 79 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_static

fr_dict_attr_t const* attr_ippool_stats_static
static

Definition at line 85 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_static_free

fr_dict_attr_t const* attr_ippool_stats_static_free
static

Definition at line 87 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_static_renew1d

fr_dict_attr_t const* attr_ippool_stats_static_renew1d
static

Definition at line 91 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_static_renew1h

fr_dict_attr_t const* attr_ippool_stats_static_renew1h
static

Definition at line 90 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_static_renew1m

fr_dict_attr_t const* attr_ippool_stats_static_renew1m
static

Definition at line 88 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_static_renew30m

fr_dict_attr_t const* attr_ippool_stats_static_renew30m
static

Definition at line 89 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_static_total

fr_dict_attr_t const* attr_ippool_stats_static_total
static

Definition at line 86 of file rlm_redis_ippool.c.

◆ attr_ippool_stats_total

fr_dict_attr_t const* attr_ippool_stats_total
static

Definition at line 77 of file rlm_redis_ippool.c.

◆ dict_freeradius

fr_dict_t const* dict_freeradius
static

Definition at line 59 of file rlm_redis_ippool.c.

◆ dict_redis

fr_dict_t const* dict_redis
static

Definition at line 58 of file rlm_redis_ippool.c.

◆ lua_alloc_cmd

char lua_alloc_cmd[]
static

Lua script for allocating new leases.

  • KEYS[1] The pool name.
  • ARGV[1] Wall time (seconds since epoch).
  • ARGV[2] Expires in (seconds).
  • ARGV[3] Lease owner identifier (administratively configured).
  • ARGV[4] Device -> IP association time (seconds).
  • ARGV[5] (optional) Gateway identifier.
  • ARGV[6] (optional) Requested address.

Returns

{ <rcode>[, <ip>][, <range>][, <lease time>][, <counter>] } 
  • IPPOOL_RCODE_SUCCESS lease updated..
  • IPPOOL_RCODE_NOT_FOUND lease not found in pool.

Definition at line 472 of file rlm_redis_ippool.c.

◆ lua_alloc_digest

char lua_alloc_digest[(SHA1_DIGEST_LENGTH *2)+1]
static

Definition at line 557 of file rlm_redis_ippool.c.

◆ lua_assign_cmd

char lua_assign_cmd[]
static

Lua script for assigning a static lease.

  • KEYS[1] The pool name.
  • ARGV[1] THE ip address to create a static assignment for.
  • ARGV[2] The owner to assign the static lease to.
  • ARGV[3] The range identifier.
  • ARGV[4] Wall time (seconds since epoch)

Checks whether the IP already has a static assignment, and whether the owner is already associated with a different IP.

If check pass, sets the static flag on the IP entry in the ZSET and creates the association between the IP and the owner.

Returns

  • 0 if no assignment is made.
  • 1 if the IP assignment is made.

Definition at line 781 of file rlm_redis_ippool.c.

◆ lua_release_cmd

char lua_release_cmd[]
static

Lua script for releasing leases.

  • KEYS[1] The pool name.
  • ARGV[1] Wall time (seconds since epoch).
  • ARGV[2] IP address to release.
  • ARGV[3] Client identifier.
  • ARGV[4] Device -> IP association time (seconds).

Sets the expiry time to be NOW() - 1 to maximise time between IP address allocations.

Returns

array { <rcode>[, <counter>] } 
  • IPPOOL_RCODE_SUCCESS lease updated..
  • IPPOOL_RCODE_NOT_FOUND lease not found in pool.
  • IPPOOL_RCODE_DEVICE_MISMATCH lease was allocated to a different client..

Definition at line 644 of file rlm_redis_ippool.c.

◆ lua_release_digest

char lua_release_digest[(SHA1_DIGEST_LENGTH *2)+1]
static

Definition at line 690 of file rlm_redis_ippool.c.

◆ lua_release_xlat_cmd

char lua_release_xlat_cmd[]
static
Initial value:
=
"local found" EOL
"local ret" EOL
"ret = redis.call('ZADD', '{' .. KEYS[1] .. '}:"IPPOOL_POOL_KEY"', 'XX', 'CH', 0, ARGV[1])" EOL
"if ret == 0 then" EOL
" return 0" EOL
"end" EOL
"found = redis.call('HGET', '{' .. KEYS[1] .. '}:"IPPOOL_ADDRESS_KEY":'"
" .. ARGV[1], 'device')" EOL
"if not found then" EOL
" return ret" EOL
"end" EOL
"redis.call('DEL', '{' .. KEYS[1] .. '}:"IPPOOL_OWNER_KEY":' .. found)" EOL
"return 1"
#define IPPOOL_OWNER_KEY
#define IPPOOL_POOL_KEY
#define IPPOOL_ADDRESS_KEY
#define EOL

Lua script for releasing a lease.

  • KEYS[1] The pool name.
  • ARGV[1] IP address to release.

Removes the IP entry in the ZSET, then removes the address hash, and the device key if one exists.

Will do nothing if the lease is not found in the ZSET.

Returns

  • 0 if no ip addresses were removed.
  • 1 if an ip address was removed.

Definition at line 740 of file rlm_redis_ippool.c.

◆ lua_remove_cmd

char lua_remove_cmd[]
static
Initial value:
=
"local found" EOL
"local ret" EOL
"local address_key" EOL
"ret = redis.call('ZREM', '{' .. KEYS[1] .. '}:"IPPOOL_POOL_KEY"', ARGV[1])" EOL
"address_key = '{' .. KEYS[1] .. '}:"IPPOOL_ADDRESS_KEY":' .. ARGV[1]" EOL
"found = redis.call('HGET', address_key, 'device')" EOL
"redis.call('DEL', address_key)" EOL
"if not found then" EOL
" return ret" EOL
"end" EOL
"redis.call('DEL', '{' .. KEYS[1] .. '}:"IPPOOL_OWNER_KEY":' .. found)" EOL
"return 1" EOL

Lua script for removing a lease.

  • KEYS[1] The pool name.
  • ARGV[1] IP address to remove.

Removes the IP entry in the ZSET, then removes the address hash, and the device key if one exists.

Will work with partially removed IP addresses (where the ZSET entry is absent but other elements weren't cleaned up).

Returns

  • 0 if no ip addresses were removed.
  • 1 if an ip address was removed.

Definition at line 707 of file rlm_redis_ippool.c.

◆ lua_unassign_cmd

char lua_unassign_cmd[]
static
Initial value:
=
"local found" EOL
"local pool_key = '{' .. KEYS[1] .. '}:"IPPOOL_POOL_KEY"'" EOL
"local owner_key = '{' .. KEYS[1] .. '}:"IPPOOL_OWNER_KEY":' .. ARGV[2]" EOL
"found = redis.call('GET', owner_key)" EOL
"if not found or found ~= ARGV[1] then" EOL
" return 0" EOL
"end" EOL
"local expires = tonumber(redis.call('ZSCORE', pool_key, ARGV[1]))" EOL
"local static = expires >= " STRINGIFY(IPPOOL_STATIC_BIT) EOL
"if not static then" EOL
" return 0" EOL
"end" EOL
"expires = expires - " STRINGIFY(IPPOOL_STATIC_BIT) EOL
"redis.call('ZADD', pool_key, 'XX', expires, ARGV[1])" EOL
"if expires > tonumber(ARGV[3]) then" EOL
" redis.call('EXPIRE', owner_key, expires - tonumber(ARGV[3]))" EOL
"else" EOL
" redis.call('DEL', owner_key)" EOL
"end" EOL
"return 1"
#define STRINGIFY(x)
Definition build.h:216
#define IPPOOL_STATIC_BIT

Lua script for un-assigning a static lease.

  • KEYS[1] The pool name.
  • ARGV[1] IP address to remove static lease from.
  • ARGV[2] The owner the static lease should be removed from.
  • ARGV[3] Wall time (seconds since epoch).

Removes the static flag from the IP entry in the ZSET, then, depending on the remaining time determined by the ZSCORE removes the address hash, and the device key.

Will do nothing if the static assignment does not exist or the IP and device do not match.

Returns

  • 0 if no ip addresses were unassigned.
  • 1 if an ip address was unassigned.

Definition at line 841 of file rlm_redis_ippool.c.

◆ lua_update_cmd

char lua_update_cmd[]
static

Lua script for updating leases.

  • KEYS[1] The pool name.
  • ARGV[1] Wall time (seconds since epoch).
  • ARGV[2] Expires in (seconds).
  • ARGV[3] IP address to update.
  • ARGV[4] Lease owner identifier.
  • ARGV[5] Device -> IP association time (seconds).
  • ARGV[6] (optional) Gateway identifier.

Returns

array { <rcode>[, <range>] } 
  • IPPOOL_RCODE_SUCCESS lease updated..
  • IPPOOL_RCODE_NOT_FOUND lease not found in pool.
  • IPPOOL_RCODE_EXPIRED lease has already expired.
  • IPPOOL_RCODE_DEVICE_MISMATCH lease was allocated to a different client.

Definition at line 575 of file rlm_redis_ippool.c.

◆ lua_update_digest

char lua_update_digest[(SHA1_DIGEST_LENGTH *2)+1]
static

Definition at line 626 of file rlm_redis_ippool.c.

◆ module_config

conf_parser_t module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("wait_num", rlm_redis_ippool_t, wait_num) },
{ FR_CONF_OFFSET("wait_timeout", rlm_redis_ippool_t, wait_timeout), .dflt = "1s" },
{ FR_CONF_DEPRECATED("ip_address", rlm_redis_ippool_t, NULL) },
{ FR_CONF_DEPRECATED("reply_attr", rlm_redis_ippool_t, NULL) },
{ FR_CONF_OFFSET("ipv4_integer", rlm_redis_ippool_t, ipv4_integer) },
{ FR_CONF_OFFSET("copy_on_update", rlm_redis_ippool_t, copy_on_update), .dflt = "yes", .quote = T_BARE_WORD },
{ FR_CONF_POINTER("redis", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = redis_config },
}
#define CONF_PARSER_TERMINATOR
Definition cf_parse.h:669
#define FR_CONF_DEPRECATED(_name, _struct, _field)
conf_parser_t entry which raises an error if a matching CONF_PAIR is found
Definition cf_parse.h:409
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition cf_parse.h:280
#define FR_CONF_POINTER(_name, _type, _flags, _res_p)
conf_parser_t which parses a single CONF_PAIR producing a single global result
Definition cf_parse.h:334
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
Definition cf_parse.h:423
static conf_parser_t redis_config[]
rlm_redis module instance
@ T_BARE_WORD
Definition token.h:118

Definition at line 162 of file rlm_redis_ippool.c.

◆ redis_config

conf_parser_t redis_config[]
static
Initial value:
= {
}
#define REDIS_COMMON_CONFIG
Definition base.h:143

Definition at line 157 of file rlm_redis_ippool.c.

◆ redis_ippool_addresses_add_args

xlat_arg_parser_t const redis_ippool_addresses_add_args[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_ADDR },
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_ADDR },
{ .single = true, .type = FR_TYPE_UINT8 },
{ .single = true, .type = FR_TYPE_STRING },
}
@ FR_TYPE_STRING
String of printable characters.
@ FR_TYPE_UINT8
8 Bit unsigned integer.
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
#define XLAT_ARG_PARSER_TERMINATOR
Definition xlat.h:171

Definition at line 2701 of file rlm_redis_ippool.c.

◆ redis_ippool_addresses_modify_args

xlat_arg_parser_t const redis_ippool_addresses_modify_args[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_ADDR },
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_ADDR },
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .single = true, .type = FR_TYPE_UINT8 },
}

Definition at line 3017 of file rlm_redis_ippool.c.

◆ redis_ippool_addresses_release_args

xlat_arg_parser_t const redis_ippool_addresses_release_args[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_ADDR },
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_ADDR },
{ .single = true, .type = FR_TYPE_UINT8 },
}

Definition at line 2908 of file rlm_redis_ippool.c.

◆ redis_ippool_addresses_remove_args

xlat_arg_parser_t const redis_ippool_addresses_remove_args[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_ADDR },
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_ADDR },
{ .single = true, .type = FR_TYPE_UINT8 },
}

Definition at line 2805 of file rlm_redis_ippool.c.

◆ redis_ippool_alloc_method_env

const call_env_method_t redis_ippool_alloc_method_env
static
Initial value:
= {
.env = (call_env_parser_t[]){
redis_ippool_alloc_call_env_t, gateway_id ), .pair.dflt = "", .pair.dflt_quote = T_SINGLE_QUOTED_STRING },
.pair.dflt = "%{%{Requested-IP-Address} || %{Net.Src.IP}}", .pair.dflt_quote = T_DOUBLE_QUOTED_STRING },
.pair.dflt = "reply.IP-Pool.Range", .pair.dflt_quote = T_BARE_WORD },
}
}
#define CALL_ENV_TERMINATOR
Definition call_env.h:236
#define FR_CALL_ENV_METHOD_OUT(_inst)
Helper macro for populating the size/type fields of a call_env_method_t from the output structure typ...
Definition call_env.h:240
@ CALL_ENV_FLAG_CONCAT
If the tmpl produced multiple boxes they should be concatenated.
Definition call_env.h:76
@ CALL_ENV_FLAG_ATTRIBUTE
Tmpl MUST contain an attribute reference.
Definition call_env.h:86
@ CALL_ENV_FLAG_NONE
Definition call_env.h:74
@ CALL_ENV_FLAG_REQUIRED
Associated conf pair or section is required.
Definition call_env.h:75
@ CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE
bare words are treated as an attribute, but strings may be xlats.
Definition call_env.h:92
@ CALL_ENV_FLAG_NULLABLE
Tmpl expansions are allowed to produce no output.
Definition call_env.h:80
#define FR_CALL_ENV_OFFSET(_name, _cast_type, _flags, _struct, _field)
Specify a call_env_parser_t which writes out runtime results to the specified field.
Definition call_env.h:340
#define FR_CALL_ENV_PARSE_ONLY_OFFSET(_name, _cast_type, _flags, _struct, _parse_field)
Specify a call_env_parser_t which writes out the result of the parsing phase to the field specified.
Definition call_env.h:389
Per method call config.
Definition call_env.h:180
@ FR_TYPE_UINT32
32 Bit unsigned integer.
@ FR_TYPE_VOID
User data.
Call environment used when calling redis_ippool allocate method.
@ T_SINGLE_QUOTED_STRING
Definition token.h:120
@ T_DOUBLE_QUOTED_STRING
Definition token.h:119

Definition at line 373 of file rlm_redis_ippool.c.

◆ redis_ippool_assign_args

xlat_arg_parser_t const redis_ippool_assign_args[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_PREFIX },
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .concat = true, .type = FR_TYPE_STRING },
}
@ FR_TYPE_COMBO_IP_PREFIX
IPv4 or IPv6 address prefix depending on length.

Definition at line 3043 of file rlm_redis_ippool.c.

◆ redis_ippool_bulk_release_method_env

const call_env_method_t redis_ippool_bulk_release_method_env
static

◆ redis_ippool_release_method_env

const call_env_method_t redis_ippool_release_method_env
static

◆ redis_ippool_show_method_env

const call_env_method_t redis_ippool_show_method_env
static
Initial value:

Definition at line 438 of file rlm_redis_ippool.c.

◆ redis_ippool_stats_method_env

const call_env_method_t redis_ippool_stats_method_env
static

◆ redis_ippool_subnet_add_args

xlat_arg_parser_t const redis_ippool_subnet_add_args[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_PREFIX },
{ .single = true, .type = FR_TYPE_UINT8 },
{ .single = true, .type = FR_TYPE_STRING },
}

Definition at line 2676 of file rlm_redis_ippool.c.

◆ redis_ippool_subnet_modify_args

xlat_arg_parser_t const redis_ippool_subnet_modify_args[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_PREFIX },
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .single = true, .type = FR_TYPE_UINT8 },
}

Definition at line 2992 of file rlm_redis_ippool.c.

◆ redis_ippool_subnet_release_args

xlat_arg_parser_t const redis_ippool_subnet_release_args[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_PREFIX },
{ .single = true, .type = FR_TYPE_UINT8 },
}

Definition at line 2884 of file rlm_redis_ippool.c.

◆ redis_ippool_subnet_remove_args

xlat_arg_parser_t const redis_ippool_subnet_remove_args[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_PREFIX },
{ .single = true, .type = FR_TYPE_UINT8 },
}

Definition at line 2781 of file rlm_redis_ippool.c.

◆ redis_ippool_unassign_args

xlat_arg_parser_t const redis_ippool_unassign_args[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_PREFIX },
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 3100 of file rlm_redis_ippool.c.

◆ redis_ippool_update_method_env

const call_env_method_t redis_ippool_update_method_env
static
Initial value:
= {
.env = (call_env_parser_t[]) {
.pair.dflt = "", .pair.dflt_quote = T_SINGLE_QUOTED_STRING },
.pair.dflt = "%{Requested-IP-Address || Net.Src.IP}", .pair.dflt_quote = T_DOUBLE_QUOTED_STRING },
.pair.dflt = "reply.IP-Pool.Range", .pair.dflt_quote = T_BARE_WORD },
}
}
Call environment used when calling redis_ippool update method.

Definition at line 395 of file rlm_redis_ippool.c.

◆ rlm_redis_ippool

module_rlm_t rlm_redis_ippool

Definition at line 3374 of file rlm_redis_ippool.c.

◆ rlm_redis_ippool_dict

fr_dict_autoload_t rlm_redis_ippool_dict
Initial value:
= {
{ .out = &dict_redis, .proto = "redis" },
{ .out = &dict_freeradius, .proto = "freeradius" },
}
#define DICT_AUTOLOAD_TERMINATOR
Definition dict.h:311
static fr_dict_t const * dict_freeradius
static fr_dict_t const * dict_redis

Definition at line 62 of file rlm_redis_ippool.c.

◆ rlm_redis_ippool_dict_attr

fr_dict_attr_autoload_t rlm_redis_ippool_dict_attr
Initial value:
= {
{ .out = &attr_ippool_name, .name = "IP-Pool.Name", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
{ .out = &attr_ippool_lease, .name = "IP-Pool.Lease", .type = FR_TYPE_TLV, .dict = &dict_freeradius },
{ .out = &attr_ippool_lease_address, .name = "IP-Pool.Lease.Address", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
{ .out = &attr_ippool_lease_active, .name = "IP-Pool.Lease.Active", .type = FR_TYPE_BOOL, .dict = &dict_freeradius },
{ .out = &attr_ippool_lease_expires, .name = "IP-Pool.Lease.Expires", .type = FR_TYPE_DATE, .dict = &dict_freeradius },
{ .out = &attr_ippool_lease_device, .name = "IP-Pool.Lease.Device", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
{ .out = &attr_ippool_lease_gateway, .name = "IP-Pool.Lease.Gateway", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
{ .out = &attr_ippool_lease_range, .name = "IP-Pool.Lease.Range", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats, .name = "IP-Pool.Stats", .type = FR_TYPE_TLV, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_total, .name = "IP-Pool.Stats.Total", .type = FR_TYPE_UINT64, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_dynamic, .name = "IP-Pool.Stats.Dynamic", .type = FR_TYPE_TLV, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_dynamic_total, .name = "IP-Pool.Stats.Dynamic.Total", .type = FR_TYPE_UINT64, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_dynamic_free, .name = "IP-Pool.Stats.Dynamic.Free", .type = FR_TYPE_UINT64, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_dynamic_expire1m, .name = "IP-Pool.Stats.Dynamic.Expire-1m", .type = FR_TYPE_UINT64, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_dynamic_expire30m, .name = "IP-Pool.Stats.Dynamic.Expire-30m", .type = FR_TYPE_UINT64, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_dynamic_expire1h, .name = "IP-Pool.Stats.Dynamic.Expire-1h", .type = FR_TYPE_UINT64, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_dynamic_expire1d, .name = "IP-Pool.Stats.Dynamic.Expire-1d", .type = FR_TYPE_UINT64, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_static, .name = "IP-Pool.Stats.Static", .type = FR_TYPE_TLV, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_static_total, .name = "IP-Pool.Stats.Static.Total", .type = FR_TYPE_UINT64, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_static_free, .name = "IP-Pool.Stats.Static.Free", .type = FR_TYPE_UINT64, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_static_renew1m, .name = "IP-Pool.Stats.Static.Renew-1m", .type = FR_TYPE_UINT64, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_static_renew30m, .name = "IP-Pool.Stats.Static.Renew-30m", .type = FR_TYPE_UINT64, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_static_renew1h, .name = "IP-Pool.Stats.Static.Renew-1h", .type = FR_TYPE_UINT64, .dict = &dict_freeradius },
{ .out = &attr_ippool_stats_static_renew1d, .name = "IP-Pool.Stats.Static.Renew-1d", .type = FR_TYPE_UINT64, .dict = &dict_freeradius },
}
@ FR_TYPE_TLV
Contains nested attributes.
@ FR_TYPE_DATE
Unix time stamp, always has value >2^31.
@ FR_TYPE_UINT64
64 Bit unsigned integer.
@ FR_TYPE_BOOL
A truth value.
static fr_dict_attr_t const * attr_ippool_stats_dynamic_expire1d
static fr_dict_attr_t const * attr_ippool_stats_static_renew1m
static fr_dict_attr_t const * attr_ippool_stats_static
static fr_dict_attr_t const * attr_ippool_stats_static_renew1h
static fr_dict_attr_t const * attr_ippool_stats_dynamic_free
static fr_dict_attr_t const * attr_ippool_stats_static_renew30m
static fr_dict_attr_t const * attr_ippool_stats_dynamic_expire1m
static fr_dict_attr_t const * attr_ippool_lease_device
static fr_dict_attr_t const * attr_ippool_stats_dynamic_expire30m
static fr_dict_attr_t const * attr_ippool_lease_gateway
static fr_dict_attr_t const * attr_ippool_stats_static_total
static fr_dict_attr_t const * attr_ippool_name
static fr_dict_attr_t const * attr_ippool_stats_static_free
static fr_dict_attr_t const * attr_ippool_lease
static fr_dict_attr_t const * attr_ippool_lease_active
static fr_dict_attr_t const * attr_ippool_stats_dynamic
static fr_dict_attr_t const * attr_ippool_lease_address
static fr_dict_attr_t const * attr_ippool_lease_expires
static fr_dict_attr_t const * attr_ippool_lease_range
static fr_dict_attr_t const * attr_ippool_stats
static fr_dict_attr_t const * attr_ippool_stats_dynamic_expire1h
static fr_dict_attr_t const * attr_ippool_stats_static_renew1d
static fr_dict_attr_t const * attr_ippool_stats_dynamic_total
static fr_dict_attr_t const * attr_ippool_stats_total

Definition at line 94 of file rlm_redis_ippool.c.