handlers for header_len and write_headr in conn
FossilOrigin-Name: 672de93a2c0d038b6d8c9104a8e0b4fdacbe7f181485ee2f185cb81626876391
This commit is contained in:
@ -35,7 +35,7 @@ static cw_KTVStruct_t wtp_reboot_statistics[] = {
|
||||
{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},
|
||||
{CW_TYPE_BYTE, "last-failure-type", 1,-1},
|
||||
{NULL,NULL,0,0}
|
||||
};
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
#define CW_CISCO_AP_MODEL 127
|
||||
#define CW_CISCO_AP_RESET_BUTTON_STATE 128
|
||||
|
||||
#define CW_CISCO_AP_REGULATORY_DOMAIN 126
|
||||
#define CISCO_ELEM_AP_REGULATORY_DOMAIN 126
|
||||
|
||||
#define CW_CISCO_LWAPP_CHANNEL_POWER 134
|
||||
#define CW_CISCO_AP_CORE_DUMP 135
|
||||
|
@ -122,6 +122,14 @@ static cw_KTVStruct_t cisco_ap_static_ip_addr[]={
|
||||
};
|
||||
|
||||
|
||||
static cw_KTVStruct_t cisco_ap_regulatory_domain[]={
|
||||
{CW_TYPE_BOOL,"set",1,-1},
|
||||
{CW_TYPE_BYTE,"slot",1,-1},
|
||||
{CW_TYPE_BYTE,"code0",1,-1},
|
||||
{CW_TYPE_BYTE,"code1",1,-1},
|
||||
{NULL,NULL,0,0}
|
||||
};
|
||||
|
||||
static struct cw_ElemHandler handlers[] = {
|
||||
|
||||
{
|
||||
@ -472,6 +480,30 @@ static struct cw_ElemHandler handlers[] = {
|
||||
cw_in_generic, /* get */
|
||||
cw_out_generic /* put */
|
||||
},
|
||||
|
||||
{
|
||||
"AP Ethernet Port Type", /* name */
|
||||
CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE, /* Element ID */
|
||||
CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
|
||||
3,3, /* min/max length */
|
||||
CW_TYPE_BSTR16, /* type */
|
||||
"cisco/ap-ethernet-port-type", /* Key */
|
||||
cw_in_generic, /* get */
|
||||
cw_out_generic /* put */
|
||||
},
|
||||
|
||||
{ /* it's wrong to store the reg domain in radio/xy/...
|
||||
and has to be corected in the future */
|
||||
|
||||
"AP Regulatory Domain", /* name */
|
||||
CISCO_ELEM_AP_REGULATORY_DOMAIN, /* Element ID */
|
||||
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
|
||||
5,5, /* min/max length */
|
||||
cisco_ap_regulatory_domain, /* type */
|
||||
"cisco/regulatory-domain", /* Key */
|
||||
cw_in_radio_generic_struct, /* get */
|
||||
NULL /* put */
|
||||
},
|
||||
|
||||
{0,0,0,0,0,0,0,0}
|
||||
|
||||
@ -520,8 +552,10 @@ static struct cw_ElemDef join_request_elements[] ={
|
||||
|
||||
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},
|
||||
{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}
|
||||
@ -545,11 +579,13 @@ static struct cw_ElemDef configuration_status_request_elements[] ={
|
||||
{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},
|
||||
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_REGULATORY_DOMAIN, 1, 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},
|
||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE, 1, 0},
|
||||
|
||||
{0,0,0,00}
|
||||
|
||||
@ -561,9 +597,9 @@ static struct cw_MsgDef messages[] = {
|
||||
NULL, /* name */
|
||||
CAPWAP_MSG_DISCOVERY_REQUEST, /* type */
|
||||
CW_ROLE_AC, /* role */
|
||||
discovery_request_states,
|
||||
discovery_request_elements,
|
||||
NULL
|
||||
discovery_request_states, /* states */
|
||||
discovery_request_elements, /* elements */
|
||||
postprocess_discovery /* postprocess fun */
|
||||
},
|
||||
{
|
||||
NULL, /* name */
|
||||
|
@ -20,12 +20,12 @@ static int put_ac_status(mavl_t global, mavl_t local, uint8_t *dst, const char *
|
||||
char key[CW_KTV_MAX_KEY_LEN];
|
||||
|
||||
|
||||
d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/stations",0));
|
||||
d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/station-limit",0));
|
||||
d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/active-wtps",0));
|
||||
d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/max-wtps",0));
|
||||
d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/stations",0));
|
||||
d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/station-limit",0));
|
||||
d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/active-wtps",0));
|
||||
d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/max-wtps",0));
|
||||
|
||||
d += cw_put_byte(d,cw_ktv_get_byte(global,"ac-descriptor/security",0));
|
||||
d += cw_put_byte(d,cw_ktv_get_byte(local,"ac-descriptor/security",0));
|
||||
/*
|
||||
security = 0;
|
||||
if (cw_ktv_get(local,"dtls-cert-file",CW_TYPE_BSTR16))
|
||||
@ -40,14 +40,14 @@ static int put_ac_status(mavl_t global, mavl_t local, uint8_t *dst, const char *
|
||||
d += cw_put_byte(dst,security);
|
||||
*/
|
||||
sprintf(key,"%s/%s",parent_key,"ac-descriptor/r-mac-field");
|
||||
d += cw_put_byte(d,cw_ktv_get_byte(global,"ac-descriptor/r-mac-field",0));
|
||||
d += cw_put_byte(d,cw_ktv_get_byte(local,"ac-descriptor/r-mac-field",0));
|
||||
/*d += cw_put_byte(d,3);*/
|
||||
|
||||
d += cw_put_byte(d,0);
|
||||
|
||||
|
||||
sprintf(key,"%s/%s",parent_key,CW_SKEY_DTLS_POLICY);
|
||||
d += cw_put_byte(d,cw_ktv_get_byte(local,key,0));
|
||||
d += cw_put_byte(d,cw_ktv_get_byte(local,"ac-descriptor/dtls-policy",0));
|
||||
|
||||
return d - dst;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
#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 CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE 34
|
||||
#define CISCO_LWELEM_AP_LOGHOST_CONFIG 36
|
||||
#define LW_CISCO_MCAST_MGID_INFO 39
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "cw/vendors.h"
|
||||
|
||||
#include "mod_cisco.h"
|
||||
|
||||
#include "capwap_cisco.h"
|
||||
|
||||
/*
|
||||
extern int cisco_register_actions80211_ac(struct cw_actiondef *def);
|
||||
@ -58,6 +58,7 @@ static struct cw_MsgSet * register_messages(struct cw_MsgSet *set, int mode)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
static void errfunc(cfg_t *cfg, const char *fmt, va_list ap){
|
||||
|
||||
if (cfg && cfg->filename && cfg->line)
|
||||
@ -66,21 +67,22 @@ static void errfunc(cfg_t *cfg, const char *fmt, va_list ap){
|
||||
else if (cfg && cfg->filename)
|
||||
cw_log(LOG_ERR, "MOD Cisco cfg file in %s:", cfg->filename);
|
||||
}
|
||||
*/
|
||||
|
||||
static int init(struct cw_Mod *mod, mavl_t global_cfg, int role)
|
||||
{
|
||||
uint8_t * str;
|
||||
/* uint8_t * str;*/
|
||||
static char * hardware_version; /*strdup(".x01000001");*/
|
||||
static char * software_version; /* = NULL; */
|
||||
cfg_t *cfg;
|
||||
/* cfg_t *cfg;*/
|
||||
|
||||
int rc = 1;
|
||||
cfg_opt_t opts[] = {
|
||||
/* cfg_opt_t opts[] = {
|
||||
CFG_SIMPLE_STR("hardware_version", &hardware_version),
|
||||
CFG_SIMPLE_STR("software_version",&software_version),
|
||||
CFG_END()
|
||||
};
|
||||
|
||||
*/
|
||||
cw_dbg(DBG_INFO, "CISCO: Initialiazing mod_cisco ...");
|
||||
cw_dbg(DBG_MOD, "CISCO: Loading base module: capwap");
|
||||
|
||||
@ -191,10 +193,38 @@ static struct cw_Mod capwap_ac = {
|
||||
};
|
||||
*/
|
||||
|
||||
static int write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len)
|
||||
{
|
||||
if (handler->proto == 0){
|
||||
if (handler->vendor)
|
||||
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
||||
|
||||
return len + cw_put_elem_hdr(dst, handler->id, len);
|
||||
}
|
||||
/* put the lwap elem header */
|
||||
lw_set_dword(dst + 10, handler->vendor);
|
||||
lw_set_word(dst + 14, handler->id);
|
||||
return len + 6 + cw_put_elem_vendor_hdr(dst, handler->vendor,
|
||||
CISCO_ELEM_SPAM_VENDOR_SPECIFIC, len+6);
|
||||
|
||||
}
|
||||
|
||||
static int header_len(struct cw_ElemHandler * handler)
|
||||
{
|
||||
if (handler->proto==0)
|
||||
return handler->vendor ? 10 : 4;
|
||||
|
||||
return 16;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int static setup_cfg(struct conn * conn)
|
||||
{
|
||||
int security;
|
||||
|
||||
conn->write_header=write_header;
|
||||
conn->header_len=header_len;
|
||||
|
||||
security = cw_setup_dtls(conn,conn->local_cfg,"cisco",CAPWAP_CIPHER);
|
||||
cw_ktv_set_byte(conn->local_cfg,"ac-descriptor/security",security);
|
||||
|
Reference in New Issue
Block a user