#include <freeradius-devel/dhcpv4/dhcpv4.h>
#include <freeradius-devel/dhcpv4.h>
+static fr_dict_t const *dict_dhcpv4;
+
+extern fr_dict_autoload_t proto_dhcpv4_dict[];
+fr_dict_autoload_t proto_dhcpv4_dict[] = {
+ { .out = &dict_dhcpv4, .proto = "dhcpv4" },
+ { NULL }
+};
+
+static fr_dict_attr_t const *attr_dhcpv4_message_type;
+
+extern fr_dict_attr_autoload_t proto_dhcpv4_dict_attr[];
+fr_dict_attr_autoload_t proto_dhcpv4_dict_attr[] = {
+ { .out = &attr_dhcpv4_message_type, .name = "DHCP-Message-Type", .type = FR_TYPE_UINT8, .dict = &dict_dhcpv4},
+ { NULL }
+};
+
static int reply_ok[FR_DHCP_INFORM + 1] = {
[0] = FR_DHCP_MESSAGE_TYPE_VALUE_DHCP_DO_NOT_RESPOND,
[FR_DHCP_DISCOVER] = FR_DHCP_OFFER,
switch (request->request_state) {
case REQUEST_INIT:
- log_request(L_DBG, L_DBG_LVL_1, request, "Received %s ID %08x",
- dhcp_message_types[request->packet->code], request->packet->id);
+ RDEBUG("Received %s ID %08x", dhcp_message_types[request->packet->code], request->packet->id);
log_request_proto_pair_list(L_DBG_LVL_1, request, request->packet->vps, "");
request->component = "dhcpv4";
- da = fr_dict_attr_by_num(NULL, DHCP_MAGIC_VENDOR, FR_DHCP_MESSAGE_TYPE);
- rad_assert(da != NULL);
- dv = fr_dict_enum_by_value(da, fr_box_uint32(request->packet->code));
+ dv = fr_dict_enum_by_value(attr_dhcpv4_message_type, fr_box_uint32(request->packet->code));
if (!dv) {
REDEBUG("Failed to find value for &request:DHCP-Message-Type");
return FR_IO_FAIL;
rad_assert(request->log.unlang_indent == 0);
- if (!da) da = fr_dict_attr_by_num(NULL, DHCP_MAGIC_VENDOR, FR_DHCP_MESSAGE_TYPE);
- rad_assert(da != NULL);
-
/*
* Allow the admin to explicitly set the reply
* type.
*/
- vp = fr_pair_find_by_num(request->reply->vps, DHCP_MAGIC_VENDOR, FR_DHCP_MESSAGE_TYPE, TAG_ANY);
+ vp = fr_pair_find_by_da(request->reply->vps, attr_dhcpv4_message_type, TAG_ANY);
if (vp) {
request->reply->code = vp->vp_uint8;
- } else
-
- switch (rcode) {
+ } else switch (rcode) {
case RLM_MODULE_NOOP:
case RLM_MODULE_OK:
case RLM_MODULE_UPDATED:
* the NAK section.
*/
if (request->reply->code != FR_DHCP_MESSAGE_TYPE_VALUE_DHCP_DO_NOT_RESPOND) {
- if (!da) da = fr_dict_attr_by_num(NULL, DHCP_MAGIC_VENDOR, FR_DHCP_MESSAGE_TYPE);
- rad_assert(da != NULL);
-
- dv = fr_dict_enum_by_value(da, fr_box_uint32(request->reply->code));
- RWDEBUG("Failed running 'send %s', trying 'send Do-Not-Respond'.", dv->alias);
+ dv = fr_dict_enum_by_value(attr_dhcpv4_message_type, fr_box_uint32(request->reply->code));
+ RWDEBUG("Failed running 'send %s', trying 'send Do-Not-Respond'", dv->alias);
request->reply->code = FR_DHCP_MESSAGE_TYPE_VALUE_DHCP_DO_NOT_RESPOND;
* Check for "do not respond".
*/
if (request->reply->code == FR_DHCP_MESSAGE_TYPE_VALUE_DHCP_DO_NOT_RESPOND) {
- RDEBUG("Not sending reply to client.");
+ RDEBUG("Not sending reply to client");
return FR_IO_DONE;
}