From 2c07b859b9b9204db834c689e9e10b7763a5843c Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Sat, 19 Jul 2014 10:36:43 +0000 Subject: [PATCH] Added CLIENT_IP macro and output of client ips in debug logs. FossilOrigin-Name: ab35874e6979d5f00729e3d3b04ddddfc02b4e52dc010875f7e178e7d3d8769c --- src/ac/wtpman.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/ac/wtpman.c b/src/ac/wtpman.c index 511c54fe..9bc6a76f 100644 --- a/src/ac/wtpman.c +++ b/src/ac/wtpman.c @@ -8,6 +8,7 @@ #include "wtplist.h" #include "capwap.h" +#include "sock.h" #include "socklist.h" #include "conn.h" @@ -29,6 +30,10 @@ #include "capwap.h" +/* macro to convert our client ip to a string */ +#define CLIENT_IP (sock_addrtostr((struct sockaddr*)&wtpman->conn->addr, wtpman->tmpstr, sizeof(wtpman->tmpstr))) + + ACIPLIST * get_aciplist(); struct ac_info * get_acinfo(); @@ -76,6 +81,7 @@ static void wtpman_run_discovery(void *arg) } + static void wtpman_run(void *arg) { struct wtpman * wtpman = (struct wtpman *)arg; @@ -83,12 +89,12 @@ static void wtpman_run(void *arg) if (socklist[wtpman->socklistindex].type != SOCKLIST_UNICAST_SOCKET){ - cw_log_debug0("Dropping connection to non-unicast socket"); + cw_log_debug0("Dropping connection from %s to non-unicast socket", CLIENT_IP); wtpman_remove(wtpman); return; } - cw_log_debug0("Establishing DTLS connection"); + cw_log_debug0("Establishing DTLS connection from %s",CLIENT_IP); #ifdef WITH_DTLS if (!conf_dtls_psk){ @@ -101,12 +107,16 @@ static void wtpman_run(void *arg) wtpman->conn->dtls_cipher=CAPWAP_CIPHER; if ( !dtls_accept(wtpman->conn) ){ - cw_log_debug0("Error establishing DTLS connection"); + cw_log_debug0("Error establishing DTLS connection from %s",CLIENT_IP); wtpman_remove(wtpman); return; } #endif - cw_log_debug0("DTLS Session established with"); +// const struct sockaddr *sa, char *s, size_t maxlen + + cw_log_debug0("DTLS Session established with %s", CLIENT_IP); + + cwrmsg = conn_get_message(wtpman->conn); // printf("Seqnum: %i\n",cwrmsg->seqnum);