created libradius shared by eap-radius and tnc-pdp plugins

This commit is contained in:
Andreas Steffen 2011-11-18 19:42:05 +01:00
parent 70fd2d1af7
commit 21b0f216b9
5 changed files with 21 additions and 3 deletions

View File

@ -254,7 +254,7 @@ if test x$eap_tls = xtrue -o x$eap_ttls = xtrue -o x$eap_peap = xtrue; then
tls=true;
fi
if test x$eap_radius = xtrue -o x$radattr = xtrue; then
if test x$eap_radius = xtrue -o x$radattr = xtrue -o x$tnc_pdp = xtrue; then
radius=true;
fi

View File

@ -9,6 +9,8 @@ noinst_LTLIBRARIES = libstrongswan-eap-radius.la
else
libstrongswan_eap_radius_la_LIBADD = $(top_builddir)/src/libradius/libradius.la
plugin_LTLIBRARIES = libstrongswan-eap-radius.la
libstrongswan_eap_radius_la_LIBADD = \
$(top_builddir)/src/libradius/libradius.la
endif
libstrongswan_eap_radius_la_SOURCES = \

View File

@ -2,7 +2,8 @@
INCLUDES = \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libhydra \
-I$(top_srcdir)/src/libcharon
-I$(top_srcdir)/src/libcharon \
-I$(top_srcdir)/src/libradius
AM_CFLAGS = -rdynamic
@ -11,6 +12,7 @@ noinst_LTLIBRARIES = libstrongswan-tnc-pdp.la
else
plugin_LTLIBRARIES = libstrongswan-tnc-pdp.la
libstrongswan_tnc_pdp_la_LIBADD = \
$(top_builddir)/src/libradius/libradius.la \
$(top_builddir)/src/libtls/libtls.la \
$(top_builddir)/src/libtnccs/libtnccs.la
endif

View File

@ -18,6 +18,8 @@
#include <errno.h>
#include <unistd.h>
#include <radius_message.h>
#include <daemon.h>
#include <debug.h>
#include <threading/thread.h>
@ -28,7 +30,7 @@ typedef struct private_tnc_pdp_t private_tnc_pdp_t;
/**
* Maximum size of a RADIUS IP packet
*/
#define MAX_PACKET 2048
#define MAX_PACKET 4096
/**
* private data of tnc_pdp_t
@ -128,6 +130,7 @@ static job_requeue_t receive(private_tnc_pdp_t *this)
{
while (TRUE)
{
radius_message_t *request;
char buffer[MAX_PACKET];
int max_fd = 0, selected = 0, bytes_read = 0;
fd_set rfds;
@ -198,6 +201,16 @@ static job_requeue_t receive(private_tnc_pdp_t *this)
source = host_create_from_sockaddr((sockaddr_t*)&src);
DBG2(DBG_NET, "received RADIUS packet from %#H", source);
DBG3(DBG_NET, "%b", buffer, bytes_read);
request = radius_message_parse_response(chunk_create(buffer, bytes_read));
if (request)
{
DBG2(DBG_NET, "received valid RADIUS message");
request->destroy(request);
}
else
{
DBG1(DBG_NET, "received invalid RADIUS message, ignored");
}
source->destroy(source);
}
return JOB_REQUEUE_FAIR;

View File

@ -7,3 +7,4 @@ libradius_la_SOURCES = \
radius_socket.h radius_socket.c \
radius_client.h radius_client.c \
radius_config.h radius_config.c