Work in progress...

FossilOrigin-Name: 5502c7d7b329b01ff3a42bedb84a087e3bb62e80a7f22ca4abb5a1d0f3db1454
This commit is contained in:
7u83@mail.ru 2015-02-07 09:57:58 +00:00
parent 64fe08312c
commit e74e8bbf89
7 changed files with 31 additions and 76 deletions

View File

@ -1,6 +1,7 @@
#Define SSL Library: OPENSSL or GNUTLS (GNUTLS not supported for now) #Define SSL Library: OPENSSL or GNUTLS (GNUTLS not supported for now)
SSL_LIBRARY=OPENSSL SSL_LIBRARY=GNUTLS
#SSL_LIBRARY=OPENSSL
# use openssl library in ../contrib/ # use openssl library in ../contrib/
USE_CONTRIB_OPENSSL=1 USE_CONTRIB_OPENSSL=1

View File

@ -88,19 +88,24 @@
# dbg # dbg
# Set debug level # Set debug level
# #
# dbg = info - show all kind of infos # dbg = info # Show all kind of infos
# dbg += msg - capwap messages # dbg += msg # CAPWAP messages
# dbg += msgelem - capwap message elements # dbg += msgelem # CAPWAP message elements
# dbg += msgelem_dmp - print hex dump for capwap messages elements # dbg += msgelem_dmp # Print hex dump for capwap messages elements
# dbg += rfc - show warnings if capwap messages don't conform to capwap RFC # dbg += rfc # Show warnings if CAPWAP messages don't conform to RFC
# dbg += pkt - capwap packets sent over the network # dbg += pkt_in # CAPWAP packets received
# dpg += pkt_dmp - hex dump capwap packets # dbg += pkt_out # CAPWAP packets sent
# dbg += pkt_err - show messages about malformed packets when detected # dbg += pkt # CAPWAP packets both sent and received
# dbg += msg_err - be verbose about capwap message errors like re-transmission # dpg += pkt_dmp # Hex dump CAPWAP packets.
# dbg += dtls - show messages concerning DTLS # dbg += pkt_err # Show messages about malformed packets when detected
# dbg += msg_err # Be verbose about capwap message errors like re-transmission
# dbg += dtls # Messages concerning DTLS
# dbg += dtls_detail # DTLS in more detail
# dbg += dtls_bio # DTLS BIO operations
# dbg += dtls_bio_dmp # Hey dump data in BIO operations
# #
# dbg += all - all of the above # dbg += all # all of the above
# dbg += err - like dbg_err and pkt_err # dbg += err # Same as dbg_err and pkt_err
# #
# Default: # Default:
# dbg= # dbg=

View File

@ -213,11 +213,12 @@ int ac_run()
void process_cw_ctrl_packet(int index,struct sockaddr * addr, uint8_t * buffer, int len) void process_cw_ctrl_packet(int index,struct sockaddr * addr, uint8_t * buffer, int len)
{ {
int sock = socklist[index].reply_sockfd; int sock = socklist[index].reply_sockfd;
char hdrstr[1024]; char hdrstr[1024];
hdr_print(hdrstr,buffer,len); hdr_print(hdrstr,buffer,len);
cw_log_debug2("Header for packet from %s\n%s",sock_addr2str(addr),hdrstr); cw_dbg(DBG_CW_PKT_IN,"Header for packet from %s\n%s",sock_addr2str(addr),hdrstr);
@ -229,7 +230,7 @@ void process_cw_ctrl_packet(int index,struct sockaddr * addr, uint8_t * buffer,
#else #else
if (preamble != CAPWAP_PACKET_PREAMBLE ){ if (preamble != CAPWAP_PACKET_PREAMBLE ){
#endif #endif
cw_log_debug1("Discarding packet, wrong preamble, preamble = 0x%01X",preamble); cw_dbg(DBG_CW_PKT_ERR,"Discarding packet, wrong preamble, preamble = 0x%01X",preamble);
return; return;
} }
@ -340,7 +341,7 @@ void process_ctrl_packet(int index,struct sockaddr * addr, uint8_t * buffer, int
#ifdef WITH_CW_LOG_DEBUG #ifdef WITH_CW_LOG_DEBUG
char str[100]; char str[100];
sock_addrtostr(addr,str,100); sock_addrtostr(addr,str,100);
cw_log_debug1("Received packet from %s, len = %i, via %s\n",str,len, cw_dbg(DBG_CW_PKT_IN,"Received packet from %s, len = %i, via %s\n",str,len,
socklist[index].type==SOCKLIST_UNICAST_SOCKET ? "unicast":"bcast/mcast"); socklist[index].type==SOCKLIST_UNICAST_SOCKET ? "unicast":"bcast/mcast");
cw_log_debug2_dump(buffer,len,"Packet data for packet, recevied from %s",str); cw_log_debug2_dump(buffer,len,"Packet data for packet, recevied from %s",str);
#endif #endif

View File

@ -33,7 +33,7 @@ uint8_t conf_macaddress[12];
uint8_t conf_macaddress_len=0; uint8_t conf_macaddress_len=0;
const const char * conf_acname = NULL; const char * conf_acname = NULL;
int conf_acname_len = 0; int conf_acname_len = 0;
char * conf_acid = NULL; char * conf_acid = NULL;
@ -531,62 +531,8 @@ static int conf_read_dbg_level(cfg_t *cfg)
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
char * str = cfg_getnstr(cfg,name,i); char * str = cfg_getnstr(cfg,name,i);
if (!strcmp(str,"info")){
cw_dbg_opt_level|=DBG_CW_INFO;
continue;
}
if (!strcmp(str,"msg")){
cw_dbg_opt_level|=DBG_CW_MSG;
continue;
}
if (!strcmp(str,"msgelem")){
cw_dbg_opt_level|=DBG_CW_MSGELEM;
continue;
}
if (!strcmp(str,"msgelem_dmp")){
cw_dbg_opt_level|=DBG_CW_MSGELEM_DMP;
continue;
}
if (!strcmp(str,"rfc")){
cw_dbg_opt_level|=DBG_CW_RFC;
continue;
}
if (!strcmp(str,"pkt")){
cw_dbg_opt_level|=DBG_CW_PKT;
continue;
}
if (!strcmp(str,"pkt_dmp")){
cw_dbg_opt_level|=DBG_CW_PKT_DMP;
continue;
}
if (!strcmp(str,"pkt_err")){
cw_dbg_opt_level|=DBG_CW_PKT_ERR;
continue;
}
if (!strcmp(str,"msg_err")){
cw_dbg_opt_level|=DBG_CW_MSG_ERR;
continue;
}
if (!strcmp(str,"dtls")){
cw_dbg_opt_level|=DBG_DTLS;
continue;
}
if (!strcmp(str,"all")){
cw_dbg_opt_level|=DBG_ALL;
continue;
}
if (!strcmp(str,"err")){
cw_dbg_opt_level|=DBG_ERR;
continue;
}
cw_dbg_opt_level|=cw_log_str2dbglevel(str);
} }
return 1; return 1;

View File

@ -878,11 +878,11 @@ void wtpman_lw_addpacket(struct wtpman *wtpman, uint8_t *packet, int len)
void wtpman_start(struct wtpman * wtpman,int dtlsmode) void wtpman_start(struct wtpman * wtpman,int dtlsmode)
{ {
if ( dtlsmode ){ if ( dtlsmode ){
cw_log_debug1("Starting wtpman in dtls mode"); cw_dbg(DBG_CW_INFO,"Starting wtpman in dtls mode");
pthread_create (&wtpman->thread, NULL, (void *) &wtpman_run, (void *) wtpman); pthread_create (&wtpman->thread, NULL, (void *) &wtpman_run, (void *) wtpman);
} }
else{ else{
cw_log_debug1("Starting wtpman in non-dtls mode"); cw_dbg(DBG_CW_INFO,"Starting wtpman in non-dtls mode");
pthread_create (&wtpman->thread, NULL, (void *) &wtpman_run_discovery, (void *) wtpman); pthread_create (&wtpman->thread, NULL, (void *) &wtpman_run_discovery, (void *) wtpman);
} }
} }

View File

@ -127,7 +127,7 @@ static int process_message(struct conn * conn,struct cwrmsg *cwrmsg,int (*cb)(vo
static void cw_dbg_packet(struct conn * conn, uint8_t * packet, int len) static void cw_dbg_packet(struct conn * conn, uint8_t * packet, int len)
{ {
if (!cw_dbg_is_level(DBG_CW_PKT)) if (!cw_dbg_is_level(DBG_CW_PKT_OUT))
return; return;
/* print the header */ /* print the header */
@ -136,7 +136,7 @@ static void cw_dbg_packet(struct conn * conn, uint8_t * packet, int len)
if (!cw_dbg_is_level(DBG_CW_PKT_DMP)){ if (!cw_dbg_is_level(DBG_CW_PKT_DMP)){
cw_dbg(DBG_CW_PKT,"Processing capwap packet from %s, len=%d\n%s",sock_addr2str(&conn->addr),len,hdr); cw_dbg(DBG_CW_PKT_OUT,"Processing capwap packet from %s, len=%d\n%s",sock_addr2str(&conn->addr),len,hdr);
return; return;
} }

View File

@ -60,6 +60,8 @@ static void cw_log_debug2_(const char *format, ...)
closelog(); closelog();
} }
int cw_log_debug_dump_(int level, const uint8_t * data, int len, int cw_log_debug_dump_(int level, const uint8_t * data, int len,
const char *format, ...) const char *format, ...)
{ {