More Cisco actionsadded.

FossilOrigin-Name: 063446c7f3a86b125941b7787a3e6d0703dade946b00ab874146562a29e38b38
This commit is contained in:
7u83@mail.ru 2016-03-11 08:40:01 +00:00
parent dcc941647f
commit c06763c8a1
3 changed files with 141 additions and 27 deletions

View File

@ -338,7 +338,7 @@ static cw_action_in_t actions_in[] = {
}
,
/* Result Code */
/* Result Code - Change State Event Req */
{
.capwap_state = CW_STATE_CONFIGURE,
.msg_id= CW_MSG_CHANGE_STATE_EVENT_REQUEST,
@ -351,7 +351,7 @@ static cw_action_in_t actions_in[] = {
}
,
/* Radio Poprational State */
/* Radio Poprational State - Change State Event Req */
{
.capwap_state = CW_STATE_CONFIGURE,
.msg_id= CW_MSG_CHANGE_STATE_EVENT_REQUEST,
@ -365,6 +365,18 @@ static cw_action_in_t actions_in[] = {
,
/* Vendor Specific Payload - Change State Req*/
{
.capwap_state = CW_STATE_CONFIGURE,
.msg_id = CW_MSG_CHANGE_STATE_EVENT_REQUEST,
.elem_id = CW_ELEM_VENDOR_SPECIFIC_PAYLOAD,
.start = cw_in_vendor_specific_payload,
.min_len=7
}
,
/* --------------------------------------------------------------------------
* Echo Request

View File

@ -22,10 +22,10 @@
#include "cw/action.h"
#include "cw/capwap_items.h"
#include "capwap_actions.h"
#include "cw/strheap.h"
#include "cw/radio.h"
#include "cw/capwap_cisco.h"
#include "cw/capwap80211.h"
#include "mod_cisco.h"
#include "cisco.h"
@ -33,7 +33,10 @@
static cw_action_in_t actions_in[] = {
/* ------------------------------------------------------------------------------- */
/* --------------------------------------------------------
* Discovery Resquest
*/
/* Message Discovery Request */
{
.capwap_state = CW_STATE_DISCOVERY,
@ -67,11 +70,15 @@ static cw_action_in_t actions_in[] = {
}
,
/* ----------------------------------
* Join Request
/* --------------------------------------------------------
* Discovery Resquest
*/
/* Element WTP Descriptor - Join Request */
/* WTP Descriptor - Join Request */
{
.capwap_state = CW_STATE_JOIN,
.msg_id = CW_MSG_JOIN_REQUEST,
@ -82,8 +89,9 @@ static cw_action_in_t actions_in[] = {
}
,
/* Element Session ID - Join Request */
/* Session ID - Join Request */
{
/* Cisco uses 4 byte session ids */
.capwap_state = CW_STATE_JOIN,
.msg_id = CW_MSG_JOIN_REQUEST,
.elem_id = CW_ELEM_SESSION_ID,
@ -137,6 +145,24 @@ static cw_action_in_t actions_in[] = {
,
/* --------------------------------------------------------
* Configuration Status Request
*/
/* AC Name - Config Status Request */
{
/* We have to deal with zero-length strings */
.capwap_state = CW_STATE_CONFIGURE,
.msg_id = CW_MSG_CONFIGURATION_STATUS_REQUEST,
.elem_id = CW_ELEM_AC_NAME,
.item_id = CW_ITEM_AC_NAME,
.start = cw_in_generic2,
.min_len = 0,
.max_len = 512,
.mand = 1
}
,
@ -179,6 +205,29 @@ static cw_action_out_t actions_out[]={
};
static cw_action_in_t actions80211_in[] = {
/* --------------------------------------------------------
* Discovery Resquest
*/
/* 802.11 Radio Inmformation - Discovery Request */
{
/* Cisco doe't sned this message element in discovery request,
so make it non-mandatory */
.capwap_state = CW_STATE_DISCOVERY,
.msg_id = CW_MSG_DISCOVERY_REQUEST,
.elem_id = CW_ELEM80211_WTP_RADIO_INFORMATION,
.item_id = "radio_information",
.start = cw_in_radio_generic,
.mand = 0,
.min_len = 5,
.max_len = 5
}
,
};
#include "cw/item.h"
@ -216,3 +265,28 @@ int cisco_register_actions_ac(struct cw_actiondef *def)
return rc;
}
int cisco_register_actions80211_ac(struct cw_actiondef *def)
{
int rc;
rc=0;
rc = cw_actionlist_in_register_actions(def->in, actions80211_in);
/* rc += cw_actionlist_out_register_actions(def->out, actions_out);
rc += cw_strheap_register_strings(def->strmsg, capwap_strings_msg);
rc += cw_strheap_register_strings(def->strelem, cipwap_strings_elem);
rc += cw_itemdefheap_register(def->items, _capwap_itemdefs);
rc += cw_itemdefheap_register(def->radioitems, capwap_radioitemdefs);
intavltree_add(def->wbids, 0);
*/
return rc;
}

View File

@ -10,26 +10,44 @@
#include "../modload.h"
static struct cw_actiondef actions;
extern int cisco_register_actions80211_ac(struct cw_actiondef *def);
extern int cisco_register_actions_ac(struct cw_actiondef *def);
static int register_actions(struct cw_actiondef *actions,int mode)
static int register_actions(struct cw_actiondef *actions, int mode)
{
if (mode != MOD_MODE_CAPWAP)
return 0;
switch (mode) {
case MOD_MODE_CAPWAP:
{
struct mod_ac *cmod = modload_ac("capwap");
if (!cmod) {
cw_log(LOG_ERR,
"Can't initzialize mod_cisco, failed to load base mod mod_capwap");
return 1;
}
cmod->register_actions(actions, MOD_MODE_CAPWAP);
int rc = cisco_register_actions_ac(actions);
cw_dbg(DBG_INFO, "Initialized mod cisco with %d actions", rc);
return 0;
}
case MOD_MODE_BINDINGS:
{
struct mod_ac *cmod = modload_ac("capwap80211");
if (!cmod) {
cw_log(LOG_ERR,
"Can't initzialize mod_cisco, failed to load base mod mod_capwap80211");
return 1;
}
cmod->register_actions(actions, MOD_MODE_BINDINGS);
int rc = cisco_register_actions80211_ac(actions);
cw_dbg(DBG_INFO, "Initialized mod cisco 80211 with %d actions", rc);
return 0;
}
struct mod_ac *cmod = modload_ac("capwap");
if (!cmod) {
cw_log(LOG_ERR,
"Can't initzialize mod_cisco, failed to load base mod mod_capwap");
return 1;
}
cmod->register_actions(actions,MOD_MODE_CAPWAP);
int rc = cisco_register_actions_ac(actions);
cw_dbg(DBG_INFO, "Initialized mod cisco with %d actions", rc);
return 0;
@ -40,7 +58,7 @@ static int register_actions(struct cw_actiondef *actions,int mode)
static int init()
{
cw_dbg(DBG_INFO, "Initialiazing mod_cisco ...");
// struct mod_ac *cmod = modload_ac("capwap");
// struct mod_ac *cmod = modload_ac("capwap");
return 1;
}
@ -64,8 +82,13 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
if (id == CW_ELEM_VENDOR_SPECIFIC_PAYLOAD) {
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");
// conn->actions = &actions;
if (mode == MOD_MODE_CAPWAP) {
cw_dbg(DBG_MOD, "CISCO capwap detected: yes");
} else {
cw_dbg(DBG_MOD, "CISCO bindings detected: yes");
}
return 1;
}
@ -74,7 +97,12 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
}
cw_dbg(DBG_MOD,"CISCO detected: no");
if (mode == MOD_MODE_CAPWAP) {
cw_dbg(DBG_MOD, "CISCO capwap detected: no");
} else {
cw_dbg(DBG_MOD, "CISCO bindings detected: no");
}
return 0;
}