put out a correct WTP Descriptor, even if no data is available

This commit is contained in:
7u83 2022-08-30 22:13:22 +02:00
parent 190c94ded4
commit 2064f7dba1
2 changed files with 8 additions and 17 deletions

View File

@ -17,32 +17,23 @@ int cw_write_descriptor_subelem (uint8_t *dst, cw_Cfg_t ** cfg_list,
sprintf (key, "%s/%s", parent_key, CW_SKEY_VENDOR);
vendor_s = cw_cfg_get_l (cfg_list, key, NULL);
if (vendor_s == NULL) {
cw_log (LOG_ERR, "Can't put subelem %s, no value of type found.", key);
cw_log (LOG_ERR, "Can't put subelem %s, no value found. Setting zero.", key);
vendor_s = "0";
}
vendor = atoi(vendor_s);
sprintf (key, "%s/%s", parent_key, CW_SKEY_VERSION);
// cw_Val_t * val = cw_cfg_get_val_l(cfg_list, key, CW_TYPE_BSTR16);
version = cw_cfg_get_bstr16_l(cfg_list,key,NULL);
//version = cw_cfg_get_bstr16 (cfg, key, NULL);
if (version == NULL) {
cw_log (LOG_ERR, "Can't put subelem %s, no value of type Bstr16 found.", key);
return 0;
cw_log (LOG_ERR, "Can't put subelem %s, no value found. Setting zero.", key);
version = bstr16_create_from_str("0.0.0.0");
}
d = dst;
/* put vendor */
d += cw_put_dword(d, vendor); //->type->put (vendor, d);
d += cw_put_dword(d, vendor);
/* put version */
d += cw_put_dword (d, (subelem_id << 16) | bstr16_len(version));

View File

@ -37,11 +37,13 @@ int capwap_out_wtp_descriptor(struct cw_ElemHandler * eh,
sprintf(key,"%s/%s",eh->key,CW_SKEY_MAX_RADIOS);
val = cw_cfg_get_byte_l(params->cfg_list,key, 0);
d+=cw_put_byte(d,val);
if (val<=0){
if (val<0){
cw_dbg(DBG_WARN,"Cannot get value for %s, setting to 0", CW_SKEY_MAX_RADIOS);
d+=cw_put_byte(d,0);
}
else{
d+=cw_put_byte(d,val);
}
sprintf(key,"%s/%s",eh->key,CW_SKEY_RADIOS_IN_USE);
val = cw_cfg_get_byte_l(params->cfg_list,key, 0);
@ -52,8 +54,6 @@ int capwap_out_wtp_descriptor(struct cw_ElemHandler * eh,
d+=cw_put_encryption_subelems(d,0);
/*cw_ktv_dump(params->conn->local_cfg,DBG_INFO,"*** ktv dump ***","","*** end of dump ***");*/
/* hardware version sub element */
sprintf(key,"%s/%s",eh->key,CW_SKEY_HARDWARE);
d+=cw_write_descriptor_subelem (d, params->cfg_list,