We can join an 1131 AP, and bring up a WLAN

data channel is currently missing
This commit is contained in:
7u83 2022-09-01 23:09:33 +02:00
parent 5ed35979cd
commit 27506fa788
9 changed files with 149 additions and 20 deletions

View File

@ -106,6 +106,42 @@ radio-cfg-a/capwap80211/wtp-radio-config/country-str2: "DE "
radio-cfg-a/capwap80211/wtp-radio-config/occupancy-limit: 100
radio-cfg-a/capwap80211/wtp-radio-config/reg: 167772416
radio-cfg-a/cisco/direct-sequence-control/cfg-type: 1 - global
radio-cfg-a/cisco/direct-sequence-control/current-cca-mode: 0
radio-cfg-a/cisco/direct-sequence-control/current-channel: 1
radio-cfg-a/cisco/direct-sequence-control/energy-detect-threshold: -50
#mode-802.11g support
radio-cfg-a/cisco/direct-sequence-control/unknown: 1
radio-cfg-a/cisco/mac-operation/fragmentation-threshold: 2346
radio-cfg-a/cisco/mac-operation/long-retry: 4
radio-cfg-a/cisco/mac-operation/reserved: 1
radio-cfg-a/cisco/mac-operation/rts-threshold: 2347
radio-cfg-a/cisco/mac-operation/rx-msdu-lifetime: 512
radio-cfg-a/cisco/mac-operation/short-retry: 7
radio-cfg-a/cisco/mac-operation/tx-msdu-lifetime: 512
radio-cfg-a/cisco/multi-domain-capability/first-channel: 1
radio-cfg-a/cisco/multi-domain-capability/max-tx-power-level: 65535
radio-cfg-a/cisco/multi-domain-capability/number-of-channels: 13
radio-cfg-a/cisco/multi-domain-capability/reserved: 1
radio-cfg-a/capwap80211/rate-set: .x82848b960c1218243048606c
radio-cfg-a/cisco/antenna-payload/802-11n-rx-antennas: 3
radio-cfg-a/cisco/antenna-payload/802-11n-tx-antennas: 7
radio-cfg-a/cisco/antenna-payload/antenna-cnt: 2
radio-cfg-a/cisco/antenna-payload/antenna-mode: 3
radio-cfg-a/cisco/antenna-payload/antenna.0: 1 - Internal Antenna
radio-cfg-a/cisco/antenna-payload/antenna.1: 1 - Internal Antenna
radio-cfg-a/cisco/antenna-payload/diversity-selection: 255
radio-cfg-a/cisco/antenna-payload/unknown: 0
radio-cfg-b/capwap80211/wtp-radio-config/beacon-period: 100
radio-cfg-b/capwap80211/wtp-radio-config/bssid: .x003a9902fac0
radio-cfg-b/capwap80211/wtp-radio-config/cfg-period: 4

View File

@ -615,7 +615,7 @@ struct cw_Cfg_entry *cw_cfg_iter_next(struct cw_Cfg_iter *cfi, const char *nnkey
{
struct cw_Cfg_entry *e;
int bl, kl;
const char *d;
// const char *d;
e = mavliter_get(&(cfi->it));
if (e == NULL){
return NULL;
@ -688,7 +688,7 @@ uint8_t cw_cfg_get_byte_l(cw_Cfg_t ** cfgs, char *key, uint8_t def)
return v.val.byte;
}
uint16_t cw_cfg_get_int(cw_Cfg_t * cfg, const char *key, int def)
int cw_cfg_get_int(cw_Cfg_t * cfg, const char *key, int def)
{
const char *s = cw_cfg_get(cfg,key,NULL);
if (s==NULL)

View File

@ -89,7 +89,7 @@ void cw_cfg_del(cw_Cfg_t * cfg, const char *key);
int cw_cfg_get_first_index(cw_Cfg_t * cfg, const char *key, int n);
int cw_cfg_get_first_index_l(cw_Cfg_t ** cfgs, const char *key, int n);
uint16_t cw_cfg_get_int(cw_Cfg_t * cfg, const char *key, int def);
int cw_cfg_get_int(cw_Cfg_t * cfg, const char *key, int def);

View File

@ -0,0 +1,68 @@
#include "cw/mod.h"
#include "cw/log.h"
#include "cw/dbg.h"
#include "cw/val.h"
#include "cw/keys.h"
#include "cw/dtls.h"
#include "cw/cfg.h"
#include "mod_capwap.h"
static int init(struct cw_Mod * mod, cw_Cfg_t * global_cfg, int role)
{
cw_dbg(DBG_INFO,"CAPWAP: Inititalizing mod_capwap.");
switch (role){
case CW_ROLE_AC:{
cw_dbg(DBG_MOD, "CAPWAP: Initialiazing mod_capwap in AC mode");
cw_cfg_set(global_cfg,
"capwap/ac-descriptor/hardware/version",
"0.0.0.1");
cw_cfg_set(global_cfg,
"capwap/ac-descriptor/hardware/vendor","0");
cw_cfg_set(global_cfg,
"capwap/ac-descriptor/software/version","0.0.0.1");
cw_cfg_set(global_cfg,
"capwap/ac-descriptor/software/vendor", "0");
}
break;
}
return 1;
}
static int detect(struct cw_Conn *conn, const uint8_t * rawmsg, int rawlen, int elems_len,
struct sockaddr *from, int mode)
{
if (mode != CW_MOD_MODE_CAPWAP)
return 0;
cw_dbg(DBG_MOD,"CAPWAP detected: yes");
return 1;
}
int static setup_cfg(struct cw_Conn * conn)
{
int security;
security = cw_setup_dtls(conn,conn->local_cfg,"capwap",CAPWAP_CIPHER);
// stop();
cw_cfg_set_int(conn->local_cfg,"ac-descriptor/security",security);
return 0;
}
struct cw_Mod mod_capwap = {
"capwap", /* name */
init, /* init */
detect, /* detect */
capwap_register_msg_set, /* register_messages */
NULL, /* dll_handle */
NULL, /* data */
setup_cfg /* setup_cfg */
};

View File

@ -37,7 +37,7 @@
#define CISCO_ELEM_RAD_NAME LWAPP_ELEM_WTP_NAME /* 5 */
#define CW_CISCO_MWAR LW_ELEM_AC_DESCRIPTOR /* 6 */
#define CISCO_ELEM_ADD_WLAN LW_ELEM_80211_ADD_WLAN /* 7 */
#define CISCO_ELEM_WTP_RADIO_CONFIGURATION 8 /* 9 */
#define CISCO_ELEM_WTP_RADIO_CONFIGURATION 8 /* 8 */
#define CISCO_ELEM_9 9 /* 9 */

View File

@ -2530,7 +2530,7 @@ static struct cw_ElemDef configuration_status_response_elements[] ={
{0,CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_MULTI_DOMAIN_CAPABILITY, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_WTP_RADIO_CONFIGURATION, 1, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_WTP_RADIO_CONFIGURATION, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_DIRECT_SEQUENCE_CONTROL, 0, 0},
{0, CW_VENDOR_ID_CISCO, CW_CISCO_ANTENNA_PAYLOAD, 0, 0},
@ -3339,7 +3339,8 @@ static int copy_diff_cfg(cw_Cfg_t * new, cw_Cfg_t *old , cw_Cfg_t *dst)
if (strcmp(r,e->val)==0)
continue;
cw_dbg(DBG_CFG_UPDATES,"Status reps: %s: %s -> %s",e->key,r,e->val);
cw_dbg(DBG_CFG_UPDATES,"Configuration Status Response: %s: %s -> %s",e->key,r,e->val);
cw_cfg_set(dst,e->key,e->val);
}
return 0;
@ -3372,11 +3373,11 @@ void cw_cfg_copy_sub(cw_Cfg_t *src,const char *src_prefix, cw_Cfg_t *dst, const
static int status_cb_ac(struct cw_ElemHandlerParams *params, struct cw_MsgCb_data *d)
{
cw_Cfg_t * tmp_cfg;
int i;
int i,wtp_ri;
tmp_cfg = cw_cfg_create();
if (tmp_cfg==NULL){
cw_log(LOG_ERROR, "Can't allocat memory for tmp_cfg");
cw_log(LOG_ERROR, "Can't allocate memory for tmp_cfg");
return CAPWAP_RESULT_CONFIGURATION_FAILURE_SERVICE_NOT_PROVIDED;
}
@ -3388,7 +3389,12 @@ static int status_cb_ac(struct cw_ElemHandlerParams *params, struct cw_MsgCb_dat
char dst[64],src[64];
char key[CW_CFG_MAX_KEY_LEN];
int ri;
char ri_str[6];
/* Ignore radio config for AP */
if (i==255){
cw_dbg(DBG_X, "Ignore Radio 2555");
continue;
}
/* Merge default radio information for current radio */
sprintf(dst,"radio.%d/",i);
@ -3397,27 +3403,46 @@ static int status_cb_ac(struct cw_ElemHandlerParams *params, struct cw_MsgCb_dat
/* Get capwap radio radio information */
sprintf(key,"radio.%d/capwap80211/wtp-radio-information",i);
ri = cw_cfg_get_int(params->cfg,key,-1);
if (ri==-1)
wtp_ri = cw_cfg_get_int(params->conn->remote_cfg,key,-1);
if (wtp_ri==-1)
continue;
/* Merge cfg for each radio type this AP supports */
ri=0;
cw_dbg(DBG_X,"Radio %d: %d",i,wtp_ri);
/* Merge cfg for each radio type of this AP supports */
for (ri=1; ri<16; ri=ri<<1){
char ri_str[6];
if (!(ri&wtp_ri))
continue;
cw_format_radio_information(ri_str,ri);
sprintf(src,"radio-%s",ri_str);
if (cw_cfg_base_exists(params->conn->global_cfg,key))
ri|=i;
sprintf(src,"radio-cfg-%s",ri_str);
cw_dbg(DBG_X,"TRY COPY %d %s",i,src);
if (!cw_cfg_base_exists(params->conn->global_cfg,src))
continue;
cw_dbg(DBG_X,"Do copy");
cw_cfg_copy_sub(params->conn->global_cfg,src,tmp_cfg,dst);
}
sprintf(src,"radio-cfg-%s",ri_str);
cw_cfg_copy_sub(params->conn->global_cfg,src,tmp_cfg,dst);
}
printf("----\n");
cw_cfg_dump(tmp_cfg);
printf("----\n");
// stop();
copy_diff_cfg(tmp_cfg,params->conn->remote_cfg, params->conn->update_cfg);
cw_cfg_dump(params->conn->update_cfg);
cw_cfg_destroy(tmp_cfg);
return 0;
}

View File

@ -28,7 +28,7 @@ int configure(struct cw_Conn * conn)
char sockbuff[SOCK_ADDR_BUFSIZE];
cw_conn_set_msg_cb(conn,CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,config_cb);
cw_conn_register_msg_cb(conn,CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,config_cb);
int rc;
cw_cfg_copy(conn->global_cfg,conn->update_cfg,0,"");

View File

@ -75,7 +75,7 @@ static struct cw_DiscoveryResults * run_discovery(struct cw_Conn *conn)
/*discovery_results = mlist_create(NULL, NULL, sizeof(void *));*/
conn->data = results;
cw_conn_set_msg_cb(conn,CAPWAP_MSG_DISCOVERY_RESPONSE,discovery_cb);
cw_conn_register_msg_cb(conn,CAPWAP_MSG_DISCOVERY_RESPONSE,discovery_cb);
while (!cw_timer_timeout(timer)

View File

@ -79,7 +79,7 @@ int run(struct cw_Conn * conn)
{
cw_conn_set_msg_cb(conn,CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,update_cb);
cw_conn_register_msg_cb(conn,CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,update_cb);
conn->capwap_state = CAPWAP_STATE_RUN;