Module eradius_client

This module contains a RADIUS client that can be used to send authentication and accounting requests.

Behaviours: gen_server.

Description

This module contains a RADIUS client that can be used to send authentication and accounting requests. A counter is kept for every NAS in order to determine the next request id and sender port for each outgoing request. The implementation naively assumes that you won't send requests to a distinct number of NASs over the lifetime of the VM, which is why the counters are not garbage-collected.

The client uses OS-assigned ports. The maximum number of open ports can be specified through the client_ports application environment variable, it defaults to 20. The number of ports should not be set too low. If N ports are opened, the maximum number of concurrent requests is N * 256.

The IP address used to send requests is read once (at startup) from the client_ip parameter. Changing it currently requires a restart. It can be given as a string or ip address tuple, or the atom undefined (the default), which uses whatever address the OS selects.

Data Types

nas_address()

nas_address() = {string() | binary() | inet:ip_address(), eradius_server:port_number(), eradius_lib:secret()}

options()

options() = [{retries, pos_integer()} | {timeout, timeout()} | {server_name, atom()} | {metrics_info, {atom(), atom(), atom()}}]

Function Index

find_suitable_peer/1
init_server_status_metrics/0
restore_upstream_server/1
send_remote_request/3Equivalent to send_remote_request(Node, NAS, Request, []).
send_remote_request/4Send a radius request to the given NAS through a socket on the specified node.
send_request/2Equivalent to send_request(NAS, Request, []).
send_request/3Send a radius request to the given NAS.
store_radius_server_from_pool/3

Function Details

find_suitable_peer/1

find_suitable_peer(Pool) -> any()

init_server_status_metrics/0

init_server_status_metrics() -> any()

restore_upstream_server/1

restore_upstream_server(X1) -> any()

send_remote_request/3

send_remote_request(Node::node(), NAS::nas_address(), Radius_request::#radius_request{}) -> {ok, binary()} | {error, timeout | node_down | socket_down}

Equivalent to send_remote_request(Node, NAS, Request, []).

send_remote_request/4

send_remote_request(Node::node(), X2::nas_address(), Radius_request::#radius_request{}, Options::options()) -> {ok, binary()} | {error, timeout | node_down | socket_down}

Send a radius request to the given NAS through a socket on the specified node. If no answer is received within the specified timeout, the request will be sent again. The request will not be sent again if the remote node is unreachable.

send_request/2

send_request(NAS::nas_address(), Radius_request::#radius_request{}) -> {ok, binary()} | {error, timeout | socket_down}

Equivalent to send_request(NAS, Request, []).

send_request/3

send_request(X1::nas_address(), Radius_request::#radius_request{}, Options::options()) -> {ok, binary(), eradius_lib:authenticator()} | {error, timeout | socket_down}

Send a radius request to the given NAS. If no answer is received within the specified timeout, the request will be sent again.

store_radius_server_from_pool/3

store_radius_server_from_pool(Addr, Port, Retries) -> any()


Generated by EDoc