diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2011-11-18 19:42:05 +0100 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2012-03-13 16:27:17 +0100 |
commit | 21b0f216b96c56970894a8f21a03d7f3dc473259 (patch) | |
tree | b7385dadf9027cf94dc4454557c15a7ad82350b7 /src/libcharon/plugins/tnc_pdp/tnc_pdp.c | |
parent | 70fd2d1af7f02a1a5fedd0d07a6d4607d2ce3ac0 (diff) | |
download | strongswan-21b0f216b96c56970894a8f21a03d7f3dc473259.tar.bz2 strongswan-21b0f216b96c56970894a8f21a03d7f3dc473259.tar.xz |
created libradius shared by eap-radius and tnc-pdp plugins
Diffstat (limited to 'src/libcharon/plugins/tnc_pdp/tnc_pdp.c')
-rw-r--r-- | src/libcharon/plugins/tnc_pdp/tnc_pdp.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libcharon/plugins/tnc_pdp/tnc_pdp.c b/src/libcharon/plugins/tnc_pdp/tnc_pdp.c index f0cf86680..54cf4b328 100644 --- a/src/libcharon/plugins/tnc_pdp/tnc_pdp.c +++ b/src/libcharon/plugins/tnc_pdp/tnc_pdp.c @@ -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; |