Work on icapwap_out_ac_status

This commit is contained in:
7u83 2022-08-22 20:09:02 +02:00
parent 815c627e14
commit 05963edc98
4 changed files with 48 additions and 5 deletions

View File

@ -1,6 +1,7 @@
#include "cw.h"
#include "log.h"
#include "dbg.h"
#include "keys.h"
int cw_in_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
uint8_t * elem_data, int elem_len)
@ -156,3 +157,43 @@ int cw_header_len(struct cw_ElemHandler * handler)
}
int cw_put_ac_status(cw_Cfg_t ** cfg_list, uint8_t *dst, const char * parent_key){
stop();
uint8_t *d = dst;
char key[CW_CFG_MAX_KEY_LEN];
/* put statiosn */
sprintf(key,"%s/%s",parent_key,"stations");
d += cw_put_word(d,cw_cfg_get_word_l(cfg_list,key,0));
/* put station limit */
sprintf(key,"%s/%s",parent_key,"station-limit");
d += cw_put_word(d,cw_cfg_get_word_l(cfg_list,key,0));
/* Put number of active WTPS */
sprintf(key,"%s/%s",parent_key,"active-wtps");
d += cw_put_word(d,cw_cfg_get_word_l(cfg_list,key,0));
d += cw_put_word(d,cw_cfg_get_word_l(cfg_list,"ac-descriptor/max-wtps",0));
d += cw_put_byte(d,cw_cfg_get_byte_l(cfg_list,"ac-descriptor/security",0));
sprintf(key,"%s/%s",parent_key,CW_SKEY_RMAC_FIELD);
d += cw_put_byte(d,cw_cfg_get_byte_l(cfg_list,key,0));
/* reserved field, must be zero - RFC5415 */
d += cw_put_byte(d,0);
sprintf(key,"%s/%s",parent_key,CW_SKEY_DTLS_POLICY);
d += cw_put_byte(d,cw_cfg_get_byte_l(cfg_list,key,0));
return d - dst;
}

View File

@ -39,13 +39,12 @@ int capwap_out_wtp_descriptor(struct cw_ElemHandler * eh,
val = cw_cfg_get_byte_l(params->cfg_list,key, 0);
d+=cw_put_byte(d,val);
if (val<=0){
cw_dbg(DBG_WARN,"Cannot value for %s, setting to 0", CW_SKEY_MAX_RADIOS);
cw_dbg(DBG_WARN,"Cannot get value for %s, setting to 0", CW_SKEY_MAX_RADIOS);
d+=cw_put_byte(d,0);
}
sprintf(key,"%s/%s",eh->key,CW_SKEY_RADIOS_IN_USE);
val = cw_cfg_get_byte_l(params->cfg_list,key, 0);
cw_dbg("WTP-DESCRIPTOR: radios in use: %d",val);
d+=cw_put_byte(d,val); /*radios in use*/
/* d+=cw_put_encryption_capabilities_7(d,1); */

View File

@ -47,10 +47,11 @@ static int detect(struct cw_Conn *conn, const uint8_t * rawmsg, int rawlen, int
int static setup_cfg(struct cw_Conn * conn)
{
int security;
security = cw_setup_dtls(conn,conn->local_cfg,"capwap",CAPWAP_CIPHER);
printf ("ROLE: %d\n",conn->role);
stop();
// stop();
// cw_ktv_set_byte(conn->local_cfg,"ac-descriptor/security",security);
return 0;

View File

@ -176,7 +176,9 @@ int main (int argc, char **argv)
//cw_run_discovery(conn, "255.255.255.255","192.168.0.14", &dis);
// cw_run_discovery(conn, "192.168.0.255","192.168.0.14", &dis);
//results = cw_run_discovery(conn, "255.255.255.255","192.168.0.14");
results = cw_run_discovery(conn, "255.255.255.255","172.16.67.119");
// results = cw_run_discovery(conn, "255.255.255.255","172.16.67.119");
// results = cw_run_discovery(conn, "255.255.255.255","172.16.67.185");
results = cw_run_discovery(conn, "172.16.67.255","172.16.67.185");
if (!join(conn,results)){
cw_discovery_results_destroy(results);