Added rad_recv_header() function, which calls MSG_PEEK on the
authoraland <aland>
Fri, 20 Apr 2007 08:48:54 +0000 (08:48 +0000)
committeraland <aland>
Fri, 20 Apr 2007 08:48:54 +0000 (08:48 +0000)
commitee7084c9253526ec9767724dc2c778f3a79214cc
tree7971637e0e290cd391e207b894863d1ef78ac555
parente48799bd78226223d00b18d82e1bb7f2116aabbc
Added rad_recv_header() function, which calls MSG_PEEK on the
socket to get the header, and the source IP.  This allows us
to perform some basic sanity checks, like "known client" before
we allocate memory for the packet.

This slows the server down slightly for normal cases, but can
greatly improve its robustness to DoS attacks.  As of now, it
logs *nothing* and allocates *no* memory on a DoS, so it should
be able to deal with them pretty well.

The rad_recv_header() function also returns the size of the packet
(taken from the header), which can permit us in the future to
minimize the number of memory allocations we make.
src/include/libradius.h
src/lib/radius.c
src/main/listen.c