25RCSID(
"$Id: c8ca250f513459c54fa7978f6e18c21d3b328173 $")
 
   27#include <freeradius-devel/radius/radius.h> 
   28#include <freeradius-devel/util/syserror.h> 
   35        if (!packet) 
return NULL;
 
 
   73                if (len == 0) 
return -2; 
 
   76                if ((len < 0) && (errno == ECONNRESET)) { 
 
  102                        fr_strerror_const(
"Discarding packet: Larger than RFC limitation of 4096 bytes");
 
  106                packet->
data = talloc_array(packet, 
uint8_t, packet_len);
 
  122        if (len == 0) 
return -2; 
 
  125        if ((len < 0) && (errno == ECONNRESET)) { 
 
  144        if (!
fr_packet_ok(packet, max_attributes, require_message_authenticator, NULL)) {
 
  149                char ip_buf[INET6_ADDRSTRLEN], 
buffer[256];
 
  151                if (packet->
socket.inet.src_ipaddr.
af != AF_UNSPEC) {
 
 
static int const char char buffer[256]
fr_packet_t * fr_packet_alloc(TALLOC_CTX *ctx, bool new_vector)
Allocate a new fr_packet_t.
void fr_packet_free(fr_packet_t **packet_p)
Free a fr_packet_t.
char const * inet_ntop(int af, void const *src, char *dst, size_t cnt)
static uint16_t fr_nbo_to_uint16(uint8_t const data[static sizeof(uint16_t)])
Read an unsigned 16bit integer from wire format (big endian)
#define RADIUS_HEADER_LENGTH
bool fr_packet_ok(fr_packet_t *packet, uint32_t max_attributes, bool require_message_authenticator, fr_radius_decode_fail_t *reason)
See if the data pointed to by PTR is a valid RADIUS packet.
#define RADIUS_MAX_ATTRIBUTES
PUBLIC int snprintf(char *string, size_t length, char *format, va_alist)
#define fr_time()
Allow us to arbitrarily manipulate time.
char const * fr_syserror(int num)
Guaranteed to be thread-safe version of strerror.
fr_packet_t * fr_tcp_recv(int sockfd, int flags)
int fr_tcp_read_packet(fr_packet_t *packet, uint32_t max_attributes, bool require_message_authenticator)
fr_socket_t socket
This packet was received on.
uint8_t * data
Packet data (body).
size_t data_len
Length of packet data.
uint8_t vector[RADIUS_AUTH_VECTOR_LENGTH]
RADIUS authentication vector.
fr_time_t timestamp
When we received the packet.
int af
AF_INET, AF_INET6, or AF_UNIX.
int fd
File descriptor if this is a live socket.
#define fr_strerror_printf(_fmt,...)
Log to thread local error buffer.
#define fr_strerror_const(_msg)