26 RCSID(
"$Id: 75daba373437b0ce1565c8aab7cd95d89d6f830b $")
33 #include <freeradius-devel/io/pair.h>
34 #include <freeradius-devel/util/net.h>
35 #include <freeradius-devel/util/proto.h>
36 #include <freeradius-devel/util/udp.h>
46 { .out = &
dict_bfd, .proto =
"bfd" },
85 bfd_packet_t
const *bfd;
86 char const *
msg = NULL;
89 msg =
"Packet is too short to be BFD";
95 bfd = (bfd_packet_t
const *) packet;
101 if (bfd->version != 1) {
102 msg =
"Packet has wrong version - should be 1";
112 msg =
"Header length is too small";
123 if (bfd->length > packet_len) {
124 msg =
"Header length is not the same as the amount of data we read";
136 if (bfd->auth_present) {
138 msg =
"Header length is not enough for auth-type and auth-len";
143 msg =
"Header length mismatch with auth-len and amount of received data";
148 switch (bfd->auth.basic.auth_type) {
150 if ((bfd->auth.basic.auth_len < (3 + 1)) || (bfd->auth.basic.auth_len > (3 + 16))) {
151 msg =
"Auth-Type Simple has invalid value for password length";
158 if (bfd->auth.basic.auth_len != 24) {
159 msg =
"Auth-Type MD5 has invalid value for digest length";
166 if (bfd->auth.basic.auth_len != 28) {
167 msg =
"Auth-Type SHA1 has invalid value for digest length";
173 msg =
"Invalid Auth-Type";
181 if (bfd->detect_multi == 0) {
182 msg =
"Packet has invalid detect-multi == 0";
190 if (bfd->multipoint != 0) {
191 msg =
"Packet has invalid multipoint != 0";
199 if (bfd->my_disc == 0) {
200 msg =
"Packet has invalid my-discriminator == 0";
208 if ((bfd->your_disc == 0) &&
211 msg =
"Packet has your-discrimator==0, but state is not down or admin-down";
256 .default_type_size = 1,
257 .default_type_length = 1,
@ BFD_AUTH_MET_KEYED_SHA1
#define FR_BFD_HEADER_LENGTH
#define L(_str)
Helper for initialising arrays of string literals.
#define fr_dict_autofree(_to_free)
fr_dict_attr_t const ** out
Where to write a pointer to the resolved fr_dict_attr_t.
fr_dict_t const ** out
Where to write a pointer to the loaded/resolved fr_dict_t.
int fr_dict_attr_autoload(fr_dict_attr_autoload_t const *to_load)
Process a dict_attr_autoload element to load/verify a dictionary attribute.
#define fr_dict_autoload(_to_load)
char const * name
name of this protocol
Specifies an attribute which must be present for the module to function.
Specifies a dictionary which must be loaded/loadable for the module to function.
Protocol-specific callbacks in libfreeradius-PROTOCOL.
fr_dict_attr_t const * attr_packet_type
fr_dict_t const * dict_freeradius
@ FR_TYPE_UINT32
32 Bit unsigned integer.
@ FR_TYPE_STRUCT
like TLV, but without T or L, and fixed-width children
@ FR_TYPE_GROUP
A grouping of other attributes.
fr_dict_attr_autoload_t libfreeradius_bfd_dict_attr[]
fr_dict_attr_t const * attr_bfd_packet
char const * fr_bfd_packet_names[FR_BFD_CODE_MAX]
static uint32_t instance_count
int fr_bfd_global_init(void)
void fr_bfd_global_free(void)
size_t const bfd_auth_type_table_len
fr_dict_attr_t const * attr_bfd_additional_data
fr_dict_protocol_t libfreeradius_bfd_dict_protocol
fr_table_num_ordered_t const bfd_auth_type_table[]
bool fr_bfd_packet_ok(char const **err, uint8_t const *packet, size_t packet_len)
fr_dict_t const * dict_bfd
fr_dict_autoload_t libfreeradius_bfd_dict[]
An element in an arbitrarily ordered array of name to num mappings.