Improved CAPWAP AC Descriptr handling
This commit is contained in:
@ -9,15 +9,12 @@ int capwap_in_ac_descriptor(struct cw_ElemHandler *eh,
|
||||
struct cw_ElemHandlerParams *params,
|
||||
uint8_t * data, int len)
|
||||
{
|
||||
stop();
|
||||
|
||||
static struct cw_DescriptorSubelemDef allowed[] = {
|
||||
{0,CAPWAP_SUBELEM_AC_HARDWARE_VERSION, "hardware", 1024,1},
|
||||
{0,CAPWAP_SUBELEM_AC_SOFTWARE_VERSION, "software", 1024,1},
|
||||
{0,0, NULL,0, 0}
|
||||
};
|
||||
|
||||
|
||||
return cw_read_ac_descriptor(params->cfg,eh,params,data,len,allowed);
|
||||
|
||||
}
|
||||
|
@ -3,74 +3,27 @@
|
||||
#include "cw/dbg.h"
|
||||
#include "cw/conn.h"
|
||||
|
||||
|
||||
|
||||
#include "cw/capwap.h"
|
||||
#include "cw/cw.h"
|
||||
#include "cw/val.h"
|
||||
#include "cw/keys.h"
|
||||
|
||||
|
||||
|
||||
static int put_ac_status(mavl_t global, mavl_t local, uint8_t *dst, const char * parent_key){
|
||||
|
||||
stop();
|
||||
|
||||
uint8_t *d = dst;
|
||||
|
||||
char key[CW_CFG_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_byte(d,cw_ktv_get_byte(global,"ac-descriptor/security",0));
|
||||
/*
|
||||
security = 0;
|
||||
if (cw_ktv_get(local,"dtls-cert-file",CW_TYPE_BSTR16))
|
||||
security |= CAPWAP_FLAG_AC_SECURITY_X;
|
||||
|
||||
if (cw_ktv_get(local,"dtls-psk",CW_TYPE_BSTR16))
|
||||
security |= CAPWAP_FLAG_AC_SECURITY_S;
|
||||
|
||||
if (security == 0){
|
||||
cw_log(LOG_WARNING,"No AC security selected");
|
||||
}
|
||||
d += cw_put_byte(dst,security);
|
||||
*/
|
||||
sprintf(key,"%s/%s",parent_key,CW_SKEY_RMAC_FIELD);
|
||||
d += cw_put_byte(d,cw_ktv_get_byte(local,key,0));
|
||||
|
||||
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));
|
||||
|
||||
return d - dst;
|
||||
}
|
||||
|
||||
#include "mod_capwap.h"
|
||||
|
||||
int capwap_out_ac_descriptor(struct cw_ElemHandler * eh,
|
||||
struct cw_ElemHandlerParams * params, uint8_t * dst)
|
||||
{
|
||||
stop();
|
||||
/* int len,l;
|
||||
int len,l;
|
||||
uint8_t *d = dst+4;
|
||||
char key[CW_CFG_MAX_KEY_LEN];
|
||||
|
||||
d+=put_ac_status(params->cfg,
|
||||
params->global_cfg,
|
||||
d, eh->key);
|
||||
d+=cw_put_ac_status(d, params->cfg_list, eh->key);
|
||||
|
||||
sprintf(key,"%s/%s",eh->key,CW_SKEY_HARDWARE);
|
||||
d+=cw_write_descriptor_subelem (d, params->cfg,
|
||||
d+=cw_put_descriptor_subelem (d, params->cfg_list,
|
||||
CAPWAP_SUBELEM_AC_HARDWARE_VERSION, key);
|
||||
|
||||
sprintf(key,"%s/%s",eh->key,CW_SKEY_SOFTWARE);
|
||||
d+=cw_write_descriptor_subelem (d, params->cfg,
|
||||
d+=cw_put_descriptor_subelem (d, params->cfg_list,
|
||||
CAPWAP_SUBELEM_AC_SOFTWARE_VERSION, key);
|
||||
|
||||
len = d-dst-4;
|
||||
@ -78,6 +31,5 @@ int capwap_out_ac_descriptor(struct cw_ElemHandler * eh,
|
||||
l = len + cw_put_elem_hdr(dst,eh->id,len);
|
||||
cw_dbg_elem(DBG_ELEM_OUT,NULL,params->msgdata->type,eh,dst,l);
|
||||
return l;
|
||||
*/
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
@ -50,7 +50,6 @@ int static setup_cfg(struct cw_Conn * conn)
|
||||
security = cw_setup_dtls(conn,conn->local_cfg,"capwap",CAPWAP_CIPHER);
|
||||
|
||||
|
||||
printf ("ROLE: %d\n",conn->role);
|
||||
// stop();
|
||||
// cw_ktv_set_byte(conn->local_cfg,"ac-descriptor/security",security);
|
||||
|
||||
|
Reference in New Issue
Block a user