Debuggin with cw_decode_msg is possible
This commit is contained in:
parent
6893cfa4d4
commit
4506690fe1
@ -1,5 +1,6 @@
|
|||||||
include ../Config.default.mak
|
#include ../Config.default.mak
|
||||||
-include ../Config.mak
|
-include ../Config.mak
|
||||||
|
include ../Defs.mak
|
||||||
|
|
||||||
OBJS = \
|
OBJS = \
|
||||||
wtplist.o wtpman.o conf.o ac_main.o \
|
wtplist.o wtpman.o conf.o ac_main.o \
|
||||||
|
@ -406,7 +406,6 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
|||||||
params.global_cfg=conn->global_cfg;
|
params.global_cfg=conn->global_cfg;
|
||||||
params.msgset=conn->msgset;
|
params.msgset=conn->msgset;
|
||||||
|
|
||||||
|
|
||||||
params.from=from;
|
params.from=from;
|
||||||
params.msgdata=message;
|
params.msgdata=message;
|
||||||
params.mand_found=mand_found;
|
params.mand_found=mand_found;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "cw.h"
|
#include "cw.h"
|
||||||
#include "dbg.h"
|
#include "dbg.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "msgset.h"
|
||||||
|
|
||||||
int cw_decode_element(struct cw_ElemHandlerParams *params, int proto,
|
int cw_decode_element(struct cw_ElemHandlerParams *params, int proto,
|
||||||
int vendor, int elem_id, uint8_t * data, int len)
|
int vendor, int elem_id, uint8_t * data, int len)
|
||||||
@ -72,32 +72,53 @@ int cw_decode_element(struct cw_ElemHandlerParams *params, int proto,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int cw_decode_elements(uint8_t * elems_ptr, int elems_len)
|
int cw_decode_elements(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len)
|
||||||
{
|
{
|
||||||
uint8_t *elem;
|
uint8_t *elem;
|
||||||
|
mavl_t mand_found;
|
||||||
|
mlist_t unrecognized;
|
||||||
|
|
||||||
|
mand_found = mavl_create_conststr();
|
||||||
|
unrecognized = mlist_create(NULL,NULL,sizeof(uint8_t*));
|
||||||
|
|
||||||
/* iterate through message elements */
|
|
||||||
cw_foreach_elem(elem, elems_ptr, elems_len) {
|
cw_foreach_elem(elem, elems_ptr, elems_len) {
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
|
||||||
struct cw_ElemHandlerParams params;
|
|
||||||
int elem_len, elem_id, max_len;
|
int elem_len, elem_id, max_len;
|
||||||
uint8_t *elem_data;
|
uint8_t * elem_data;
|
||||||
|
|
||||||
|
|
||||||
elem_len = cw_get_elem_len(elem);
|
elem_len = cw_get_elem_len(elem);
|
||||||
elem_data = cw_get_elem_data(elem);
|
elem_data=cw_get_elem_data(elem);
|
||||||
elem_id = cw_get_elem_id(elem);
|
elem_id = cw_get_elem_id(elem);
|
||||||
|
|
||||||
max_len = elems_len - (elem_data - elems_ptr);
|
max_len=elems_len-(elem_data-elems_ptr);
|
||||||
if (elem_len > max_len) {
|
if (elem_len > max_len){
|
||||||
cw_dbg(DBG_RFC,
|
cw_dbg(DBG_RFC,
|
||||||
"Messag element claims size of %d bytes, but only %d bytes are left in the payload, truncating.",
|
"Messag element claims size of %d bytes, but only %d bytes are left in the payload, truncating.",
|
||||||
elem_len, max_len - 4);
|
elem_len,max_len-4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
params->from=NULL; /*from;*/
|
||||||
|
params->mand_found=mand_found;
|
||||||
|
|
||||||
|
rc = cw_decode_element(params,0,0,elem_id,elem_data,elem_len);
|
||||||
|
|
||||||
|
|
||||||
|
if (cw_result_is_ok(rc))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (rc == CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT){
|
||||||
|
mlist_append(unrecognized,&elem);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rc < 0 ){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,6 @@ int cw_in_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams *
|
|||||||
|
|
||||||
result = cw_ktv_add(params->remote_cfg, handler->key,
|
result = cw_ktv_add(params->remote_cfg, handler->key,
|
||||||
handler->type,NULL, elem_data,elem_len);
|
handler->type,NULL, elem_data,elem_len);
|
||||||
|
|
||||||
params->elem=result;
|
params->elem=result;
|
||||||
|
|
||||||
return CAPWAP_RESULT_SUCCESS;
|
return CAPWAP_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,8 @@ int cw_process_element(struct cw_ElemHandlerParams *params, int proto, int vendo
|
|||||||
cw_log(LOG_ERR,"No get method defined for %d %s",handler->id,handler->name);
|
cw_log(LOG_ERR,"No get method defined for %d %s",handler->id,handler->name);
|
||||||
return CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
|
return CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rc = handler->get(handler, params, data, len);
|
rc = handler->get(handler, params, data, len);
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "dbg.h"
|
#include "dbg.h"
|
||||||
#include "msgset.h"
|
#include "msgset.h"
|
||||||
|
#include "mavltypes.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a message to a buffer
|
* Put a message to a buffer
|
||||||
@ -133,6 +133,30 @@ printf("Elem: %d %d %d %s\n", data->proto, data->vendor, data->id, handler->name
|
|||||||
cw_set_msg_seqnum(msgptr,s);
|
cw_set_msg_seqnum(msgptr,s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
printf ("----------------------------------- redecode -----------------------------\n");
|
||||||
|
uint8_t *elems_ptr;
|
||||||
|
|
||||||
|
int offset = cw_get_hdr_msg_offset(rawout);
|
||||||
|
|
||||||
|
uint8_t *msg_ptr = rawout + offset;
|
||||||
|
int elems_len = cw_get_msg_elems_len(msg_ptr);
|
||||||
|
elems_ptr = cw_get_msg_elems_ptr(msg_ptr);
|
||||||
|
mavl_t * cfg = cw_ktv_create();
|
||||||
|
|
||||||
|
struct cw_ElemHandlerParams params;
|
||||||
|
|
||||||
|
params.remote_cfg=cfg;
|
||||||
|
params.msgset=conn->msgset;
|
||||||
|
params.msgdata=msg;
|
||||||
|
|
||||||
|
|
||||||
|
cw_decode_elements( ¶ms, elems_ptr,elems_len);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return CAPWAP_RESULT_SUCCESS;
|
return CAPWAP_RESULT_SUCCESS;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ac-descriptor/active-wtps :Word: 1
|
ac-descriptor/active-wtps :Word: 2
|
||||||
ac-descriptor/dtls-policy :Byte: 0
|
ac-descriptor/dtls-policy :Byte: 0
|
||||||
ac-descriptor/hardware/vendor :Dword: 4232704
|
ac-descriptor/hardware/vendor :Dword: 4232704
|
||||||
ac-descriptor/hardware/version :Bstr16: .x01000001
|
ac-descriptor/hardware/version :Bstr16: .x01000001
|
||||||
@ -61,7 +61,7 @@ cisco/ap-regulatory-domain.1/slot :Byte: 0
|
|||||||
cisco/ap-sub-mode :Byte: 0
|
cisco/ap-sub-mode :Byte: 0
|
||||||
cisco/ap-telnet-ssh/ssh :Bool: false
|
cisco/ap-telnet-ssh/ssh :Bool: false
|
||||||
cisco/ap-telnet-ssh/telnet :Bool: false
|
cisco/ap-telnet-ssh/telnet :Bool: false
|
||||||
cisco/ap-timesync/timestamp :Dword: 1469663405
|
cisco/ap-timesync/timestamp :Dword: 1469722147
|
||||||
cisco/ap-timesync/type :Byte: 0
|
cisco/ap-timesync/type :Byte: 0
|
||||||
cisco/ap-username-and-password/802.1x-credentials/option :Word: 2
|
cisco/ap-username-and-password/802.1x-credentials/option :Word: 2
|
||||||
cisco/ap-username-and-password/802.1x-credentials/password :Str:
|
cisco/ap-username-and-password/802.1x-credentials/password :Str:
|
||||||
@ -196,7 +196,7 @@ radio.0/wlan.0/add-wlan/scan-defer-time :Word: 100
|
|||||||
radio.0/wlan.0/add-wlan/session-timout :Word: 1800
|
radio.0/wlan.0/add-wlan/session-timout :Word: 1800
|
||||||
radio.0/wlan.0/add-wlan/ssid :Str:
|
radio.0/wlan.0/add-wlan/ssid :Str:
|
||||||
radio.0/wlan.0/add-wlan/wep-encryption :Bool: false
|
radio.0/wlan.0/add-wlan/wep-encryption :Bool: false
|
||||||
radio.0/wlan.0/add-wlan/wep-key :Bstr16: .x0c1dfebf4fe85062a9104d37b4
|
radio.0/wlan.0/add-wlan/wep-key :Bstr16: .x61d4be12e22feb1135d1be6d3f
|
||||||
radio.0/wlan.0/add-wlan/wep-key-index :Byte: 1
|
radio.0/wlan.0/add-wlan/wep-key-index :Byte: 1
|
||||||
radio.0/wlan.0/add-wlan/wlan-capability :Word: 1073
|
radio.0/wlan.0/add-wlan/wlan-capability :Word: 1073
|
||||||
radio.0/wlan.0/add-wlan/wlan-id :Byte: 1
|
radio.0/wlan.0/add-wlan/wlan-id :Byte: 1
|
||||||
@ -248,7 +248,7 @@ radio.1/cisco/multi-domain-capability/max-tx-power-level :Word: 20
|
|||||||
radio.1/cisco/multi-domain-capability/number-of-channels :Word: 4
|
radio.1/cisco/multi-domain-capability/number-of-channels :Word: 4
|
||||||
radio.1/cisco/multi-domain-capability/reserved :Byte: 1
|
radio.1/cisco/multi-domain-capability/reserved :Byte: 1
|
||||||
radio.1/cisco/tx-power-levels :Bstr16: .x070011000e000b000800050002ffff0000
|
radio.1/cisco/tx-power-levels :Bstr16: .x070011000e000b000800050002ffff0000
|
||||||
radio.1/cisco/tx-power/current-tx-power :Word: 1
|
radio.1/cisco/tx-power/current-tx-power :Word: 6
|
||||||
radio.1/cisco/tx-power/reserved :Byte: 1
|
radio.1/cisco/tx-power/reserved :Byte: 1
|
||||||
radio.1/cisco/wtp-radio-config/beacon-period :Word: 100
|
radio.1/cisco/wtp-radio-config/beacon-period :Word: 100
|
||||||
radio.1/cisco/wtp-radio-config/bss-id :Bstr16: .x04fe7f499b90
|
radio.1/cisco/wtp-radio-config/bss-id :Bstr16: .x04fe7f499b90
|
||||||
|
Loading…
Reference in New Issue
Block a user