Better debug options for mods.
FossilOrigin-Name: 4fd4dd16e470f78d30afa54005a70452c95b6499c789c3bcb2a4fc73397e32f3
This commit is contained in:
parent
883c253f31
commit
5d5f22ce4e
@ -209,6 +209,7 @@
|
||||
# dbg += dtls_bio # DTLS BIO operations
|
||||
# dbg += dtls_bio_dmp # HeXy dump data in BIO operations
|
||||
# dbg += warn # misc warnings
|
||||
# dbg += mod # Debugs specific to mod
|
||||
#
|
||||
# dbg += all # all of the above
|
||||
# dbg += err # Same as dbg_err and pkt_err
|
||||
|
@ -71,6 +71,9 @@ uint32_t cw_dbg_opt_level = 0;
|
||||
#define DBG_CLR_CYAN "\x1b[36m"
|
||||
|
||||
|
||||
#define DBG_CLR_RED_I "\x1b[3;31m"
|
||||
|
||||
|
||||
static struct cw_strlist_elem color_on[] = {
|
||||
{ DBG_PKT_IN, DBG_CLR_YELLO },
|
||||
{ DBG_PKT_OUT, DBG_CLR_YELLO_I },
|
||||
@ -88,6 +91,7 @@ static struct cw_strlist_elem color_on[] = {
|
||||
{ DBG_RFC, "\x1b[31m" },
|
||||
{ DBG_X, "\x1b[31m" },
|
||||
{ DBG_WARN, DBG_CLR_CYAN },
|
||||
{ DBG_MOD, "\x1b[91m" },
|
||||
{ CW_STR_STOP, "" }
|
||||
};
|
||||
static struct cw_strlist_elem color_ontext[] = {
|
||||
@ -117,6 +121,7 @@ static struct cw_strlist_elem prefix[] = {
|
||||
{ DBG_SUBELEM," Sub-Element - "},
|
||||
{ DBG_DTLS, " DTLS - "},
|
||||
{ DBG_WARN, " Warning - "},
|
||||
{ DBG_MOD, " Mod - "},
|
||||
{ DBG_X, "XXXXX - "},
|
||||
|
||||
{ CW_STR_STOP, "" }
|
||||
|
@ -125,6 +125,9 @@ enum cw_dbg_levels{
|
||||
|
||||
/** Dump DTLS BIO i/o */
|
||||
DBG_DTLS_BIO_DMP,
|
||||
|
||||
/** Debug Mods */
|
||||
DBG_MOD,
|
||||
|
||||
DBG_X
|
||||
|
||||
|
@ -52,6 +52,7 @@ struct cw_strlist_elem cw_dbg_strings[] = {
|
||||
{ DBG_DTLS, "dtls" },
|
||||
{ DBG_DTLS_BIO, "dtls_bio" },
|
||||
{ DBG_WARN, "warn" },
|
||||
{ DBG_MOD,"mod"},
|
||||
|
||||
{ DBG_X,"dbgx" },
|
||||
{ CW_STR_STOP, NULL }
|
||||
|
@ -17,7 +17,7 @@ extern int capwap_register_actions_ac(struct cw_actiondef *def);
|
||||
|
||||
static int init()
|
||||
{
|
||||
cw_dbg(DBG_INFO, "Initialiazing mod_capwap ...");
|
||||
cw_dbg(DBG_MOD, "Initialiazing mod_capwap.");
|
||||
// int rc = capwap_register_actions_ac(&actions);
|
||||
// cw_dbg(DBG_INFO, "Initialized mod capwap with %d actions", rc);
|
||||
return 0;
|
||||
@ -29,7 +29,7 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
|
||||
{
|
||||
if (mode != MOD_DETECT_CAPWAP)
|
||||
return 0;
|
||||
|
||||
cw_dbg(DBG_MOD,"CAPWAP detected: yes");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,6 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
|
||||
{
|
||||
if (mode != MOD_DETECT_CAPWAP)
|
||||
return 0;
|
||||
|
||||
cw_log(LOG_INFO, "Detecting ...");
|
||||
conn->detected = 1;
|
||||
conn->actions = &actions;
|
||||
return 1;
|
||||
|
@ -31,9 +31,11 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
|
||||
return 0;
|
||||
|
||||
int wbid = cw_get_hdr_wbid(rawmsg);
|
||||
if (wbid != CW_WBID_IEEE80211 )
|
||||
if (wbid != CW_WBID_IEEE80211 ) {
|
||||
cw_dbg(DBG_MOD,"CAPWAP80211 detected: no, my wbid=%d, remote wbid=%d",CW_WBID_IEEE80211,wbid);
|
||||
return 0;
|
||||
|
||||
}
|
||||
cw_dbg(DBG_MOD,"CAPWAP80211 detected: yes");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
#include "cw/mod.h"
|
||||
#include "cw/log.h"
|
||||
#include "cw/dbg.h"
|
||||
|
||||
#include "mod_cipwap.h"
|
||||
|
||||
@ -14,8 +15,10 @@ int cipwap_init()
|
||||
|
||||
static int detect(struct conn *conn,const uint8_t *rawmsg, int rawlen,int elems_len, struct sockaddr *from, int mode)
|
||||
{
|
||||
if (mode != MOD_DETECT_CAPWAP)
|
||||
return 0;
|
||||
|
||||
cw_log(LOG_INFO,"Detecting ...");
|
||||
cw_dbg(DBG_MOD,"CIPWAP detected: no");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,7 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
|
||||
if (mode != MOD_DETECT_CAPWAP)
|
||||
return 0;
|
||||
|
||||
|
||||
int offset = cw_get_hdr_msg_offset(rawmsg);
|
||||
const uint8_t *msg_ptr = rawmsg + offset;
|
||||
|
||||
@ -63,6 +64,7 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
|
||||
uint32_t vendor_id = cw_get_dword(cw_get_elem_data(elem));
|
||||
if (vendor_id == CW_VENDOR_ID_CISCO) {
|
||||
conn->actions = &actions;
|
||||
cw_dbg(DBG_MOD,"CISCO detected: yes");
|
||||
return 1;
|
||||
|
||||
}
|
||||
@ -71,6 +73,7 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
|
||||
|
||||
}
|
||||
|
||||
cw_dbg(DBG_MOD,"CISCO detected: no");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -185,6 +185,8 @@ int main()
|
||||
mbag_set_byte(conn->local, CW_ITEM_WTP_MAC_TYPE, 0);
|
||||
mbag_set_byte(conn->local, CW_ITEM_WTP_FRAME_TUNNEL_MODE, 0);
|
||||
|
||||
conn->wbid=1;
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user