The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Read ISC DHCP configuration files. More...
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/dhcpv4/dhcpv4.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/server/map_proc.h>
Go to the source code of this file.
Data Structures | |
struct | isc_host_ether_t |
struct | isc_host_uid_t |
struct | rlm_isc_dhcp_cmd_t |
Describes the commands that we accept, including it's syntax (i.e. More... | |
struct | rlm_isc_dhcp_info_s |
Holds information about the thing we parsed. More... | |
struct | rlm_isc_dhcp_t |
struct | rlm_isc_dhcp_tokenizer_t |
Holds the state of the current tokenizer. More... | |
Macros | |
#define | DDEBUG(...) |
#define | IDEBUG if (state->debug) DEBUG |
#define | isc_ignore ISC_IGNORE, NULL, NULL |
#define | isc_invalid ISC_INVALID, NULL, NULL |
#define | isc_not_done ISC_NOOP, NULL, NULL |
#define | MAYBE_SEMICOLON (2) |
#define | member_size(type, member) sizeof(((type *)0)->member) |
#define | NO_SEMICOLON (0) |
#define | TYPE_CHECK(name, type) if ((state->token_len == (sizeof(name) - 1)) && (memcmp(state->token, name, sizeof(name) - 1) == 0)) return type |
Parse one type string. More... | |
#define | vb_ipv4addr vb_ip.addr.v4.s_addr |
#define | YES_SEMICOLON (1) |
Typedefs | |
typedef int(* | rlm_isc_dhcp_apply_t) (rlm_isc_dhcp_t const *inst, request_t *request, rlm_isc_dhcp_info_t *info) |
typedef struct rlm_isc_dhcp_info_s | rlm_isc_dhcp_info_t |
typedef int(* | rlm_isc_dhcp_parse_t) (rlm_isc_dhcp_tokenizer_t *state, rlm_isc_dhcp_info_t *info) |
typedef enum rlm_isc_dhcp_type_t | rlm_isc_dhcp_type_t |
Enumerations | |
enum | rlm_isc_dhcp_type_t { ISC_INVALID = 0 , ISC_NOOP , ISC_IGNORE , ISC_GROUP , ISC_HOST , ISC_SUBNET , ISC_OPTION , ISC_HARDWARE_ETHERNET , ISC_FIXED_ADDRESS } |
Variables | |
static fr_dict_attr_t const * | attr_boot_filename |
static fr_dict_attr_t const * | attr_client_hardware_address |
static fr_dict_attr_t const * | attr_client_identifier |
static fr_dict_attr_t const * | attr_server_identifier |
static fr_dict_attr_t const * | attr_server_ip_address |
static fr_dict_attr_t const * | attr_server_name |
static fr_dict_attr_t const * | attr_your_ip_address |
static const rlm_isc_dhcp_cmd_t | commands [] |
Table of commands that we allow. More... | |
static fr_dict_t const * | dict_dhcpv4 |
static const conf_parser_t | module_config [] |
module_rlm_t | rlm_isc_dhcp |
fr_dict_autoload_t | rlm_isc_dhcp_dict [] |
fr_dict_attr_autoload_t | rlm_isc_dhcp_dict_attr [] |
static char const * | spaces = " " |
Read ISC DHCP configuration files.
Definition in file rlm_isc_dhcp.c.
struct isc_host_ether_t |
Definition at line 761 of file rlm_isc_dhcp.c.
Data Fields | ||
---|---|---|
uint8_t | ether[6] | |
rlm_isc_dhcp_info_t * | host |
struct isc_host_uid_t |
Definition at line 783 of file rlm_isc_dhcp.c.
Data Fields | ||
---|---|---|
fr_value_box_t * | client | |
rlm_isc_dhcp_info_t * | host |
struct rlm_isc_dhcp_cmd_t |
Describes the commands that we accept, including it's syntax (i.e.
name), etc.
Definition at line 166 of file rlm_isc_dhcp.c.
Data Fields | ||
---|---|---|
rlm_isc_dhcp_apply_t | apply | |
int | max_argc | |
char const * | name | |
rlm_isc_dhcp_parse_t | parse | |
rlm_isc_dhcp_type_t | type |
struct rlm_isc_dhcp_info_s |
Holds information about the thing we parsed.
Note that this parser is forgiving. We would rather accept things ISC DHCP doesn't accept, than reject things it accepts. Since we only implement a tiny portion of it's configuration, we tend to accept all kinds of things, and then just ignore them.
Definition at line 182 of file rlm_isc_dhcp.c.
Data Fields | ||
---|---|---|
int | argc | |
fr_value_box_t ** | argv | |
rlm_isc_dhcp_info_t * | child | |
rlm_isc_dhcp_cmd_t const * | cmd | |
void * | data | per-thing parsed data. |
fr_hash_table_t * | hosts_by_ether | by MAC address |
fr_hash_table_t * | hosts_by_uid | by client identifier |
rlm_isc_dhcp_info_t ** | last | pointer to last child |
rlm_isc_dhcp_info_t * | next | |
fr_pair_list_t | options | DHCP options. |
rlm_isc_dhcp_info_t * | parent | |
fr_trie_t * | subnets |
struct rlm_isc_dhcp_t |
Definition at line 76 of file rlm_isc_dhcp.c.
Data Fields | ||
---|---|---|
bool | debug | |
char const * | filename | |
rlm_isc_dhcp_info_t * | head | |
fr_hash_table_t * | hosts_by_ether | by MAC address |
fr_hash_table_t * | hosts_by_uid | by client identifier |
bool | pedantic |
struct rlm_isc_dhcp_tokenizer_t |
Holds the state of the current tokenizer.
Definition at line 124 of file rlm_isc_dhcp.c.
Data Fields | ||
---|---|---|
bool | allow_eof | do we allow EOF? (i.e. braces == 0) |
int | braces | how many levels deep we are in a { ... } |
char * | buffer | read buffer |
size_t | bufsize | size of read buffer |
bool | debug | internal developer debugging |
bool | eof | are we at EOF? |
char const * | filename | |
FILE * | fp | |
rlm_isc_dhcp_t * | inst | module instance |
char * | line | where the current line started |
int | lineno | |
char * | ptr | pointer into read buffer |
bool | saw_semicolon | whether we saw a semicolon |
char | string[256] | double quoted strings go here, so we don't mangle the input buffer |
char * | token | current token that we parsed |
size_t | token_len | length of the token |
#define DDEBUG | ( | ... | ) |
Definition at line 109 of file rlm_isc_dhcp.c.
Definition at line 104 of file rlm_isc_dhcp.c.
#define isc_ignore ISC_IGNORE, NULL, NULL |
Definition at line 1909 of file rlm_isc_dhcp.c.
#define isc_invalid ISC_INVALID, NULL, NULL |
Definition at line 1910 of file rlm_isc_dhcp.c.
Definition at line 1908 of file rlm_isc_dhcp.c.
#define MAYBE_SEMICOLON (2) |
Definition at line 67 of file rlm_isc_dhcp.c.
Definition at line 1672 of file rlm_isc_dhcp.c.
#define NO_SEMICOLON (0) |
Definition at line 65 of file rlm_isc_dhcp.c.
#define TYPE_CHECK | ( | name, | |
type | |||
) | if ((state->token_len == (sizeof(name) - 1)) && (memcmp(state->token, name, sizeof(name) - 1) == 0)) return type |
Parse one type string.
boolean [signed|unsigned] integer [width] width is 8, 16, or 32 ip-address ip6-address text string domain-list [compressed] encapsulate _identifier_
Definition at line 832 of file rlm_isc_dhcp.c.
#define vb_ipv4addr vb_ip.addr.v4.s_addr |
Definition at line 1521 of file rlm_isc_dhcp.c.
#define YES_SEMICOLON (1) |
Definition at line 66 of file rlm_isc_dhcp.c.
typedef int(* rlm_isc_dhcp_apply_t) (rlm_isc_dhcp_t const *inst, request_t *request, rlm_isc_dhcp_info_t *info) |
Definition at line 149 of file rlm_isc_dhcp.c.
typedef struct rlm_isc_dhcp_info_s rlm_isc_dhcp_info_t |
Definition at line 51 of file rlm_isc_dhcp.c.
typedef int(* rlm_isc_dhcp_parse_t) (rlm_isc_dhcp_tokenizer_t *state, rlm_isc_dhcp_info_t *info) |
Definition at line 148 of file rlm_isc_dhcp.c.
typedef enum rlm_isc_dhcp_type_t rlm_isc_dhcp_type_t |
enum rlm_isc_dhcp_type_t |
Definition at line 151 of file rlm_isc_dhcp.c.
|
static |
Definition at line 1654 of file rlm_isc_dhcp.c.
|
static |
Apply all rules except fixed IP.
Definition at line 1792 of file rlm_isc_dhcp.c.
|
static |
Apply fixed IPs.
Definition at line 1742 of file rlm_isc_dhcp.c.
|
static |
Definition at line 1606 of file rlm_isc_dhcp.c.
|
static |
|
static |
Definition at line 766 of file rlm_isc_dhcp.c.
|
static |
|
static |
Definition at line 788 of file rlm_isc_dhcp.c.
|
static |
|
static |
Definition at line 1150 of file rlm_isc_dhcp.c.
|
static |
Recursively match subwords inside of a command string.
Definition at line 532 of file rlm_isc_dhcp.c.
|
static |
|
static |
|
static |
|
static |
filename STRING
Definition at line 1677 of file rlm_isc_dhcp.c.
|
static |
host NAME { ...
}
Hosts are global, and are keyed by MAC `hardware ethernet`, and by `client-identifier`.
Definition at line 1374 of file rlm_isc_dhcp.c.
|
static |
|
static |
next-server IPADDR
Definition at line 1714 of file rlm_isc_dhcp.c.
|
static |
Definition at line 997 of file rlm_isc_dhcp.c.
|
static |
option new-name code new-code = definition ;
"new-name" can also be SPACE.NAME
Definition at line 852 of file rlm_isc_dhcp.c.
|
static |
option space name [ [ code width number ] [ length width number ] [ hash size number ] ] ;
Definition at line 808 of file rlm_isc_dhcp.c.
|
static |
Parse "option" command.
In any sane system, commands which do different things should have different names. In this syntax, it's all miracles and unicorns. option NAME VALUE ; option new-name code new-code = definition ; option space name [ [ code width number ] [ length width number ] [ hash size number ] ] ;
Definition at line 1071 of file rlm_isc_dhcp.c.
|
static |
Parse a section { ...
}
Definition at line 2042 of file rlm_isc_dhcp.c.
|
static |
server-identifier IPADDR
This is really "option dhcp-server-identifier IPADDR" But whatever
Definition at line 1706 of file rlm_isc_dhcp.c.
|
static |
server-name STRING
Definition at line 1690 of file rlm_isc_dhcp.c.
|
static |
subnet IPADDR netmask MASK { ...
}
Definition at line 1526 of file rlm_isc_dhcp.c.
|
static |
Open a file and read it into a parent.
Definition at line 2103 of file rlm_isc_dhcp.c.
|
static |
Definition at line 296 of file rlm_isc_dhcp.c.
|
static |
Reads one token into state->token.
Note that this function *destroys* the input buffer. So if you need to read two tokens, you have to save the first one somewhere *outside* of the input buffer.
Definition at line 342 of file rlm_isc_dhcp.c.
|
static |
Refills the read buffer with one line from the file.
This function also takes care of suppressing blank lines, and lines which only contain comments.
Definition at line 212 of file rlm_isc_dhcp.c.
|
static |
Definition at line 257 of file rlm_isc_dhcp.c.
|
static |
Definition at line 46 of file rlm_isc_dhcp.c.
|
static |
Definition at line 42 of file rlm_isc_dhcp.c.
|
static |
Definition at line 44 of file rlm_isc_dhcp.c.
|
static |
Definition at line 48 of file rlm_isc_dhcp.c.
|
static |
Definition at line 47 of file rlm_isc_dhcp.c.
|
static |
Definition at line 45 of file rlm_isc_dhcp.c.
|
static |
Definition at line 43 of file rlm_isc_dhcp.c.
|
static |
Table of commands that we allow.
Definition at line 1916 of file rlm_isc_dhcp.c.
|
static |
Definition at line 34 of file rlm_isc_dhcp.c.
|
static |
Definition at line 97 of file rlm_isc_dhcp.c.
module_rlm_t rlm_isc_dhcp |
Definition at line 2235 of file rlm_isc_dhcp.c.
fr_dict_autoload_t rlm_isc_dhcp_dict |
Definition at line 37 of file rlm_isc_dhcp.c.
fr_dict_attr_autoload_t rlm_isc_dhcp_dict_attr |
Definition at line 51 of file rlm_isc_dhcp.c.
|
static |
Definition at line 205 of file rlm_isc_dhcp.c.