#include <freeradius-devel/util/atexit.h>
#include <freeradius-devel/util/pair_legacy.h>
#include <freeradius-devel/util/time.h>
+#include <freeradius-devel/server/packet.h>
#include <freeradius-devel/radius/list.h>
#include <freeradius-devel/radius/radius.h>
#include <freeradius-devel/util/chap.h>
static fr_dict_attr_t const *attr_ms_chap_password;
static fr_dict_attr_t const *attr_ms_chap_response;
-static fr_dict_attr_t const *attr_packet_dst_ip_address;
-static fr_dict_attr_t const *attr_packet_dst_ipv6_address;
-static fr_dict_attr_t const *attr_packet_dst_port;
-static fr_dict_attr_t const *attr_packet_src_ip_address;
-static fr_dict_attr_t const *attr_packet_src_ipv6_address;
-static fr_dict_attr_t const *attr_packet_src_port;
-
static fr_dict_attr_t const *attr_radclient_test_name;
static fr_dict_attr_t const *attr_request_authenticator;
{ .out = &attr_ms_chap_password, .name = "Password.MS-CHAP", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
{ .out = &attr_ms_chap_response, .name = "Vendor-Specific.Microsoft.CHAP-Response", .type = FR_TYPE_OCTETS, .dict = &dict_radius },
- { .out = &attr_packet_dst_ip_address, .name = "Packet-Dst-IP-Address", .type = FR_TYPE_IPV4_ADDR, .dict = &dict_freeradius },
- { .out = &attr_packet_dst_ipv6_address, .name = "Packet-Dst-IPv6-Address", .type = FR_TYPE_IPV6_ADDR, .dict = &dict_freeradius },
- { .out = &attr_packet_dst_port, .name = "Packet-Dst-Port", .type = FR_TYPE_UINT16, .dict = &dict_freeradius },
- { .out = &attr_packet_src_ip_address, .name = "Packet-Src-IP-Address", .type = FR_TYPE_IPV4_ADDR, .dict = &dict_freeradius },
- { .out = &attr_packet_src_ipv6_address, .name = "Packet-Src-IPv6-Address", .type = FR_TYPE_IPV6_ADDR, .dict = &dict_freeradius },
- { .out = &attr_packet_src_port, .name = "Packet-Src-Port", .type = FR_TYPE_UINT16, .dict = &dict_freeradius },
{ .out = &attr_radclient_test_name, .name = "Radclient-Test-Name", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
{ .out = &attr_request_authenticator, .name = "Request-Authenticator", .type = FR_TYPE_OCTETS, .dict = &dict_freeradius },
*/
if (vp->da == attr_packet_type) {
request->packet->code = vp->vp_uint32;
- } else if (vp->da == attr_packet_dst_port) {
- request->packet->socket.inet.dst_port = vp->vp_uint16;
- } else if ((vp->da == attr_packet_dst_ip_address) ||
- (vp->da == attr_packet_dst_ipv6_address)) {
- memcpy(&request->packet->socket.inet.dst_ipaddr, &vp->vp_ip, sizeof(request->packet->socket.inet.dst_ipaddr));
- } else if (vp->da == attr_packet_src_port) {
- if (vp->vp_uint16 < 1024) {
- ERROR("Invalid value '%u' for Packet-Src-Port", vp->vp_uint16);
- goto error;
- }
- request->packet->socket.inet.src_port = vp->vp_uint16;
- } else if ((vp->da == attr_packet_src_ip_address) ||
- (vp->da == attr_packet_src_ipv6_address)) {
- memcpy(&request->packet->socket.inet.src_ipaddr, &vp->vp_ip, sizeof(request->packet->socket.inet.src_ipaddr));
} else if (vp->da == attr_request_authenticator) {
if (vp->vp_length > sizeof(request->packet->vector)) {
memcpy(request->packet->vector, vp->vp_octets, sizeof(request->packet->vector));
*/
if (request->packet->code == FR_RADIUS_CODE_UNDEFINED) request->packet->code = packet_code;
+ /*
+ * Fill in the packet header from attributes, and then
+ * re-realize the attributes.
+ */
+ fr_packet_pairs_to_packet(request->packet, &request->request_pairs);
+
/*
* Default to the filename
*/
stats.lost++;
goto packet_done;
}
-
fr_packet_log(&default_log, request->reply, &request->reply_pairs, true);
/*
"Failed to initialize the dictionaries");
exit(EXIT_FAILURE);
}
+
+ packet_global_init();
+
fr_strerror_clear(); /* Clear the error buffer */
/*
fr_radius_free();
+ packet_global_free();
+
if (fr_dict_autofree(radclient_dict) < 0) {
fr_perror("radclient");
ret = EXIT_FAILURE;