2016-02-27 14:25:23 +01:00
|
|
|
#include "cw.h"
|
2016-02-27 10:49:06 +01:00
|
|
|
|
2016-02-27 14:25:23 +01:00
|
|
|
#include "capwap.h"
|
2018-03-17 17:29:09 +01:00
|
|
|
|
2016-02-27 14:25:23 +01:00
|
|
|
#include "dbg.h"
|
2022-07-31 17:15:32 +02:00
|
|
|
#include "val.h"
|
2018-03-17 12:32:40 +01:00
|
|
|
#include "keys.h"
|
2016-02-27 14:25:23 +01:00
|
|
|
|
|
|
|
|
2018-03-06 03:08:14 +01:00
|
|
|
static struct cw_DescriptorSubelemDef allowed_default[] = {
|
2018-03-17 12:32:40 +01:00
|
|
|
{0,CW_SUBELEM_WTP_HARDWARE_VERSION, CW_SKEY_HARDWARE, 1024,1},
|
|
|
|
{0,CW_SUBELEM_WTP_SOFTWARE_VERSION, CW_SKEY_SOFTWARE, 1024,1},
|
|
|
|
{0,CW_SUBELEM_WTP_BOOTLOADER_VERSION, CW_SKEY_BOOTLOADER, 1024,1},
|
|
|
|
{0,CW_SUBELEM_WTP_OTHERSOFTWARE_VERSION, CW_SKEY_OTHER_SOFTWARE, 1024,0},
|
2018-03-06 03:08:14 +01:00
|
|
|
{0,0, NULL, 0,0}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2022-08-22 01:59:23 +02:00
|
|
|
int cw_read_wtp_descriptor(cw_Cfg_t * cfg, struct cw_Conn *conn,
|
2018-03-06 03:08:14 +01:00
|
|
|
struct cw_ElemHandler *eh, uint8_t * data, int len,
|
|
|
|
struct cw_DescriptorSubelemDef *allowed)
|
2016-02-27 14:25:23 +01:00
|
|
|
{
|
2018-03-11 00:56:41 +01:00
|
|
|
|
2016-02-27 14:25:23 +01:00
|
|
|
|
2018-03-06 03:08:14 +01:00
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
int ncrypt, pos,i;
|
|
|
|
char key[64];
|
2018-03-11 00:56:41 +01:00
|
|
|
|
2016-02-27 14:25:23 +01:00
|
|
|
/* Get number of encryption elements */
|
2018-03-06 03:08:14 +01:00
|
|
|
ncrypt = cw_get_byte(data + 2);
|
2016-02-27 14:25:23 +01:00
|
|
|
if (ncrypt == 0) {
|
2022-07-28 01:36:16 +02:00
|
|
|
if (0 /*conn->strict_capwap*/) {
|
2016-02-27 14:25:23 +01:00
|
|
|
cw_dbg(DBG_ELEM_ERR,
|
|
|
|
"Bad WTP Descriptor, number of encryption elements is 0.");
|
2018-03-17 12:32:40 +01:00
|
|
|
return CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
|
2016-02-27 14:25:23 +01:00
|
|
|
}
|
|
|
|
cw_dbg(DBG_RFC,
|
|
|
|
"Non standard conform WTP Descriptor, number of encryptoin elements is 0.");
|
|
|
|
}
|
|
|
|
|
2022-08-15 00:51:38 +02:00
|
|
|
sprintf(key,"%s/%s",eh->key, "max-radios");
|
2022-08-17 18:41:17 +02:00
|
|
|
// cw_ktv_add(cfg,key,CW_TYPE_BYTE,NULL,data,1);
|
|
|
|
CW_TYPE_BYTE->read(cfg,key,data,1,eh->param);
|
2018-03-17 12:32:40 +01:00
|
|
|
|
|
|
|
sprintf(key,"%s/%s",eh->key, CW_SKEY_RADIOS_IN_USE);
|
2022-08-17 18:41:17 +02:00
|
|
|
// cw_ktv_add(cfg,key,CW_TYPE_BYTE,NULL,data+1,1);
|
|
|
|
CW_TYPE_BYTE->read(cfg,key,data,1,eh->param);
|
2018-03-17 12:32:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-06 03:08:14 +01:00
|
|
|
pos = 3;
|
2018-03-17 12:32:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < ncrypt; i++) {
|
|
|
|
/* It's a dummy for now */
|
|
|
|
pos += 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-03-15 00:31:31 +01:00
|
|
|
if (!allowed) {
|
|
|
|
allowed=allowed_default;
|
|
|
|
}
|
2018-03-17 12:32:40 +01:00
|
|
|
|
2018-03-07 08:57:04 +01:00
|
|
|
return cw_read_descriptor_subelems(cfg,eh->key , data + pos, len - pos, allowed);
|
2016-02-27 14:25:23 +01:00
|
|
|
}
|