diff --git a/actube.workspace b/actube.workspace
index 361145ca..c63c2d68 100644
--- a/actube.workspace
+++ b/actube.workspace
@@ -4,9 +4,9 @@
-
+
-
+
diff --git a/libcw.project b/libcw.project
index 82ee7f61..2553b03d 100644
--- a/libcw.project
+++ b/libcw.project
@@ -127,7 +127,6 @@
-
@@ -281,6 +280,9 @@
+
+
+
diff --git a/mod_cisco.project b/mod_cisco.project
index d8591f20..917d6863 100644
--- a/mod_cisco.project
+++ b/mod_cisco.project
@@ -37,6 +37,7 @@
+
diff --git a/src/ac/config.ktv b/src/ac/config.ktv
index dedde132..b9214213 100644
--- a/src/ac/config.ktv
+++ b/src/ac/config.ktv
@@ -4,7 +4,19 @@ capwap/ac-descriptor/hardware/version:Bstr16: "ACTube 1.0"
capwap/ac-descriptor/hardware/vendor:Bstr16: 12346
-ac-descriptor/avtive-wtps :Word: 0
+#ac-descriptor/avtive-wtps :Word: 0
+#ac-descriptor/dtls-policy :Byte: 0
+#ac-descriptor/hardware/vendor :Dword: 4232704
+#ac-descriptor/hardware/version :Bstr16: .x01000001
+#ac-descriptor/max-wtps :Word: 200
+#ac-descriptor/r-mac-field :Byte: 1
+#ac-descriptor/reserved1 :Byte: 0
+#ac-descriptor/security :Byte: 2
+#ac-descriptor/software/vendor :Dword: 4232704
+#ac-descriptor/software/version :Bstr16: .x07056600
+#ac-descriptor/station-limit :Word: 1000
+#ac-descriptor/stations :Word: 0
+
ac-descriptor/dtls-policy :Byte: 0
ac-descriptor/hardware/vendor :Dword: 4232704
ac-descriptor/hardware/version :Bstr16: .x01000001
@@ -13,10 +25,20 @@ ac-descriptor/r-mac-field :Byte: 1
ac-descriptor/reserved1 :Byte: 0
ac-descriptor/security :Byte: 2
ac-descriptor/software/vendor :Dword: 4232704
-ac-descriptor/software/version :Bstr16: .x07056600
+ac-descriptor/software/version :Bstr16: .x07036500
ac-descriptor/station-limit :Word: 1000
ac-descriptor/stations :Word: 0
-
+ac-name :Bstr16: CiscoAC73
+capwap-control-ip-address/address.0 :IPAddress: 192.168.0.14
+capwap-control-ip-address/address.1 :IPAddress: d96c:4c0a:da6c:4c0a:db6c:4c0a:dc6c:4c0a
+capwap-control-ip-address/address.2 :IPAddress: 192.168.0.14
+capwap-control-ip-address/wtps.0 :Word: 2
+capwap-control-ip-address/wtps.1 :Word: 10
+capwap-control-ip-address/wtps.2 :Word: 2
+cisco/mwar-type :Byte: 0
+maximum-message-length :Word: 4096
+radio/0/wtp-radio-information :Dword: 7
+result-code :Dword: 0
diff --git a/src/ac/wtpman.c b/src/ac/wtpman.c
index 7863b981..b42b6626 100644
--- a/src/ac/wtpman.c
+++ b/src/ac/wtpman.c
@@ -213,6 +213,9 @@ static int wtpman_join(void *arg, time_t timer)
while (!cw_timer_timeout(timer) && wtpman->conn->capwap_state == CAPWAP_STATE_JOIN) {
rc = cw_read_messages(wtpman->conn);
if (rc < 0) {
+ if (errno == EAGAIN)
+ continue;
+
break;
}
}
@@ -374,11 +377,10 @@ static void * wtpman_run(void *arg)
-/*
cw_dbg(DBG_INFO, "WTP from %s has joined with session id: %s",
sock_addr2str_p(&conn->addr,sock_buf),
format_bin2hex(conn->session_id,16));
-*/
+
diff --git a/src/cw/Makefile b/src/cw/Makefile
index 20931be9..026b4af8 100644
--- a/src/cw/Makefile
+++ b/src/cw/Makefile
@@ -59,10 +59,11 @@ CWSRC=\
cw_in_check_join_resp.c\
cw_in_generic.c\
cw_in_generic_struct.c\
+ cw_in_radio_generic_struct.c\
+ cw_in_generic_enum.c\
cw_out_generic_struct.c\
cw_init_data_keep_alive_msg.c\
cw_inline.c\
- cw_in_radio_generic.c\
cw_in_wtp_reboot_statistics.c\
cw_is_printable.c\
cw_load_file.c\
@@ -100,6 +101,7 @@ CWSRC=\
cw_write_descriptor_subelem.c\
cw_read_from.c \
cw_write_radio_element.c\
+ cw_detect_nat.c\
KTVSRC=\
cw_ktv_add.c\
diff --git a/src/cw/capwap.h b/src/cw/capwap.h
index f73364c2..57ed3b3a 100644
--- a/src/cw/capwap.h
+++ b/src/cw/capwap.h
@@ -244,12 +244,12 @@
#define CAPWAP_ELEM_LOCATION_DATA 28
#define CAPWAP_ELEM_MAXIMUM_MESSAGE_LENGTH 29
#define CAPWAP_ELEM_MTU_DISCOVERY_PADDING 52
-#define CW_ELEM_RADIO_ADMINISTRATIVE_STATE 31
+#define CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE 31
#define CW_ELEM_RADIO_OPERATIONAL_STATE 32
#define CAPWAP_ELEM_RESULT_CODE 33
#define CW_ELEM_RETURNED_MESSAGE_ELEMENT 34
#define CAPWAP_ELEM_SESSION_ID 35
-#define CW_ELEM_STATISTICS_TIMER 36
+#define CAPWAP_ELEM_STATISTICS_TIMER 36
/**
* The Vendor Specific Payload allows tronasport of
* vebdor defined data.*/
diff --git a/src/cw/capwap_strings_elem.c b/src/cw/capwap_strings_elem.c
index dd49fcf4..aa61b5f3 100644
--- a/src/cw/capwap_strings_elem.c
+++ b/src/cw/capwap_strings_elem.c
@@ -38,12 +38,12 @@ struct cw_StrListElem capwap_strings_elem[] = {
{CAPWAP_ELEM_LOCATION_DATA, "Location Data"},
{CAPWAP_ELEM_MAXIMUM_MESSAGE_LENGTH, "Maximum Message Length"},
{CAPWAP_ELEM_MTU_DISCOVERY_PADDING, "MTU Discovery Padding"},
- {CW_ELEM_RADIO_ADMINISTRATIVE_STATE, "Radio Administrative State"},
+ {CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE, "Radio Administrative State"},
{CW_ELEM_RADIO_OPERATIONAL_STATE, "Radio Operational State"},
{CAPWAP_ELEM_RESULT_CODE, "Result Code"},
{CW_ELEM_RETURNED_MESSAGE_ELEMENT, "Returned Message Element"},
{CAPWAP_ELEM_SESSION_ID, "Session ID"},
- {CW_ELEM_STATISTICS_TIMER, "Statistics Timer"},
+ {CAPWAP_ELEM_STATISTICS_TIMER, "Statistics Timer"},
{CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, "Vendor Specific Payload"},
{CAPWAP_ELEM_WTP_BOARD_DATA, "WTP Board Data"},
{CAPWAP_ELEM_WTP_DESCRIPTOR, "WTP Descriptor"},
diff --git a/src/cw/conn_process_packet.c b/src/cw/conn_process_packet.c
index 020964a8..1be6c074 100644
--- a/src/cw/conn_process_packet.c
+++ b/src/cw/conn_process_packet.c
@@ -428,53 +428,11 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
cw_dbg_ktv_dump(conn->remote_cfg,DBG_CFG_DMP,
" *** Remote CFG dump ***", "CFG:", " *** End of remote CFG dump");
-/* {
- {
- mlistelem_t *e;
- mlist_foreach(e,unrecognized){
- uint8_t * elem = *(uint8_t**)mlistelem_dataptr(e);
- int elem_len = cw_get_elem_len(elem);
- //int elem_data=cw_get_elem_data(elem);
- int elem_id = cw_get_elem_id(elem);
- printf("Unrecognized: %d %d\n",elem_id,elem_len);
- }
- }
-
+
+ if (message->postprocess){
+ message->postprocess(conn);
}
-*/
-
-
-/** int rct = cw_in_check_generic(conn, afm, rawmsg, len, from); */
-
-/* if (rct && conn->strict_capwap)
- {
- result_code = rct;
- }
- else {
-
- if (afm->end) {
- result_code = afm->end(conn, afm, rawmsg, len, from);
-
- }
- if (conn->msg_end){
- conn->msg_end(conn, afm, rawmsg, len, from);
- }
- }
-*/
-/* if (unrecognized) {
- cw_dbg(DBG_RFC, "Message has %d unrecognized message elements.",
- unrecognized);
- // set only resultcode for request messages
-
- if ( (!result_code) && ((afm->msg_id & 1))) {
- if (conn->strict_capwap) {
- result_code = CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
- }
- }
-
- }
-*/
/* if we've got a request message, we always have to send a response message */
diff --git a/src/cw/cw.h b/src/cw/cw.h
index dba79349..43ae685e 100644
--- a/src/cw/cw.h
+++ b/src/cw/cw.h
@@ -397,6 +397,9 @@ int cw_in_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams *
int cw_in_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
uint8_t * elem_data, int elem_len);
+int cw_in_generic_enum(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
+ uint8_t * elem_data, int elem_len);
+
int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
, uint8_t * dst);
@@ -406,6 +409,9 @@ int cw_out_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandler
int cw_in_radio_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
uint8_t * elem_data, int elem_len);
+int cw_in_radio_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
+ uint8_t * elem_data, int elem_len);
+
int cw_out_radio_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
, uint8_t * dst);
diff --git a/src/cw/cw_detect_nat.c b/src/cw/cw_detect_nat.c
new file mode 100644
index 00000000..5b68752e
--- /dev/null
+++ b/src/cw/cw_detect_nat.c
@@ -0,0 +1,39 @@
+
+#include
+
+#include "dbg.h"
+#include "cw.h"
+
+/**
+ * @brief Detect NAT after a join/discovery request
+ * @param conn Connection object
+ * @retval 1 NAT detected
+ * @retval 0 no NAT was detected
+ */
+int cw_detect_nat(struct conn *conn)
+{
+ cw_KTV_t * result;
+
+ char local_str[128];
+ char remote_str[128];
+
+ result = cw_ktv_get(conn->remote_cfg,"capwap-local-ip-address",CW_TYPE_IPADDRESS);
+ if (result == NULL){
+ cw_dbg(DBG_WARN,"Can't detect NAT. No local IP from peer received.");
+ return 0;
+ }
+
+ /* convert remote connected and sent ip addresse to
+ * strings */
+
+ sock_addrtostr((struct sockaddr*)&conn->addr,local_str,128,0);
+ result->type->to_str(result,remote_str,128);
+
+
+ /* if connected and sent address is the same, there is
+ * no NAT */
+ if (strcmp(remote_str,local_str)==0)
+ return 0;
+ /* otherwise ther must be something between AC and WTP */
+ return 1;
+}
diff --git a/src/cw/cw_in_generic_enum.c b/src/cw/cw_in_generic_enum.c
new file mode 100644
index 00000000..beee5e42
--- /dev/null
+++ b/src/cw/cw_in_generic_enum.c
@@ -0,0 +1,36 @@
+#include "cw.h"
+
+
+static const cw_KTVEnum_t * get_enum(const cw_KTVEnum_t * e, int val){
+ int i;
+ for (i=0; e[i].type != NULL; i++ ){
+ if (e[i].value==val){
+ return &(e[i]);
+ }
+ }
+ return NULL;
+}
+
+
+int cw_in_generic_enum(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
+ uint8_t * elem_data, int elem_len)
+{
+ int val;
+ const cw_KTVEnum_t * e;
+ char key[CW_KTV_MAX_KEY_LEN];
+ struct cw_ElemHandler thandler;
+
+ val = cw_get_byte(elem_data+1);
+ e = get_enum(handler->type,val);
+ if (e!=NULL){
+ sprintf(key,"%s/%s",handler->key,e->name);
+ }
+ else{
+ sprintf(key,"%s/%u",handler->key,val);
+ }
+
+ thandler.type=e->type;
+ thandler.key=key;
+ return e->fun(&thandler,params,elem_data,elem_len-1);
+
+}
\ No newline at end of file
diff --git a/src/cw/cw_in_radio_generic.c b/src/cw/cw_in_radio_generic.c
deleted file mode 100644
index 76a84fe5..00000000
--- a/src/cw/cw_in_radio_generic.c
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-#include "dbg.h"
-#include "log.h"
-
-#include "cw.h"
-
-
-
-
-
-
-/*
-int cw_in_radio_generic(struct conn *conn, struct cw_action_in *a, uint8_t * data,
- int len, struct sockaddr *from)
-{
- // TODO XXXX
-// const cw_itemdef_t * idef = cw_itemdef_get(conn->actions->radioitems,a->item_id,CW_ITEM_NONE);
- const cw_itemdef_t * idef = 0;
-
- if (!idef){
- cw_log(LOG_ERR,"No definition found for %s",a->item_id);
- return 0;
- }
-
-
- int rid = cw_get_byte(data);
- mbag_t radio = mbag_i_get_mbag(conn->radios, rid, NULL);
- if (!radio) {
- if (a->vendor_id != 0
- || ( (a->vendor_id == 0) && (a->msg_id != CAPWAP_MSG_DISCOVERY_REQUEST
- && a->msg_id != CAPWAP_MSG_JOIN_REQUEST) )) {
- cw_dbg(DBG_ELEM_ERR, "Radio not found %d", rid);
- return 0;
- }
- mbag_i_set_mbag(conn->radios,rid,mbag_create());
- radio = mbag_i_get_mbag(conn->radios, rid, NULL);
- }
-
- int rc = mbag_set_from_buf(radio,idef->type,a->item_id,data+1,len-1);
- if (!rc){
- cw_log(LOG_ERR,
- "Can't handle item type %s in definition for incomming msg %d (%s) - %d, cw_in_radio_generic.",
- idef->type->name, a->msg_id, cw_strmsg(a->msg_id), a->elem_id);
- }
-
- return rc;
-
-
-}
-*/
-
diff --git a/src/cw/cw_in_radio_generic_struct.c b/src/cw/cw_in_radio_generic_struct.c
new file mode 100644
index 00000000..d1131264
--- /dev/null
+++ b/src/cw/cw_in_radio_generic_struct.c
@@ -0,0 +1,27 @@
+
+#include "capwap.h"
+#include "msgset.h"
+#include "ktv.h"
+#include "log.h"
+#include "cw.h"
+
+int cw_in_radio_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
+ uint8_t * elem_data, int elem_len)
+{
+ char key[CW_KTV_MAX_KEY_LEN];
+ int radio;
+
+ if (!handler->type){
+ cw_log(LOG_ERR,"Can't handle element: %s, no type defined",handler->name);
+ return CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
+ }
+
+ radio = cw_get_byte(elem_data);
+ sprintf(key,"radio/%d/%s",radio,handler->key);
+
+ cw_ktv_read_struct(params->conn->remote_cfg,handler->type,key,elem_data+1,elem_len-1);
+
+ /*params->elem=result;*/
+
+ return CAPWAP_RESULT_SUCCESS;
+}
diff --git a/src/cw/cw_inline.c b/src/cw/cw_inline.c
index 8696c5d8..306fd503 100644
--- a/src/cw/cw_inline.c
+++ b/src/cw/cw_inline.c
@@ -196,7 +196,7 @@ int cw_put_elem_radio_operational_state(uint8_t * dst, int rid, int state, int c
int cw_put_elem_radio_administrative_state(uint8_t * dst, int rid, int state) {
cw_set_byte(dst+4,rid);
cw_set_byte(dst+5,state);
- return 2+cw_put_elem_hdr(dst,CW_ELEM_RADIO_ADMINISTRATIVE_STATE,2);
+ return 2+cw_put_elem_hdr(dst,CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE,2);
}
diff --git a/src/cw/cw_ktv_read_struct.c b/src/cw/cw_ktv_read_struct.c
index f3658752..b2e8aa98 100644
--- a/src/cw/cw_ktv_read_struct.c
+++ b/src/cw/cw_ktv_read_struct.c
@@ -12,6 +12,8 @@ int cw_ktv_read_struct(mavl_t ktv,const cw_KTVStruct_t * stru, const char *pkey,
pos=0; i=0;
while (stru[i].type != NULL){
char dbstr[100];
+ if(stru[i].position!=-1)
+ pos=stru[i].position;
sprintf(key,"%s/%s",pkey,stru[i].key);
result = cw_ktv_add(ktv,key,stru[i].type,data+pos,stru[i].len);
@@ -21,8 +23,7 @@ int cw_ktv_read_struct(mavl_t ktv,const cw_KTVStruct_t * stru, const char *pkey,
if(stru[i].position == -1)
pos+=stru[i].len;
- else
- pos=stru[i].position;
+
i++;
}
diff --git a/src/cw/cw_readelem_statistics_timer.c b/src/cw/cw_readelem_statistics_timer.c
index 382e0d30..625ffb30 100644
--- a/src/cw/cw_readelem_statistics_timer.c
+++ b/src/cw/cw_readelem_statistics_timer.c
@@ -4,7 +4,7 @@
int cw_readelem_statistics_timer(uint16_t *timer, int type, uint8_t * msgelem, int len)
{
- if (type != CW_ELEM_STATISTICS_TIMER)
+ if (type != CAPWAP_ELEM_STATISTICS_TIMER)
return 0;
if (len!=2){
diff --git a/src/cw/ktv.h b/src/cw/ktv.h
index f5622168..f0c5cdc2 100644
--- a/src/cw/ktv.h
+++ b/src/cw/ktv.h
@@ -7,6 +7,7 @@
#include "mavl.h"
#include "bstr.h"
+
/**
* @addtogroup ALGOS
* @{
@@ -90,7 +91,17 @@ struct cw_KTVStruct {
int len;
int position;
};
+
typedef struct cw_KTVStruct cw_KTVStruct_t;
+
+struct cw_KTVEnum{
+ int value;
+ const char * name;
+ const struct cw_Type * type;
+ int (*fun)();
+};
+typedef struct cw_KTVEnum cw_KTVEnum_t;
+
int cw_ktv_read_struct(mavl_t ktv,const cw_KTVStruct_t * stru, const char *pkey,
uint8_t * data, int len);
int cw_ktv_write_struct(mavl_t ktv, const cw_KTVStruct_t * stru, const char *pkey,
diff --git a/src/cw/msgset.c b/src/cw/msgset.c
index 1096239b..8d6ec725 100644
--- a/src/cw/msgset.c
+++ b/src/cw/msgset.c
@@ -264,21 +264,22 @@ int cw_msgset_add(struct cw_MsgSet *set,
struct cw_MsgData *msg;
int exists;
- /* Look if message already exists */
+ /* add the message */
search.type = msgdef->type;
msg = mavl_add(set->msgdata, &search, &exists);
-
if (msg == NULL) {
cw_log(LOG_ERR, "Can't create messae");
return 0;
}
+ /* Look if message already exists */
if (!exists) {
+ /* message is fresh createt, initialize data */
msg->elements_tree = mavl_create(cmp_elemdata, NULL,
sizeof(struct cw_ElemData));
msg->mand_keys=NULL;
-
msg->elements_list = mlist_create(cmp_elemdata,NULL,sizeof(struct cw_ElemData));
+ msg->postprocess=NULL;
}
/* Overwrite the found message */
@@ -286,6 +287,9 @@ int cw_msgset_add(struct cw_MsgSet *set,
msg->name = msgdef->name;
if (msgdef->states)
msg->states = msgdef->states;
+ if (msgdef->postprocess != NULL)
+ msg->postprocess = msgdef->postprocess;
+
msg->receiver = msgdef->receiver;
diff --git a/src/cw/msgset.h b/src/cw/msgset.h
index b28b8664..badbbd19 100644
--- a/src/cw/msgset.h
+++ b/src/cw/msgset.h
@@ -70,7 +70,7 @@ struct cw_MsgDef{
struct cw_ElemDef * elements;
-
+ int (*postprocess)(struct conn * conn);
};
@@ -82,6 +82,8 @@ struct cw_MsgData{
mavl_t elements_tree;
mlist_t elements_list;
mlist_t mand_keys; /**< Keys of mandatory elements */
+
+ int (*postprocess)(struct conn * conn);
};
diff --git a/src/mod/capwap/capwap_actions_ac.c b/src/mod/capwap/capwap_actions_ac.c
index 119d7c2e..acb389ef 100644
--- a/src/mod/capwap/capwap_actions_ac.c
+++ b/src/mod/capwap/capwap_actions_ac.c
@@ -27,6 +27,17 @@
#include "mod_capwap.h"
+static cw_KTVStruct_t wtp_reboot_statistics[] = {
+ {CW_TYPE_WORD, "reboot-count", 2,-1},
+ {CW_TYPE_WORD, "ac-initiated-count", 2,-1},
+ {CW_TYPE_WORD, "link-failure-count", 2,-1},
+ {CW_TYPE_WORD, "sw-failure-count", 2,-1},
+ {CW_TYPE_WORD, "hw-failure-count", 2,-1},
+ {CW_TYPE_WORD, "other-failure-count", 2,-1},
+ {CW_TYPE_WORD, "unknown-failure-count", 2,-1},
+ {CW_TYPE_WORD, "last-failure-type", 2,-1},
+ {NULL,NULL,0,0}
+};
static struct cw_ElemHandler handlers[] = {
@@ -124,7 +135,7 @@ static struct cw_ElemHandler handlers[] = {
"AC Name", /* name */
CAPWAP_ELEM_AC_NAME, /* Element ID */
0,0, /* Vendor / Proto */
- 0,0, /* min/max length */
+ 1,CAPWAP_MAX_AC_NAME_LEN, /* min/max length */
CW_TYPE_BSTR16, /* type */
"ac-name", /* Key */
cw_in_generic, /* get */
@@ -250,6 +261,43 @@ static struct cw_ElemHandler handlers[] = {
}
,
+
+ {
+ "Statitsics Timer", /* name */
+ CAPWAP_ELEM_STATISTICS_TIMER, /* Element ID */
+ 0,0, /* Vendor / Proto */
+ 2,2, /* min/max length */
+ CW_TYPE_WORD, /* type */
+ "statistics-timer", /* Key */
+ cw_in_generic, /* get */
+ cw_out_generic /* put */
+ }
+ ,
+
+ {
+ "WTP Reboot Statistics", /* name */
+ CAPWAP_ELEM_WTP_REBOOT_STATISTICS, /* Element ID */
+ 0,0, /* Vendor / Proto */
+ 15,15, /* min/max length */
+ wtp_reboot_statistics, /* type */
+ "wtp-reboot-statistics", /* Key */
+ cw_in_generic_struct, /* handler */
+ cw_out_generic_struct /* put */
+ }
+ ,
+
+ {
+ "Radio Administrative State", /* name */
+ CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE, /* Element ID */
+ 0, 0, /* Vendor / Proto */
+ 2, 2, /* min/max length */
+ CW_TYPE_BYTE, /* type */
+ "admin-state", /* Key */
+ cw_in_radio_generic, /* get */
+ cw_out_radio_generic /* put */
+ }
+ ,
+
{0,0,0,0,0,0,0,0}
};
@@ -294,15 +342,7 @@ static struct cw_ElemDef join_request_elements[] ={
{0,0,CAPWAP_ELEM_MAXIMUM_MESSAGE_LENGTH, 0, 0},
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
-
-/* {0,0,CAPWAP_ELEM_DISCOVERY_TYPE, 1, 0},
- {0,0,CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},
- {0,0,CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE, 1, 0},
- {0,0,CAPWAP_ELEM_WTP_MAC_TYPE, 1, 0},
- {0,0,CAPWAP_ELEM_MTU_DISCOVERY_PADDING, 0, 0},
- {0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
-*/
{0,0,0,0,0}
};
@@ -319,16 +359,24 @@ static struct cw_ElemDef join_response_elements[] ={
{0,0,CAPWAP_ELEM_MAXIMUM_MESSAGE_LENGTH, 0, 0},
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
-
-/* {0,0,CAPWAP_ELEM_AC_DESCRIPTOR, 1, 0},
- {0,0,CAPWAP_ELEM_AC_NAME, 1, 0},
- {0,0,CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS, 1, 0},
- {0,0,CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, 1, 0},
- {0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},*/
+
{0,0,0,0,0}
};
+
+static int configuration_status_request_states[] = {CAPWAP_STATE_JOIN,0};
+static struct cw_ElemDef configuration_status_request_elements[] ={
+ {0,0,CAPWAP_ELEM_AC_NAME, 1, 0},
+ {0,0,CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE, 1, 0},
+ {0,0,CAPWAP_ELEM_STATISTICS_TIMER, 1, 0},
+ {0,0,CAPWAP_ELEM_WTP_REBOOT_STATISTICS, 1, 0},
+
+ {0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
+ {0,0,0,0,0}
+};
+
+
static struct cw_MsgDef messages[] = {
{
"Discovery Request",
@@ -362,6 +410,13 @@ static struct cw_MsgDef messages[] = {
join_response_elements
},
+ {
+ "Configuration Status Request", /* name */
+ CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST, /* msg type */
+ CW_ROLE_AC, /* role */
+ configuration_status_request_states, /* allowed states */
+ configuration_status_request_elements /* msg elements */
+ },
diff --git a/src/mod/capwap/capwap_actions_wtp.c b/src/mod/capwap/capwap_actions_wtp.c
index 9c1a70ee..67cb20a9 100644
--- a/src/mod/capwap/capwap_actions_wtp.c
+++ b/src/mod/capwap/capwap_actions_wtp.c
@@ -421,7 +421,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CW_STATE_RUN,
.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
- .elem_id = CW_ELEM_RADIO_ADMINISTRATIVE_STATE,
+ .elem_id = CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE,
.item_id = CW_RADIOITEM_ADMIN_STATE,
.start = cw_in_radio_generic,
.min_len=2,
@@ -639,7 +639,7 @@ static cw_action_out_t actions_out[] = {
/* Radio Admin State - Config Status Request - OUT */
{
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST,
- .elem_id = CW_ELEM_RADIO_ADMINISTRATIVE_STATE,
+ .elem_id = CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE,
.item_id = CW_RADIOITEM_ADMIN_STATE,
.out = cw_out_radio_generic,
// .out = cw_out_radio_administrative_states,
@@ -665,7 +665,7 @@ static cw_action_out_t actions_out[] = {
/* Statistics Timer - Join Request */
{
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST,
- .elem_id = CW_ELEM_STATISTICS_TIMER,
+ .elem_id = CAPWAP_ELEM_STATISTICS_TIMER,
.item_id = CW_ITEM_STATISTICS_TIMER,
.out = cw_out_generic,
.get = cw_out_get_config,
diff --git a/src/mod/capwap80211/capwap80211_messages.c b/src/mod/capwap80211/capwap80211_messages.c
index c7a549a6..2b9d821c 100644
--- a/src/mod/capwap80211/capwap80211_messages.c
+++ b/src/mod/capwap80211/capwap80211_messages.c
@@ -53,7 +53,7 @@ static struct cw_ElemDef join_response_elements[] = {
static struct cw_MsgDef messages[] = {
{
- "Discovery Request",
+ NULL,
CAPWAP_MSG_DISCOVERY_REQUEST,
CW_ROLE_AC,
discovery_request_states,
@@ -61,7 +61,7 @@ static struct cw_MsgDef messages[] = {
}
,
{
- "Join Request",
+ NULL,
CAPWAP_MSG_JOIN_REQUEST,
CW_ROLE_AC,
join_request_states,
@@ -69,7 +69,7 @@ static struct cw_MsgDef messages[] = {
}
,
{
- "Join Request",
+ NULL,
CAPWAP_MSG_JOIN_RESPONSE,
CW_ROLE_AC,
join_response_states,
diff --git a/src/mod/cisco/capwap_cisco.h b/src/mod/cisco/capwap_cisco.h
index e29f2eaa..1ded8bfe 100644
--- a/src/mod/cisco/capwap_cisco.h
+++ b/src/mod/cisco/capwap_cisco.h
@@ -39,8 +39,8 @@
#define CW_CISCO_ADD_WLAN LW_ELEM_80211_ADD_WLAN /* 7 */
#define CW_CISCO_WTP_RADIO_CFG 8
-#define CW_CISCO_MULTI_DOMAIN_CAPAB LW_ELEM_80211_MULTI_DOMAIN_CAPABILITY /* 10 */
-#define CW_CISCO_MAC_OPERATION LW_ELEM_80211_MAC_OPERATION /* 11 */
+#define CISCO_ELEM_MULTI_DOMAIN_CAPABILITY LW_ELEM_80211_MULTI_DOMAIN_CAPABILITY /* 10 */
+#define CISCO_ELEM_MAC_OPERATION LW_ELEM_80211_MAC_OPERATION /* 11 */
#define CW_CISCO_TX_POWER LW_ELEM_80211_TX_POWER /* 12 */
#define CW_CISCO_TX_POWER_LEVELS LW_ELEM_80211_TX_POWER_LEVELS /* 13 */
@@ -57,15 +57,15 @@
#define CW_CISCO_ANTENNA_PAYLOAD 41
#define CW_CISCO_CERTIFICATE LW_ELEM_CERTIFICATE /* 44 */
-#define CW_CISCO_WTP_BOARD_DATA LW_ELEM_WTP_BOARD_DATA /* 50 */
+#define CISCO_ELEM_WTP_BOARD_DATA LW_ELEM_WTP_BOARD_DATA /* 50 */
#define CW_CISCO_BCAST_SSID_MODE LW_BCAST_SSID_MODE
-#define CW_CISCO_AP_MODE_AND_TYPE LW_ELEM_80211_WTP_MODE_AND_TYPE /* 54 */
+#define CISCO_ELEM_AP_MODE_AND_TYPE LW_ELEM_80211_WTP_MODE_AND_TYPE /* 54 */
#define CW_CISCO_AP_QOS LW_ELEM_QOS /* 57 */
#define CW_CISCO_AC_IPV4_LIST LW_ELEM_AC_IPV4_LIST /* 59 */
#define CW_CISCO_CAPWAP_TIMERS LW_ELEM_LWAPP_TIMERS /* 68 */
-#define CW_CISCO_AP_STATIC_IP_ADDR 83
+#define CISCO_ELEM_AP_STATIC_IP_ADDR 83
#define CW_CISCO_SIG_PAYLOAD 84
#define CW_CISCO_SIG_TOGGLE 87
#define CW_CISCO_AIRSPACE_CAPABILITY 88
@@ -75,10 +75,10 @@
#define CISCO_ELEM_SPAM_VENDOR_SPECIFIC 104
-#define CW_CISCO_AP_UPTIME 108
+#define CISCO_ELEM_AP_UPTIME 108
#define CISCO_ELEM_AP_GROUP_NAME 123
-#define CW_CISCO_AP_LED_STATE_CONFIG 125
+#define CISCO_ELEM_AP_LED_STATE_CONFIG 125
#define CW_CISCO_AP_MODEL 127
#define CW_CISCO_AP_RESET_BUTTON_STATE 128
@@ -86,20 +86,20 @@
#define CW_CISCO_LWAPP_CHANNEL_POWER 134
#define CW_CISCO_AP_CORE_DUMP 135
-#define CW_CISCO_AP_PRE_STD_SWITCH_CONFIG 137
-#define CW_CISCO_AP_POWER_INJECTOR_CONFIG 138
+#define CISCO_ELEM_AP_PRE_STD_SWITCH_CONFIG 137
+#define CISCO_ELEM_AP_POWER_INJECTOR_CONFIG 138
-#define CW_CISCO_AP_MINIOS_VERSION 149
+#define CISCO_ELEM_AP_MIN_IOS_VERSION 149
#define CISCO_ELEM_AP_TIMESYNC 151
#define CW_CISCO_AP_DOMAIN 169
#define CW_CISCO_AP_DNS 170
-#define CW_CISCO_AP_BACKUP_SOFTWARE_VERSION 183
+#define CISCO_ELEM_AP_BACKUP_SOFTWARE_VERSION 183
#define CW_CISCO_BOARD_DATA_OPTIONS 207
#define CISCO_ELEM_MWAR_TYPE 208
#define CW_CISCO_80211_ASSOC_LIMIT 213
#define CW_CISCO_TLV_PAYLOAD 215
-#define CW_CISCO_AP_LOG_FACILITY 224
+#define CISCO_ELEM_AP_LOG_FACILITY 224
#define CW_CISCO_OPER_STATE_DETAIL_CAUSE 235
@@ -109,7 +109,7 @@
#define CW_CISCO_DOT11_CONFIG_CHECKER 242
#define CW_CISCO_AP_VENUE_SETTINGS 249
-#define CW_CISCO_AP_LED_FLASH_CONFIG 254
+#define CISCO_ELEM_AP_LED_FLASH_CONFIG 254
/*
diff --git a/src/mod/cisco/cisco_actions_ac.c b/src/mod/cisco/cisco_actions_ac.c
index 7638191c..3f144e3e 100644
--- a/src/mod/cisco/cisco_actions_ac.c
+++ b/src/mod/cisco/cisco_actions_ac.c
@@ -27,6 +27,11 @@
#include "capwap_cisco.h"
#include "mod_cisco.h"
+#include "cw/dbg.h"
+#include "cw/format.h"
+
+static int postprocess_discovery();
+
static cw_KTVStruct_t ap_time_sync[] = {
@@ -45,10 +50,94 @@ static cw_KTVStruct_t mwar_addr[] = {
static cw_KTVStruct_t cisco_lw_path_mtu[] = {
{CW_TYPE_WORD, "max", 2,-1},
{CW_TYPE_WORD, "len", 2,-1},
+ {NULL,NULL,0,0}
+};
+
+static cw_KTVStruct_t cisco_ap_uptime[] = {
+ {CW_TYPE_DWORD, "current-uptime", 4,-1},
+ {CW_TYPE_DWORD, "last-uptime", 4,-1},
+ {NULL,NULL,0,0}
+};
+
+static cw_KTVStruct_t cisco_ap_username_and_password[] = {
+ {CW_TYPE_STR, "username", 33, -1 },
+ {CW_TYPE_STR, "password", 121, -1 },
+ {CW_TYPE_STR, "enable-password", 121, 33+121 },
+ {NULL,NULL,0,0}
+};
+
+static cw_KTVStruct_t cisco_loghost_config[] = {
+ {CW_TYPE_IPADDRESS, "loghost", 4, -1 },
+ {CW_TYPE_STR, "last-joined-ap", 32, -1 },
+ {NULL,NULL,0,0}
+};
+
+static cw_KTVStruct_t cisco_ap_led_state_config[] = {
+ {CW_TYPE_BYTE, "led-state", 1, -1},
+ {CW_TYPE_BYTE, "save-flag", 1, -1},
+ {NULL,NULL,0,0}
+};
+
+static cw_KTVEnum_t cisco_ap_telnet_ssh[] ={
+ {0, "telnet", CW_TYPE_BOOL, cw_in_generic },
+ {1, "ssh", CW_TYPE_BOOL, cw_in_generic },
+ {0,0,0,0}
+};
+
+static cw_KTVStruct_t cisco_multi_domain_cabability[]={
+ {CW_TYPE_BYTE, "reserved", 1, -1},
+ {CW_TYPE_WORD, "first-channel", 2, -1},
+ {CW_TYPE_WORD, "number-of-channels", 2, -1},
+ {CW_TYPE_WORD, "max-tx-power-level", 2, -1},
+ {NULL,NULL,0,0}
+};
+
+
+static cw_KTVStruct_t cisco_wtp_board_data[]={
+ {CW_TYPE_WORD, "card-id", 2, -1},
+ {CW_TYPE_WORD, "card-revision", 2, -1},
+ {CW_TYPE_DWORD, "wtp-model-lo", 4, -1},
+ {CW_TYPE_DWORD, "wtp-model-hi", 4, -1},
+ {CW_TYPE_STR, "wtp-serial-number", 16, -1},
+
+ {CW_TYPE_BSTR16, "ethernet-mac-address", 6, 40},
+ {NULL,NULL,0,0}
+};
+
+static cw_KTVStruct_t cisco_ap_led_flash_config[]={
+ {CW_TYPE_BYTE, "flahs-enable", 1, 0},
+ {CW_TYPE_DWORD, "flsh-sec", 4, 4},
+ {CW_TYPE_BYTE, "save-flag", 4, 8},
+
+ {NULL,NULL,0,0}
+};
+
+static cw_KTVStruct_t cisco_ap_static_ip_addr[]={
+ {CW_TYPE_IPADDRESS,"address", 4,-1},
+ {CW_TYPE_IPADDRESS,"netmask", 4,-1},
+ {CW_TYPE_IPADDRESS,"gateway", 4,-1},
+ {CW_TYPE_IPADDRESS,"unknown", 4,-1},
+ {CW_TYPE_BOOL,"enabled", 1,-1},
+ {NULL,NULL,0,0}
};
static struct cw_ElemHandler handlers[] = {
+
+ {
+ "AC Name -(zero-length allowed)", /* name */
+ CAPWAP_ELEM_AC_NAME, /* Element ID */
+ 0,0, /* Vendor / Proto */
+ 0,CAPWAP_MAX_AC_NAME_LEN, /* min/max length */
+ CW_TYPE_BSTR16, /* type */
+ "ac-name", /* Key */
+ cw_in_generic, /* get */
+ cw_out_generic /* put */
+ }
+ ,
+
+
+
{
"WTP Descriptor (Draft 7)", /* name */
CAPWAP_ELEM_WTP_DESCRIPTOR, /* Element ID */
@@ -117,7 +206,7 @@ static struct cw_ElemHandler handlers[] = {
}
,
{
- "80211 WTP Radio Information - Cisco", /* name */
+ "80211 WTP Radio Information - Cisco", /* name */
CAPWAP80211_ELEM_WTP_RADIO_INFORMATION, /* Element ID */
0, 0, /* Vendor / Proto */
0, 0, /* min/max length */
@@ -202,11 +291,188 @@ static struct cw_ElemHandler handlers[] = {
CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
0,0, /* min/max length */
cisco_lw_path_mtu, /* type */
- "cisco/lw_path_mtu", /* Key */
+ "cisco/lw-path-mtu", /* Key */
cw_in_generic_struct, /* get */
cisco_out_lw_path_mtu /* put */
}
,
+
+ {
+ "AP Uptime", /* name */
+ CISCO_ELEM_AP_UPTIME, /* Element ID */
+ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
+ 8,8, /* min/max length */
+ cisco_ap_uptime, /* type */
+ "cisco/ap-uptime", /* Key */
+ cw_in_generic_struct, /* get */
+ cw_out_generic_struct /* put */
+ }
+ ,
+
+ {
+ "AP Username and Password", /* name */
+ CISCO_LWELEM_AP_USERNAME_PASSWORD, /* Element ID */
+ CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
+ 0,0, /* min/max length */
+ cisco_ap_username_and_password, /* type */
+ "cisco/ap-username-and-password", /* Key */
+ cw_in_generic_struct, /* get */
+ cw_out_generic_struct /* put */
+ }
+ ,
+ {
+ "Loghost Config", /* name */
+ CISCO_LWELEM_AP_LOGHOST_CONFIG, /* Element ID */
+ CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
+ 36,36, /* min/max length */
+ cisco_loghost_config, /* type */
+ "cisco/loghost-config", /* Key */
+ cw_in_generic_struct, /* get */
+ cw_out_generic_struct /* put */
+ }
+ ,
+ {
+ "AP LED State COnfig", /* name */
+ CISCO_ELEM_AP_LED_STATE_CONFIG, /* Element ID */
+ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
+ 2,2, /* min/max length */
+ cisco_ap_led_state_config, /* type */
+ "cisco/ap-led-state-config", /* Key */
+ cw_in_generic_struct, /* get */
+ cw_out_generic_struct /* put */
+ }
+ ,
+ {
+ "AP Telnet SSH", /* name */
+ CISCO_LWELEM_AP_TELNET_SSH, /* Element ID */
+ CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
+ 2,2, /* min/max length */
+ cisco_ap_telnet_ssh, /* type */
+ "cisco/ap-telnet-ssh", /* Key */
+ cw_in_generic_enum, /* get */
+ NULL /* put */
+ }
+ ,
+ {
+ "AP Log Facility", /* name */
+ CISCO_ELEM_AP_LOG_FACILITY, /* Element ID */
+ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
+ 1,1, /* min/max length */
+ CW_TYPE_BYTE, /* type */
+ "cisco/ap-log-facility", /* Key */
+ cw_in_generic, /* get */
+ cw_out_generic /* put */
+ }
+ ,
+ {
+ "802.11 Multi Domain Capability", /* name */
+ CISCO_ELEM_MULTI_DOMAIN_CAPABILITY, /* Element ID */
+ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
+ 8,8, /* min/max length */
+ cisco_multi_domain_cabability, /* type */
+ "cisco-multi-domain-capability", /* Key */
+ cw_in_radio_generic_struct, /* get */
+ NULL /* put */
+ }
+ ,
+
+ {
+ "Cisco WTP Board Data", /* name */
+ CISCO_ELEM_WTP_BOARD_DATA, /* Element ID */
+ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
+ 8,48, /* min/max length */
+ cisco_wtp_board_data, /* type */
+ "cisco/wtp-board-data", /* Key */
+ cw_in_generic_struct, /* get */
+ cw_out_generic_struct, /* put */
+ },
+ {
+ "AP LED Flash Config", /* name */
+ CISCO_ELEM_AP_LED_FLASH_CONFIG, /* Element ID */
+ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
+ 0,48, /* min/max length */
+ cisco_ap_led_flash_config, /* type */
+ "cisco/ap-led-flash-config", /* Key */
+ cw_in_generic_struct, /* get */
+ cw_out_generic_struct /* put */
+ },
+
+ {
+ "AP Pre Std Switch Config", /* name */
+ CISCO_ELEM_AP_PRE_STD_SWITCH_CONFIG, /* Element ID */
+ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
+ 1,1, /* min/max length */
+ CW_TYPE_BYTE, /* type */
+ "cisco/ap-pre-std-switch-config", /* Key */
+ cw_in_generic, /* get */
+ cw_out_generic /* put */
+ },
+
+ {
+ "AP Power Injector Config", /* name */
+ CISCO_ELEM_AP_POWER_INJECTOR_CONFIG, /* Element ID */
+ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
+ 8,8, /* min/max length */
+ CW_TYPE_BSTR16, /* type */
+ "cisco/ap-power-injector-config", /* Key */
+ cw_in_generic, /* get */
+ cw_out_generic /* put */
+ },
+
+ {
+ "AP Mode And Type", /* name */
+ CISCO_ELEM_AP_MODE_AND_TYPE, /* Element ID */
+ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
+ 2,2, /* min/max length */
+ CW_TYPE_WORD, /* type */
+ "cisco/ap-mode-and-type", /* Key */
+ cw_in_generic, /* get */
+ cw_out_generic /* put */
+ },
+
+ {
+ "AP Sub Mode", /* name */
+ CISCO_LWELEM_AP_SUBMODE, /* Element ID */
+ CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
+ 1,1, /* min/max length */
+ CW_TYPE_BYTE, /* type */
+ "cisco/ap-sub-mode", /* Key */
+ cw_in_generic, /* get */
+ cw_out_generic /* put */
+ },
+ {
+ "AP Static IP Address", /* name */
+ CISCO_ELEM_AP_STATIC_IP_ADDR, /* Element ID */
+ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
+ 17,17, /* min/max length */
+ cisco_ap_static_ip_addr, /* type */
+ "cisco/ap-satic-ip-addr", /* Key */
+ cw_in_generic_struct, /* get */
+ cw_out_generic_struct /* put */
+ },
+
+ {
+ "AP Min IOS Version", /* name */
+ CISCO_ELEM_AP_MIN_IOS_VERSION, /* Element ID */
+ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
+ 0,32, /* min/max length */
+ CW_TYPE_BSTR16, /* type */
+ "cisco/ap-min-ios-version", /* Key */
+ cw_in_generic, /* get */
+ cw_out_generic /* put */
+ },
+
+ {
+ "AP Backup Software Version", /* name */
+ CISCO_ELEM_AP_BACKUP_SOFTWARE_VERSION, /* Element ID */
+ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
+ 0,32, /* min/max length */
+ CW_TYPE_BSTR16, /* type */
+ "cisco/ap-backup-software-version", /* Key */
+ cw_in_generic, /* get */
+ cw_out_generic /* put */
+ },
+
{0,0,0,0,0,0,0,0}
};
@@ -256,33 +522,64 @@ static int join_response_states[] = {CAPWAP_STATE_JOIN,0};
static struct cw_ElemDef join_response_elements[] ={
{0,CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_PATH_MTU, 0, 0},
-
+ {0,0, CAPWAP_ELEM_ECN_SUPPORT, 0, CW_DELETE},
{0,0,0,00}
};
+
+static int configuration_status_request_states[] = {CAPWAP_STATE_JOIN,0};
+static struct cw_ElemDef configuration_status_request_elements[] ={
+ {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,1, CW_IGNORE},
+
+ {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_UPTIME, 0, 0},
+ {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_LED_STATE_CONFIG, 0, 0},
+ {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_LOG_FACILITY, 0, 0},
+ {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_MULTI_DOMAIN_CAPABILITY, 0, 0},
+ {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_WTP_BOARD_DATA, 0, 0},
+ {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_LED_FLASH_CONFIG, 0, 0},
+ {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_PRE_STD_SWITCH_CONFIG, 0, 0},
+ {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_POWER_INJECTOR_CONFIG, 0, 0},
+ {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_MODE_AND_TYPE, 0, 0},
+ {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_STATIC_IP_ADDR, 0, 0},
+ {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_MIN_IOS_VERSION, 0, 0},
+ {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_BACKUP_SOFTWARE_VERSION, 0, 0},
+
+ {CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_USERNAME_PASSWORD, 1, 0},
+ {CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_LOGHOST_CONFIG, 1, 0},
+ {CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_TELNET_SSH, 1, 0},
+ {CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_SUBMODE, 1, 0},
+
+ {0,0,0,00}
+
+};
+
+
static struct cw_MsgDef messages[] = {
{
NULL, /* name */
CAPWAP_MSG_DISCOVERY_REQUEST, /* type */
- CW_ROLE_AC,
+ CW_ROLE_AC, /* role */
discovery_request_states,
- discovery_request_elements
+ discovery_request_elements,
+ NULL
},
{
NULL, /* name */
CAPWAP_MSG_DISCOVERY_RESPONSE, /* type */
CW_ROLE_WTP,
discovery_response_states,
- discovery_response_elements
+ discovery_response_elements,
+
},
{
NULL, /* name */
CAPWAP_MSG_JOIN_REQUEST, /* type */
CW_ROLE_AC,
join_request_states,
- join_request_elements
+ join_request_elements,
+ postprocess_discovery /* postprocess */
},
{
NULL, /* name */
@@ -292,15 +589,22 @@ static struct cw_MsgDef messages[] = {
join_response_elements
},
+
+ {
+ NULL, /* name */
+ CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST, /* type */
+ CW_ROLE_AC,
+ configuration_status_request_states,
+ configuration_status_request_elements,
+ NULL /* postprocess */
+ },
+
{0,0,0,0}
};
-
-
-
struct cw_MsgSet * cisco_register_msg_set(struct cw_MsgSet * set, int mode){
if (mode != CW_MOD_MODE_CAPWAP)
return NULL;
@@ -308,3 +612,30 @@ struct cw_MsgSet * cisco_register_msg_set(struct cw_MsgSet * set, int mode){
return set;
}
+
+
+static void set_ac_version(struct conn * conn)
+{
+ cw_KTV_t * wtpver;
+ char verstr[512];
+ wtpver = cw_ktv_get(conn->remote_cfg,"wtp-descriptor/software/version", CW_TYPE_BSTR16);
+ if (wtpver){
+
+ cw_format_version(verstr,wtpver->type->data(wtpver),wtpver->type->len(wtpver));
+
+ cw_dbg(DBG_INFO, "Cisco - Setting AC software version to: %s", verstr);
+
+ mavl_del(conn->local_cfg,&wtpver);
+ cw_ktv_add(conn->local_cfg,"ac-descriptor/software/version",CW_TYPE_BSTR16,
+ wtpver->type->data(wtpver),wtpver->type->len(wtpver));
+ }
+
+}
+
+static int postprocess_discovery(struct conn *conn){
+ if (conn->role != CW_ROLE_AC )
+ return 0;
+ set_ac_version(conn);
+ cw_detect_nat(conn);
+ return 1;
+}
\ No newline at end of file
diff --git a/src/mod/cisco/cisco_actions_wtp.c b/src/mod/cisco/cisco_actions_wtp.c
index e6a525e6..50837827 100644
--- a/src/mod/cisco/cisco_actions_wtp.c
+++ b/src/mod/cisco/cisco_actions_wtp.c
@@ -144,7 +144,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CW_STATE_RUN,
.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
- .elem_id = CW_ELEM_RADIO_ADMINISTRATIVE_STATE,
+ .elem_id = CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE,
.item_id = CW_RADIOITEM_ADMIN_STATE,
.start = cisco_in_radio_administrative_state,
.min_len=2,
@@ -204,7 +204,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CW_STATE_CONFIGURE,
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
- .elem_id = CW_ELEM_RADIO_ADMINISTRATIVE_STATE,
+ .elem_id = CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE,
.item_id = CW_RADIOITEM_ADMIN_STATE,
// .start = cw_in_radio_generic,
.start = cisco_in_radio_administrative_state,
diff --git a/src/mod/cisco/lwapp_cisco.h b/src/mod/cisco/lwapp_cisco.h
index 111fa15d..13e123fa 100644
--- a/src/mod/cisco/lwapp_cisco.h
+++ b/src/mod/cisco/lwapp_cisco.h
@@ -28,16 +28,16 @@
* Vendor specific message elements defined in LWAPP by Cisco
*/
-#define LW_CISCO_AP_USERNAME_PASSWORD 18
+#define CISCO_LWELEM_AP_USERNAME_PASSWORD 18
#define LW_CISCO_MANAGER_IP_ADDR 19
#define LW_CISCO_RADIO_MODULE_INFO 21
#define LW_CISCO_AC_IP_ADDR_WITH_INDEX 32
#define LW_CISCO_AP_ETHERNET_PORT_SUBTYPE 34
-#define LW_CISCO_AP_LOGHOST_CONFIG 36
+#define CISCO_LWELEM_AP_LOGHOST_CONFIG 36
#define LW_CISCO_MCAST_MGID_INFO 39
-#define LW_CISCO_TELNET_SSH 44
-#define LW_CISCO_AP_SUBMODE 67
+#define CISCO_LWELEM_AP_TELNET_SSH 44
+#define CISCO_LWELEM_AP_SUBMODE 67
#define LW_CISCO_AP_HEARTBEAT_TIMEOUT 68
#define LW_CISCO_PRIMED_DISCOVERY_TIMEOUT 50
diff --git a/src/mod/fortinet/fortinet_actions_wtp.c b/src/mod/fortinet/fortinet_actions_wtp.c
index c81b9998..94db52e3 100644
--- a/src/mod/fortinet/fortinet_actions_wtp.c
+++ b/src/mod/fortinet/fortinet_actions_wtp.c
@@ -122,7 +122,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CW_STATE_RUN,
.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
- .elem_id = CW_ELEM_RADIO_ADMINISTRATIVE_STATE,
+ .elem_id = CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE,
.item_id = CW_ITEM_RADIO_ADMINISTRATIVE_STATE,
.start = cisco_in_radio_administrative_state_wtp,
.mand = 1