Classes | Defines | Functions
radius_client.c File Reference
#include "includes.h"
#include "common.h"
#include "radius.h"
#include "radius_client.h"
#include "eloop.h"
Include dependency graph for radius_client.c:

Go to the source code of this file.

Classes

struct  radius_client_data
struct  radius_msg_list
struct  radius_rx_handler

Defines

#define RADIUS_CLIENT_FIRST_WAIT   3
#define RADIUS_CLIENT_MAX_ENTRIES   30
#define RADIUS_CLIENT_MAX_RETRIES   10
#define RADIUS_CLIENT_MAX_WAIT   120
#define RADIUS_CLIENT_NUM_FAILOVER   4

Functions

static int radius_change_server (struct radius_client_data *radius, struct hostapd_radius_server *nserv, struct hostapd_radius_server *oserv, int sock, int sock6, int auth)
void radius_client_deinit (struct radius_client_data *radius)
static int radius_client_disable_pmtu_discovery (int s)
static int radius_client_dump_acct_server (char *buf, size_t buflen, struct hostapd_radius_server *serv, struct radius_client_data *cli)
static int radius_client_dump_auth_server (char *buf, size_t buflen, struct hostapd_radius_server *serv, struct radius_client_data *cli)
void radius_client_flush (struct radius_client_data *radius, int only_auth)
void radius_client_flush_auth (struct radius_client_data *radius, const u8 *addr)
u8 radius_client_get_id (struct radius_client_data *radius)
int radius_client_get_mib (struct radius_client_data *radius, char *buf, size_t buflen)
static void radius_client_handle_send_error (struct radius_client_data *radius, int s, RadiusType msg_type)
struct radius_client_dataradius_client_init (void *ctx, struct hostapd_radius_servers *conf)
static int radius_client_init_acct (struct radius_client_data *radius)
static int radius_client_init_auth (struct radius_client_data *radius)
static void radius_client_list_add (struct radius_client_data *radius, struct radius_msg *msg, RadiusType msg_type, const u8 *shared_secret, size_t shared_secret_len, const u8 *addr)
static void radius_client_list_del (struct radius_client_data *radius, RadiusType msg_type, const u8 *addr)
static void radius_client_msg_free (struct radius_msg_list *req)
static void radius_client_receive (int sock, void *eloop_ctx, void *sock_ctx)
int radius_client_register (struct radius_client_data *radius, RadiusType msg_type, RadiusRxResult(*handler)(struct radius_msg *msg, struct radius_msg *req, const u8 *shared_secret, size_t shared_secret_len, void *data), void *data)
static int radius_client_retransmit (struct radius_client_data *radius, struct radius_msg_list *entry, os_time_t now)
int radius_client_send (struct radius_client_data *radius, struct radius_msg *msg, RadiusType msg_type, const u8 *addr)
static void radius_client_timer (void *eloop_ctx, void *timeout_ctx)
static void radius_client_update_acct_msgs (struct radius_client_data *radius, const u8 *shared_secret, size_t shared_secret_len)
static void radius_client_update_timeout (struct radius_client_data *radius)
static void radius_retry_primary_timer (void *eloop_ctx, void *timeout_ctx)

Define Documentation

#define RADIUS_CLIENT_FIRST_WAIT   3

RADIUS_CLIENT_FIRST_WAIT - RADIUS client timeout for first retry in seconds

Definition at line 27 of file radius_client.c.

#define RADIUS_CLIENT_MAX_ENTRIES   30

RADIUS_CLIENT_MAX_ENTRIES - RADIUS client maximum pending messages

Maximum number of entries in retransmit list (oldest entries will be removed, if this limit is exceeded).

Definition at line 48 of file radius_client.c.

#define RADIUS_CLIENT_MAX_RETRIES   10

RADIUS_CLIENT_MAX_RETRIES - RADIUS client maximum retries

Maximum number of retransmit attempts before the entry is removed from retransmit list.

Definition at line 40 of file radius_client.c.

#define RADIUS_CLIENT_MAX_WAIT   120

RADIUS_CLIENT_MAX_WAIT - RADIUS client maximum retry timeout in seconds

Definition at line 32 of file radius_client.c.

RADIUS_CLIENT_NUM_FAILOVER - RADIUS client failover point

The number of failed retry attempts after which the RADIUS server will be changed (if one of more backup servers are configured).

Definition at line 56 of file radius_client.c.


Function Documentation

static int radius_change_server ( struct radius_client_data radius,
struct hostapd_radius_server nserv,
struct hostapd_radius_server oserv,
int  sock,
int  sock6,
int  auth 
) [static]

Definition at line 940 of file radius_client.c.

void radius_client_deinit ( struct radius_client_data radius)

radius_client_deinit - Deinitialize RADIUS client : RADIUS client context from radius_client_init()

Definition at line 1291 of file radius_client.c.

static int radius_client_disable_pmtu_discovery ( int  s) [static]

Definition at line 1123 of file radius_client.c.

static int radius_client_dump_acct_server ( char *  buf,
size_t  buflen,
struct hostapd_radius_server serv,
struct radius_client_data cli 
) [static]

Definition at line 1409 of file radius_client.c.

static int radius_client_dump_auth_server ( char *  buf,
size_t  buflen,
struct hostapd_radius_server serv,
struct radius_client_data cli 
) [static]

Definition at line 1360 of file radius_client.c.

void radius_client_flush ( struct radius_client_data radius,
int  only_auth 
)

radius_client_flush - Flush all pending RADIUS client messages : RADIUS client context from radius_client_init() : Whether only authentication messages are removed

Definition at line 887 of file radius_client.c.

void radius_client_flush_auth ( struct radius_client_data radius,
const u8 *  addr 
)

radius_client_flush_auth - Flush pending RADIUS messages for an address : RADIUS client context from radius_client_init() : MAC address of the related device

This function can be used to remove pending RADIUS authentication messages that are related to a specific device. The addr parameter is matched with the one used in radius_client_send() call that was used to transmit the authentication request.

Definition at line 1326 of file radius_client.c.

u8 radius_client_get_id ( struct radius_client_data radius)

radius_client_get_id - Get an identifier for a new RADIUS message : RADIUS client context from radius_client_init() Returns: Allocated identifier

This function is used to fetch a unique (among pending requests) identifier for a new RADIUS message.

Definition at line 847 of file radius_client.c.

int radius_client_get_mib ( struct radius_client_data radius,
char *  buf,
size_t  buflen 
)

radius_client_get_mib - Get RADIUS client MIB information : RADIUS client context from radius_client_init() : Buffer for returning MIB data in text format : Maximum buf length in octets Returns: Number of octets written into the buffer

Definition at line 1462 of file radius_client.c.

static void radius_client_handle_send_error ( struct radius_client_data radius,
int  s,
RadiusType  msg_type 
) [static]

Definition at line 304 of file radius_client.c.

struct radius_client_data* radius_client_init ( void *  ctx,
struct hostapd_radius_servers conf 
) [read]

radius_client_init - Initialize RADIUS client : Callback context to be used in hostapd_logger() calls : RADIUS client configuration (RADIUS servers) Returns: Pointer to private RADIUS client context or NULL on failure

The caller is responsible for keeping the configuration data available for the lifetime of the RADIUS client, i.e., until radius_client_deinit() is called for the returned context pointer.

Definition at line 1254 of file radius_client.c.

static int radius_client_init_acct ( struct radius_client_data radius) [static]

Definition at line 1191 of file radius_client.c.

static int radius_client_init_auth ( struct radius_client_data radius) [static]

Definition at line 1139 of file radius_client.c.

static void radius_client_list_add ( struct radius_client_data radius,
struct radius_msg msg,
RadiusType  msg_type,
const u8 *  shared_secret,
size_t  shared_secret_len,
const u8 *  addr 
) [static]

Definition at line 518 of file radius_client.c.

static void radius_client_list_del ( struct radius_client_data radius,
RadiusType  msg_type,
const u8 *  addr 
) [static]

Definition at line 572 of file radius_client.c.

static void radius_client_msg_free ( struct radius_msg_list req) [static]

Definition at line 247 of file radius_client.c.

static void radius_client_receive ( int  sock,
void *  eloop_ctx,
void *  sock_ctx 
) [static]

Definition at line 691 of file radius_client.c.

int radius_client_register ( struct radius_client_data radius,
RadiusType  msg_type,
RadiusRxResult(*)(struct radius_msg *msg, struct radius_msg *req, const u8 *shared_secret, size_t shared_secret_len, void *data)  handler,
void *  data 
)

radius_client_register - Register a RADIUS client RX handler : RADIUS client context from radius_client_init() : RADIUS client type (RADIUS_AUTH or RADIUS_ACCT) : Handler for received RADIUS messages : Context pointer for handler callbacks Returns: 0 on success, -1 on failure

This function is used to register a handler for processing received RADIUS authentication and accounting messages. The handler() callback function will be called whenever a RADIUS message is received from the active server.

There can be multiple registered RADIUS message handlers. The handlers will be called in order until one of them indicates that it has processed or queued the message.

Definition at line 270 of file radius_client.c.

static int radius_client_retransmit ( struct radius_client_data radius,
struct radius_msg_list entry,
os_time_t  now 
) [static]

Definition at line 327 of file radius_client.c.

int radius_client_send ( struct radius_client_data radius,
struct radius_msg msg,
RadiusType  msg_type,
const u8 *  addr 
)

radius_client_send - Send a RADIUS request : RADIUS client context from radius_client_init() : RADIUS message to be sent : Message type (RADIUS_AUTH, RADIUS_ACCT, RADIUS_ACCT_INTERIM) : MAC address of the device related to this message or NULL Returns: 0 on success, -1 on failure

This function is used to transmit a RADIUS authentication (RADIUS_AUTH) or accounting request (RADIUS_ACCT or RADIUS_ACCT_INTERIM). The only difference between accounting and interim accounting messages is that the interim message will override any pending interim accounting updates while a new accounting message does not remove any pending messages.

The message is added on the retransmission queue and will be retransmitted automatically until a response is received or maximum number of retries (RADIUS_CLIENT_MAX_RETRIES) is reached.

The related device MAC address can be used to identify pending messages that can be removed with radius_client_flush_auth() or with interim accounting updates.

Definition at line 627 of file radius_client.c.

static void radius_client_timer ( void *  eloop_ctx,
void *  timeout_ctx 
) [static]

Definition at line 379 of file radius_client.c.

static void radius_client_update_acct_msgs ( struct radius_client_data radius,
const u8 *  shared_secret,
size_t  shared_secret_len 
) [static]

Definition at line 919 of file radius_client.c.

static void radius_client_update_timeout ( struct radius_client_data radius) [static]

Definition at line 489 of file radius_client.c.

static void radius_retry_primary_timer ( void *  eloop_ctx,
void *  timeout_ctx 
) [static]

Definition at line 1092 of file radius_client.c.



wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Jan 2 2014 11:26:42