26 RCSIDH(dhcp_h,
"$Id: ccd4976e6e62129e2296fc9db32c33ed27714112 $")
32 #include <freeradius-devel/util/packet.h>
33 #include <freeradius-devel/util/dns.h>
35 #define DNS_MAX_ATTRIBUTES 255
39 #ifdef WORDS_BIGENDIAN
40 unsigned int query : 1;
41 unsigned int opcode : 4;
42 unsigned int authoritative : 1;
43 unsigned int truncated : 1;
44 unsigned int recursion_desired : 1;
53 #ifdef WORDS_BIGENDIAN
54 unsigned int recursion_available : 1;
55 unsigned int reserved : 1;
56 unsigned int authentic_data : 1;
57 unsigned int checking_disabled : 1;
58 unsigned int rcode : 4;
130 #define FR_DNS_PACKET_CODE_VALID(_code) (((_code) < FR_DNS_CODE_MAX) || (((_code & 0x10) != 0) && ((_code & ~0x10) < FR_DNS_CODE_MAX)))
132 #define DNS_HDR_LEN (12)
151 #define fr_dns_flag_dns_label(_da) (fr_dns_attr_flags(_da)->dns_label)
152 #define fr_dns_flag_dns_label_uncompressed(_da) (fr_dns_attr_flags(_da)->dns_label_uncompressed)
@ FR_DICT_ATTR_EXT_PROTOCOL_SPECIFIC
Protocol specific extensions.
static void * fr_dict_attr_ext(fr_dict_attr_t const *da, fr_dict_attr_ext_t ext)
static fr_internal_encode_ctx_t encode_ctx
ssize_t fr_dns_encode(fr_dbuff_t *dbuff, fr_pair_list_t *vps, fr_dns_ctx_t *encode_ctx)
Encode a DNS packet.
int fr_dns_global_init(void)
Resolve/cache attributes in the DNS dictionary.
static fr_dns_attr_flags_t const * fr_dns_attr_flags(fr_dict_attr_t const *da)
static bool fr_dns_flag_dns_label_any(fr_dict_attr_t const *da)
@ FR_DNS_STATEFUL_OPERATION_RESPONSE
@ FR_DNS_STATEFUL_OPERATION
@ FR_DNS_INVERSE_QUERY_RESPONSE
unsigned int authentic_data
TALLOC_CTX * tmp_ctx
for temporary things cleaned up during decoding
ssize_t fr_dns_decode(TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *packet, size_t packet_len, fr_dns_ctx_t *packet_ctx)
Decode a DNS packet.
size_t fr_dns_reason_fail_table_len
void fr_dns_global_free(void)
fr_dns_labels_t * fr_dns_labels_get(uint8_t const *packet, size_t packet_len, bool init_mark)
char const * fr_dns_packet_names[FR_DNS_CODE_MAX]
uint8_t const * packet
DNS labels can point anywhere in the packet :(.
bool dns_label_uncompressed
@ FR_DNS_DECODE_FAIL_ANSWERS_IN_QUESTION
@ FR_DNS_DECODE_FAIL_TOO_MANY_RRS
@ FR_DNS_DECODE_FAIL_RR_OVERFLOWS_PACKET
@ FR_DNS_DECODE_FAIL_INVALID_RR_LABEL
@ FR_DNS_DECODE_FAIL_POINTER_TO_NON_LABEL
@ FR_DNS_DECODE_FAIL_INVALID_POINTER
@ FR_DNS_DECODE_FAIL_POINTER_OVERFLOWS_PACKET
@ FR_DNS_DECODE_FAIL_LABEL_OVERFLOWS_PACKET
@ FR_DNS_DECODE_FAIL_MISSING_TLV_HEADER
@ FR_DNS_DECODE_FAIL_UNEXPECTED
@ FR_DNS_DECODE_FAIL_POINTER_TO_HEADER
@ FR_DNS_DECODE_FAIL_ZERO_RR_LEN
@ FR_DNS_DECODE_FAIL_LABEL_TOO_LONG
@ FR_DNS_DECODE_FAIL_TOO_FEW_RRS
@ FR_DNS_DECODE_FAIL_MISSING_RR_LEN
@ FR_DNS_DECODE_FAIL_MISSING_QD_HEADER
@ FR_DNS_DECODE_FAIL_MAX_LENGTH_PACKET
@ FR_DNS_DECODE_FAIL_NS_IN_QUESTION
@ FR_DNS_DECODE_FAIL_NO_QUESTIONS
@ FR_DNS_DECODE_FAIL_NONE
@ FR_DNS_DECODE_FAIL_TLV_OVERFLOWS_RR
@ FR_DNS_DECODE_FAIL_POINTER_LOOPS
@ FR_DNS_DECODE_FAIL_MISSING_RR_HEADER
@ FR_DNS_DECODE_FAIL_MIN_LENGTH_PACKET
unsigned int authoritative
fr_table_num_ordered_t fr_dns_reason_fail_table[]
bool fr_dns_packet_ok(uint8_t const *packet, size_t packet_len, bool query, fr_dns_decode_fail_t *reason)
unsigned int checking_disabled
unsigned int recursion_available
unsigned int recursion_desired
An element in an arbitrarily ordered array of name to num mappings.
static size_t char ** out