![]() |
The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
|
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) |
IP Allocation module with a redis backend.
Performs lease management using a Redis backed.
Creates three types of objects:
{<pool name>:<pool type>}:pool (zset) contains IP addresses with priority set by expiry time.{<pool name>:<pool type>}:ip:<address> (hash) contains four keys{<pool name>:<pool type>}:device:<client id> (string) contains last IP address bound by this client.Definition in file rlm_redis_ippool.c.
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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 | |
| 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. |
| 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. |
| #define ADD_REDIS_COMMAND | ( | _fmt, | |
| ... | |||
| ) |
Definition at line 2113 of file rlm_redis_ippool.c.
| #define CHECK_POOL_NAME |
Definition at line 1294 of file rlm_redis_ippool.c.
| #define EOL "\n" |
Definition at line 456 of file rlm_redis_ippool.c.
| #define POPULATE_PAIR | ( | _da, | |
| _i, | |||
| _parent | |||
| ) |
| #define REDIS_IPPOOL_SCRIPT_LOAD | ( | _cmds, | |
| _script, | |||
| _script_len, | |||
| _ret | |||
| ) |
Definition at line 1345 of file rlm_redis_ippool.c.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
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:
|
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:
|
static |
Enqueue a script to run against a redis cluster.
| [in] | ctx | To allocate redis command set. |
| [out] | out_cmds | Where to write a pointer to the command set. |
| [out] | out_cmd | Where to write a pointer to the async command |
| [in] | request | The current request. |
| [in] | thread | Redis ippool thread |
| [in] | key | to use to determine the cluster node. |
| [in] | key_len | length of the key. |
| [in] | cmd | Pre-formatted redis command to call script |
| [in] | cmd_len | length of the pre-formatted command. |
| [in] | complete | Callback to run when cmd is completed |
| [in] | resume | Resume function to run after script completed. |
| [in] | rctx | to pass to complete and resume. |
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:
|
inlinestatic |
Check the requisite number of slaves replicated the lease info.
| request | The current request. |
| cmd | The Redis command triggering this callback |
| reply | we got from the server. |
| rctx | WAIT resume context. |
Definition at line 893 of file rlm_redis_ippool.c.
Here is the caller graph for this function:
|
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:
|
static |
|
static |
|
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:
|
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:
|
static |
|
static |
Definition at line 1785 of file rlm_redis_ippool.c.
|
static |
|
static |
|
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:
|
static |
|
static |
|
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:
|
static |
|
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:
|
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:
|
static |
|
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:
|
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:
|
static |
|
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:
|
static |
|
static |
|
static |
|
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:
|
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 | ( | rlm_redis_ippool_thread_t | ) |
|
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:
|
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:
|
static |
Parse argments provided to IP pool manipulation xlats which work on start and end addresses.
| [in] | request | The current request, for debugging. |
| [out] | prefix_out | Where to write the parsed value of prefix. |
| [out] | step | Where to write the step size for multiple addresses. |
| [out] | num_addr | Where to write the number of addresses |
| [in] | start | The provided start address. |
| [in] | end | The provided end address. |
| [in] | prefix_in | optinal 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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
static |
Parse argments provided to IP pool manipulation xlats which work on subnets.
| [in] | request | The current request, for debugging. |
| [out] | start | Where to write the start address. |
| [out] | end | Where to write the end address. |
| [out] | prefix_out | Where to write the parsed value of prefix. |
| [out] | step | Where to write the step size for multiple addresses. |
| [out] | num_addr | Where to write the number of addresses |
| [in] | subnet | to parse. |
| [in] | prefix_in | optinal 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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
static |
Definition at line 69 of file rlm_redis_ippool.c.
|
static |
Definition at line 71 of file rlm_redis_ippool.c.
|
static |
Definition at line 70 of file rlm_redis_ippool.c.
|
static |
Definition at line 73 of file rlm_redis_ippool.c.
|
static |
Definition at line 72 of file rlm_redis_ippool.c.
|
static |
Definition at line 74 of file rlm_redis_ippool.c.
|
static |
Definition at line 75 of file rlm_redis_ippool.c.
|
static |
Definition at line 68 of file rlm_redis_ippool.c.
|
static |
Definition at line 76 of file rlm_redis_ippool.c.
|
static |
Definition at line 78 of file rlm_redis_ippool.c.
|
static |
Definition at line 84 of file rlm_redis_ippool.c.
|
static |
Definition at line 83 of file rlm_redis_ippool.c.
|
static |
Definition at line 81 of file rlm_redis_ippool.c.
|
static |
Definition at line 82 of file rlm_redis_ippool.c.
|
static |
Definition at line 80 of file rlm_redis_ippool.c.
|
static |
Definition at line 79 of file rlm_redis_ippool.c.
|
static |
Definition at line 85 of file rlm_redis_ippool.c.
|
static |
Definition at line 87 of file rlm_redis_ippool.c.
|
static |
Definition at line 91 of file rlm_redis_ippool.c.
|
static |
Definition at line 90 of file rlm_redis_ippool.c.
|
static |
Definition at line 88 of file rlm_redis_ippool.c.
|
static |
Definition at line 89 of file rlm_redis_ippool.c.
|
static |
Definition at line 86 of file rlm_redis_ippool.c.
|
static |
Definition at line 77 of file rlm_redis_ippool.c.
|
static |
Definition at line 59 of file rlm_redis_ippool.c.
|
static |
Definition at line 58 of file rlm_redis_ippool.c.
|
static |
Lua script for allocating new leases.
Returns
{ <rcode>[, <ip>][, <range>][, <lease time>][, <counter>] } Definition at line 472 of file rlm_redis_ippool.c.
|
static |
Definition at line 557 of file rlm_redis_ippool.c.
|
static |
Lua script for assigning a static lease.
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
Definition at line 781 of file rlm_redis_ippool.c.
|
static |
Lua script for releasing leases.
Sets the expiry time to be NOW() - 1 to maximise time between IP address allocations.
Returns
array { <rcode>[, <counter>] } Definition at line 644 of file rlm_redis_ippool.c.
|
static |
Definition at line 690 of file rlm_redis_ippool.c.
|
static |
Lua script for releasing a lease.
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
Definition at line 740 of file rlm_redis_ippool.c.
|
static |
Lua script for removing a lease.
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
Definition at line 707 of file rlm_redis_ippool.c.
|
static |
Lua script for un-assigning a static lease.
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
Definition at line 841 of file rlm_redis_ippool.c.
|
static |
Lua script for updating leases.
Returns
array { <rcode>[, <range>] } Definition at line 575 of file rlm_redis_ippool.c.
|
static |
Definition at line 626 of file rlm_redis_ippool.c.
|
static |
Definition at line 162 of file rlm_redis_ippool.c.
|
static |
Definition at line 157 of file rlm_redis_ippool.c.
|
static |
Definition at line 2701 of file rlm_redis_ippool.c.
|
static |
Definition at line 3017 of file rlm_redis_ippool.c.
|
static |
Definition at line 2908 of file rlm_redis_ippool.c.
|
static |
Definition at line 2805 of file rlm_redis_ippool.c.
|
static |
Definition at line 373 of file rlm_redis_ippool.c.
|
static |
Definition at line 3043 of file rlm_redis_ippool.c.
|
static |
Definition at line 428 of file rlm_redis_ippool.c.
|
static |
Definition at line 414 of file rlm_redis_ippool.c.
|
static |
Definition at line 438 of file rlm_redis_ippool.c.
|
static |
Definition at line 448 of file rlm_redis_ippool.c.
|
static |
Definition at line 2676 of file rlm_redis_ippool.c.
|
static |
Definition at line 2992 of file rlm_redis_ippool.c.
|
static |
Definition at line 2884 of file rlm_redis_ippool.c.
|
static |
Definition at line 2781 of file rlm_redis_ippool.c.
|
static |
Definition at line 3100 of file rlm_redis_ippool.c.
|
static |
Definition at line 395 of file rlm_redis_ippool.c.
| module_rlm_t rlm_redis_ippool |
Definition at line 3374 of file rlm_redis_ippool.c.
| fr_dict_autoload_t rlm_redis_ippool_dict |
Definition at line 62 of file rlm_redis_ippool.c.
| fr_dict_attr_autoload_t rlm_redis_ippool_dict_attr |
Definition at line 94 of file rlm_redis_ippool.c.
1.9.8