Colored debugging...
FossilOrigin-Name: 153201cffee624726d6bcd3e428c0d69d7cc9e9cba6a84a5687de94a850550dd
This commit is contained in:
parent
4460a959b9
commit
73aba62d2b
@ -68,14 +68,11 @@ cw_aciplist_t get_aciplist()
|
|||||||
|
|
||||||
void * get_iplist(void * arg)
|
void * get_iplist(void * arg)
|
||||||
{
|
{
|
||||||
printf("************************************************************************************\n");
|
|
||||||
printf("The ist an iplist getter\n");
|
|
||||||
return get_aciplist();
|
return get_aciplist();
|
||||||
}
|
}
|
||||||
|
|
||||||
void release_iplist(void *arg,void *data)
|
void release_iplist(void *arg,void *data)
|
||||||
{
|
{
|
||||||
printf("And an releaser\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ac_global_init()
|
int ac_global_init()
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "wtplist.h"
|
#include "wtplist.h"
|
||||||
#include "capwap/dtls.h"
|
#include "capwap/dtls.h"
|
||||||
#include "capwap/log.h"
|
#include "capwap/log.h"
|
||||||
|
#include "capwap/dbg.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "capwap/sock.h"
|
#include "capwap/sock.h"
|
||||||
|
|
||||||
@ -137,7 +138,7 @@ int main (int argc, const char * argv[])
|
|||||||
|
|
||||||
cw_log(LOG_INFO,"Starting AC-Tube, Name=%s, ID=%s",conf_acname,conf_acid);
|
cw_log(LOG_INFO,"Starting AC-Tube, Name=%s, ID=%s",conf_acname,conf_acid);
|
||||||
|
|
||||||
cw_dbg_opt_detail=DBG_DETAIL_ASC_DMP;
|
cw_dbg_opt_display=DBG_DISP_ASC_DMP | DBG_DISP_COLORS;
|
||||||
|
|
||||||
cw_register_actions_cipwap_ac(&capwap_actions);
|
cw_register_actions_cipwap_ac(&capwap_actions);
|
||||||
|
|
||||||
@ -305,7 +306,7 @@ void process_cw_ctrl_packet(int index,struct sockaddr * addr, uint8_t * buffer,
|
|||||||
|
|
||||||
char hdrstr[1024];
|
char hdrstr[1024];
|
||||||
hdr_print(hdrstr,buffer,len);
|
hdr_print(hdrstr,buffer,len);
|
||||||
cw_dbg(DBG_CW_PKT_IN,"Header for packet from %s\n%s",sock_addr2str(addr),hdrstr);
|
// cw_dbg(DBG_CW_PKT_IN,"Header for packet from %s\n%s",sock_addr2str(addr),hdrstr);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -317,7 +318,7 @@ void process_cw_ctrl_packet(int index,struct sockaddr * addr, uint8_t * buffer,
|
|||||||
#else
|
#else
|
||||||
if (preamble != CAPWAP_PACKET_PREAMBLE ){
|
if (preamble != CAPWAP_PACKET_PREAMBLE ){
|
||||||
#endif
|
#endif
|
||||||
cw_dbg(DBG_CW_PKT_ERR,"Discarding packet, wrong preamble, preamble = 0x%01X",preamble);
|
cw_dbg(DBG_PKT_ERR,"Discarding packet, wrong preamble, preamble = 0x%01X",preamble);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,10 +429,10 @@ void process_ctrl_packet(int index,struct sockaddr * addr, uint8_t * buffer, int
|
|||||||
#ifdef WITH_CW_LOG_DEBUG
|
#ifdef WITH_CW_LOG_DEBUG
|
||||||
char str[100];
|
char str[100];
|
||||||
sock_addrtostr(addr,str,100);
|
sock_addrtostr(addr,str,100);
|
||||||
cw_dbg(DBG_CW_PKT_IN,"Received packet from %s, len = %i, via %s\n",sock_addr2str(addr),len,
|
// cw_dbg(DBG_PKT_IN,"Received packet from %s, len = %i, via %s\n",sock_addr2str(addr),len,
|
||||||
socklist[index].type==SOCKLIST_UNICAST_SOCKET ? "unicast":"bcast/mcast");
|
// socklist[index].type==SOCKLIST_UNICAST_SOCKET ? "unicast":"bcast/mcast");
|
||||||
|
|
||||||
cw_dbg_dmp(DBG_CW_PKT_DMP,buffer,len,"Dump ...");
|
// cw_dbg_dmp(DBG_CW_PKT_DMP,buffer,len,"Dump ...");
|
||||||
// cw_dbg_dmp(buffer,len,"Packet data for packet, recevied from %s",str);
|
// cw_dbg_dmp(buffer,len,"Packet data for packet, recevied from %s",str);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#include "capwap/log.h"
|
#include "capwap/log.h"
|
||||||
|
#include "capwap/dbg.h"
|
||||||
#include "capwap/cw_util.h"
|
#include "capwap/cw_util.h"
|
||||||
|
|
||||||
uint8_t conf_macaddress[12];
|
uint8_t conf_macaddress[12];
|
||||||
@ -537,12 +538,13 @@ static int conf_read_strings( cfg_t * cfg, char * name, char ***dst,int *len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
struct conf_dbg_level_names{
|
struct conf_dbg_level_names{
|
||||||
const char *name;
|
const char *name;
|
||||||
int level;
|
int level;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
static int conf_read_dbg_level(cfg_t *cfg)
|
static int conf_read_dbg_level(cfg_t *cfg)
|
||||||
@ -555,7 +557,7 @@ static int conf_read_dbg_level(cfg_t *cfg)
|
|||||||
for (i=0; i<n; i++) {
|
for (i=0; i<n; i++) {
|
||||||
char * str = cfg_getnstr(cfg,name,i);
|
char * str = cfg_getnstr(cfg,name,i);
|
||||||
//int u = cw_log_str2dbglevel(str);
|
//int u = cw_log_str2dbglevel(str);
|
||||||
cw_dbg_opt_level|=cw_log_str2dbglevel(str);
|
cw_dbg_opt_level|= cw_strlist_get_id(cw_dbg_strings,str); //cw_log_str2dbglevel(str);
|
||||||
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
|
|
||||||
#include "capwap/log.h"
|
#include "capwap/log.h"
|
||||||
|
#include "capwap/dbg.h"
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ int db_init()
|
|||||||
{
|
{
|
||||||
const char * filename="ac.sqlite3";
|
const char * filename="ac.sqlite3";
|
||||||
|
|
||||||
cw_dbg(DBG_CW_INFO,"Init sqlite3 db: %s",filename);
|
cw_dbg(DBG_INFO,"Init sqlite3 db: %s",filename);
|
||||||
int rc = sqlite3_open(filename,&handle);
|
int rc = sqlite3_open(filename,&handle);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
@ -46,7 +47,7 @@ static sqlite3_stmt * ping_stmt;
|
|||||||
|
|
||||||
int db_start()
|
int db_start()
|
||||||
{
|
{
|
||||||
cw_dbg(DBG_CW_INFO,"Start sqlite3 db");
|
cw_dbg(DBG_INFO,"Start sqlite3 db");
|
||||||
|
|
||||||
sqlite3_stmt *stmt;
|
sqlite3_stmt *stmt;
|
||||||
int rc = sqlite3_prepare_v2(handle, "INSERT INTO acs (acid,acname) VALUES (?,?);",-1,&stmt,0);
|
int rc = sqlite3_prepare_v2(handle, "INSERT INTO acs (acid,acname) VALUES (?,?);",-1,&stmt,0);
|
||||||
|
339
src/ac/wtpman.c
339
src/ac/wtpman.c
@ -15,6 +15,7 @@
|
|||||||
#include "wtpman.h"
|
#include "wtpman.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "capwap/log.h"
|
#include "capwap/log.h"
|
||||||
|
#include "capwap/timer.h"
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
@ -35,6 +36,8 @@
|
|||||||
|
|
||||||
#include "capwap/dtls.h"
|
#include "capwap/dtls.h"
|
||||||
|
|
||||||
|
#include "capwap/dbg.h"
|
||||||
|
|
||||||
|
|
||||||
extern struct cw_actiondef capwap_actions;
|
extern struct cw_actiondef capwap_actions;
|
||||||
|
|
||||||
@ -173,7 +176,7 @@ static void wtpman_run_discovery(void *arg)
|
|||||||
|
|
||||||
char wtpinfostr[8192];
|
char wtpinfostr[8192];
|
||||||
wtpinfo_print(wtpinfostr, &wtpman->wtpinfo);
|
wtpinfo_print(wtpinfostr, &wtpman->wtpinfo);
|
||||||
cw_dbg(DBG_CW_INFO, "Discovery request gave us the follwing WTP Info:\n%s",
|
cw_dbg(DBG_INFO, "Discovery request gave us the follwing WTP Info:\n%s",
|
||||||
wtpinfostr);
|
wtpinfostr);
|
||||||
|
|
||||||
|
|
||||||
@ -190,7 +193,7 @@ static void wtpman_run_discovery(void *arg)
|
|||||||
|
|
||||||
/* char wtpinfostr[8192];
|
/* char wtpinfostr[8192];
|
||||||
wtpinfo_print(wtpinfostr,&wtpman->wtpinfo);
|
wtpinfo_print(wtpinfostr,&wtpman->wtpinfo);
|
||||||
cw_dbg(DBG_CW_INFO,"Discovery request gave us the follwing WTP Info:\n%s",wtpinfostr);
|
cw_dbg(DBG_INFO,"Discovery request gave us the follwing WTP Info:\n%s",wtpinfostr);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
cwsend_discovery_response(wtpman->conn, cwrmsg->seqnum, &radioinfo, acinfo,
|
cwsend_discovery_response(wtpman->conn, cwrmsg->seqnum, &radioinfo, acinfo,
|
||||||
@ -223,8 +226,8 @@ static int wtpman_establish_dtls(void *arg)
|
|||||||
wtpman->conn->dtls_cert_file = conf_sslcertfilename;
|
wtpman->conn->dtls_cert_file = conf_sslcertfilename;
|
||||||
wtpman->conn->dtls_key_pass = conf_sslkeypass;
|
wtpman->conn->dtls_key_pass = conf_sslkeypass;
|
||||||
wtpman->conn->dtls_verify_peer = conf_dtls_verify_peer;
|
wtpman->conn->dtls_verify_peer = conf_dtls_verify_peer;
|
||||||
cw_dbg(DBG_DTLS, "DTLS - Using key file %s", wtpman->conn->dtls_key_file);
|
cw_dbg(DBG_DTLS, "Using key file %s", wtpman->conn->dtls_key_file);
|
||||||
cw_dbg(DBG_DTLS, "DTLS - Using cert file %s",
|
cw_dbg(DBG_DTLS, "Using cert file %s",
|
||||||
wtpman->conn->dtls_cert_file);
|
wtpman->conn->dtls_cert_file);
|
||||||
dtls_ok = 1;
|
dtls_ok = 1;
|
||||||
}
|
}
|
||||||
@ -258,12 +261,11 @@ static int wtpman_establish_dtls(void *arg)
|
|||||||
FILE *f;
|
FILE *f;
|
||||||
f = fopen("pcert.der", "wb");
|
f = fopen("pcert.der", "wb");
|
||||||
|
|
||||||
printf("Calling peers cert\n");
|
|
||||||
cert = dtls_get_peers_cert(wtpman->conn, 0);
|
cert = dtls_get_peers_cert(wtpman->conn, 0);
|
||||||
printf("Back from peers cert\n");
|
|
||||||
|
|
||||||
printf("Have Peers Cert: %p, %d\n", cert.data, cert.size);
|
// printf("Have Peers Cert: %p, %d\n", cert.data, cert.size);
|
||||||
fwrite(cert.data, 1, cert.size, f);
|
// fwrite(cert.data, 1, cert.size, f);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -284,6 +286,11 @@ static int wtpman_join(void *arg, time_t timer)
|
|||||||
|
|
||||||
wtpman->conn->outgoing = ac_config;
|
wtpman->conn->outgoing = ac_config;
|
||||||
wtpman->conn->incomming = cw_itemstore_create();
|
wtpman->conn->incomming = cw_itemstore_create();
|
||||||
|
wtpman->conn->local = cw_itemstore_create();
|
||||||
|
|
||||||
|
struct conn * conn = wtpman->conn;
|
||||||
|
|
||||||
|
cw_dbg(DBG_INFO,"Join State - %s",sock_addr2str(&conn->addr));
|
||||||
|
|
||||||
while (!cw_timer_timeout(timer) && wtpman->conn->capwap_state == CW_STATE_JOIN) {
|
while (!cw_timer_timeout(timer) && wtpman->conn->capwap_state == CW_STATE_JOIN) {
|
||||||
int rc = cw_read_messages(wtpman->conn);
|
int rc = cw_read_messages(wtpman->conn);
|
||||||
@ -384,279 +391,75 @@ static void wtpman_run(void *arg)
|
|||||||
State is Image update
|
State is Image update
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
int rc = 0;
|
||||||
while (!cw_timer_timeout(timer) && wtpman->conn->capwap_state == CW_STATE_CONFIGURE) {
|
while (!cw_timer_timeout(timer)
|
||||||
int rc = cw_read_messages(wtpman->conn);
|
&& wtpman->conn->capwap_state == CW_STATE_CONFIGURE) {
|
||||||
|
rc = cw_read_messages(wtpman->conn);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
|
if (errno != EAGAIN)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!rc) {
|
||||||
|
cw_dbg(DBG_INFO, "WTP Problem: %s", cw_strrc(rc));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
struct conn *conn = wtpman->conn;
|
||||||
|
|
||||||
|
if (conn->capwap_state == CW_STATE_IMAGE_DATA) {
|
||||||
|
/* Image upload */
|
||||||
exit(0);
|
const char *filename =
|
||||||
|
cw_itemstore_get_str(conn->outgoing, CW_ITEM_IMAGE_FILENAME);
|
||||||
|
if (!filename) {
|
||||||
|
cw_log(LOG_ERR,
|
||||||
|
"Can't send image to %s. No Image Filename Item found.",
|
||||||
|
sock_addr2str(&conn->addr));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cw_dbg(DBG_INFO, "Sending image file '%s' to '%s'.", filename,
|
||||||
/*
|
sock_addr2str(&conn->addr));
|
||||||
|
FILE *infile = fopen(filename, "rb");
|
||||||
|
if (infile == NULL) {
|
||||||
|
cw_log(LOG_ERR, "Can't open image %s: %s",
|
||||||
|
sock_addr2str(&conn->addr), strerror(errno));
|
||||||
|
|
||||||
do {
|
|
||||||
int cfg_status_msgs[] =
|
|
||||||
{ CW_MSG_IMAGE_DATA_REQUEST, CW_MSG_CONFIGURATION_STATUS_REQUEST,
|
|
||||||
-1 };
|
|
||||||
cwrmsg = conn_wait_for_request(wtpman->conn, cfg_status_msgs, timer);
|
|
||||||
|
|
||||||
if (!cwrmsg) {
|
|
||||||
cw_dbg(DBG_MSG_ERR,
|
|
||||||
"No conf status or img data request from %s after %d seconds, WTP died.",
|
|
||||||
sock_addr2str(&wtpman->conn->addr),
|
|
||||||
wtpman->conn->wait_join);
|
|
||||||
wtpman_remove(wtpman);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Image data request, the WTP wants an update
|
cw_itemstore_set_const_ptr(conn->outgoing, CW_ITEM_IMAGE_FILEHANDLE,
|
||||||
if (cwrmsg->type == CW_MSG_IMAGE_DATA_REQUEST) {
|
infile);
|
||||||
int rc = wtpman_send_image_file(wtpman, cwrmsg);
|
|
||||||
|
|
||||||
|
clock_t clk = cw_clock_start();
|
||||||
|
int rc=0;
|
||||||
|
while (conn->capwap_state == CW_STATE_IMAGE_DATA && !feof(infile) && rc==0) {
|
||||||
|
rc = cw_send_request(conn, CW_MSG_IMAGE_DATA_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
wtpman_remove(wtpman);
|
cw_log(LOG_ERR,"Image download RC: %s",cw_strrc(rc));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cw_dbg(DBG_INFO,"Image '%s' sucessful sent to %s in %0.1f seconds.",
|
||||||
|
filename,sock_addr2str(&conn->addr),cw_clock_stop(clk));
|
||||||
|
conn->capwap_state=CW_STATE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(infile);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} while (cwrmsg->type != CW_MSG_CONFIGURATION_STATUS_REQUEST);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
printf("Have Masseg %d\n", cwrmsg->type);
|
|
||||||
cwread_configuration_status_request(&wtpman->wtpinfo, cwrmsg->msgelems,
|
|
||||||
cwrmsg->msgelems_len);
|
|
||||||
int result_code = 0;
|
|
||||||
struct ac_info *acinfo = get_acinfo();
|
|
||||||
struct radioinfo rinf;
|
|
||||||
cwsend_conf_status_response(wtpman->conn, cwrmsg->seqnum, result_code, &rinf,
|
|
||||||
acinfo, &wtpman->wtpinfo);
|
|
||||||
printf("Send the respi but sleep\n");
|
|
||||||
|
|
||||||
|
|
||||||
printf("Next thoing\n");
|
|
||||||
int change_status_msgs[] =
|
|
||||||
{ CW_MSG_IMAGE_DATA_REQUEST, CW_MSG_CHANGE_STATE_EVENT_REQUEST, -1 };
|
|
||||||
cwrmsg = conn_wait_for_request(wtpman->conn, change_status_msgs, timer);
|
|
||||||
printf("Done\n");
|
|
||||||
|
|
||||||
if (!cwrmsg) {
|
|
||||||
wtpman_remove(wtpman);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch (cwrmsg->type) {
|
|
||||||
case CW_MSG_CHANGE_STATE_EVENT_REQUEST:
|
|
||||||
{
|
|
||||||
printf("Change state event\n!");
|
|
||||||
struct radioinfo ri;
|
|
||||||
cwsend_change_state_event_response(wtpman->conn,
|
|
||||||
cwrmsg->seqnum, &ri);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case CW_MSG_IMAGE_DATA_REQUEST:
|
|
||||||
printf("Image update\n!");
|
|
||||||
//cwread_image_data_request(0,cwrmsg->msgelems,cwrmsg->msgelems_len);
|
|
||||||
|
|
||||||
|
|
||||||
//cwsend_image_data_response(wtpman->conn,cwrmsg->seqnum,CW_RESULT_SUCCESS);
|
|
||||||
|
|
||||||
//send_image_file(wtpman->conn,"/tftpboot/c1130-k9w7-tar.default");
|
|
||||||
|
|
||||||
// send_image_file(wtpman->conn,"/home/tube/Downloads/c1130-k9w7-tar.123-8.JEA3.tar");
|
|
||||||
// send_image_file(wtpman->conn,"/home/tube/Downloads/c1130-k9w8-tar.124-25e.JAP.tar");
|
|
||||||
// send_image_file(wtpman->conn,"/home/tube/Downloads/c1130-rcvk9w8-tar.124-25e.JAP.tar");
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
printf("WTP is joined now\n");
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
struct radioinfo * radioinfo;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cwrmsg = wtpman_wait_for_message(wtpman,timer);
|
|
||||||
if (!cwrmsg){
|
|
||||||
cw_dbg(DBG_CW_MSG_ERR,"No config or update request from %s after %d seconds, WTP died.",
|
|
||||||
sock_addr2str(&wtpman->conn->addr),wtpman->conn->wait_join);
|
|
||||||
wtpman_remove(wtpman);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("CWR TYPE %d\n",cwrmsg->type);
|
|
||||||
exit(0);
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// cwread_configuration_status_request(&wtpman->wtpinfo,cwrmsg->msgelems, cwrmsg->msgelems_len);
|
|
||||||
// cwsend_conf_status_response(wtpman->conn,cwrmsg->seqnum,result_code,&radioinfo,acinfo,&wtpman->wtpinfo);
|
|
||||||
|
|
||||||
/*
|
|
||||||
char wtpinfostr[8192];
|
|
||||||
wtpinfo_print(wtpinfostr, &wtpman->wtpinfo);
|
|
||||||
cw_dbg(DBG_ALL, "WTP conf_status\n%s", wtpinfostr);
|
|
||||||
|
|
||||||
printf("Run run run run run\n");
|
|
||||||
wtpman_run_run(wtpman);
|
|
||||||
exit(0);
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
int ii;
|
|
||||||
for (ii=0; ii<3; ii++){
|
|
||||||
cwrmsg = wtpman_wait_for_message(wtpman,timer);
|
|
||||||
if (cwrmsg){
|
|
||||||
if (cwrmsg->type == CWMSG_CHANGE_STATE_EVENT_REQUEST){
|
|
||||||
cwread_change_state_event_request(&wtpman->wtpinfo,cwrmsg->msgelems,cwrmsg->msgelems_len);
|
|
||||||
cwsend_change_state_event_response(wtpman->conn,cwrmsg->seqnum,wtpman->wtpinfo.radioinfo);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
wtpman_run_run(wtpman);
|
|
||||||
|
|
||||||
exit(0);
|
|
||||||
|
|
||||||
|
|
||||||
if (cwrmsg->type == CW_MSG_IMAGE_DATA_REQUEST) {
|
|
||||||
cwread_image_data_request(0, cwrmsg->msgelems, cwrmsg->msgelems_len);
|
|
||||||
cwsend_image_data_response(wtpman->conn, cwrmsg->seqnum,
|
|
||||||
CW_RESULT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
printf("Sending image file\n");
|
|
||||||
send_image_file(wtpman->conn,"/home/tube/Downloads/c1130-rcvk9w8-tar.124-25e.JAO5.tar");
|
|
||||||
printf("Back from sending image file\n");
|
|
||||||
*/
|
|
||||||
exit(0);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
timer = cw_timer_start(30);
|
|
||||||
cwrmsg = wtpman_wait_for_message(wtpman, timer);
|
|
||||||
|
|
||||||
if (cwrmsg)
|
|
||||||
printf("I have got a message of type %d\n", cwrmsg->type);
|
|
||||||
|
|
||||||
if (cwrmsg->type == CW_MSG_IMAGE_DATA_REQUEST) {
|
|
||||||
cwread_image_data_request(0, cwrmsg->msgelems, cwrmsg->msgelems_len);
|
|
||||||
cwsend_image_data_response(wtpman->conn, cwrmsg->seqnum,
|
|
||||||
CW_RESULT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// char wtpinfostr[8192];
|
|
||||||
// wtpinfo_print(wtpinfostr,&wtpman->wtpinfo);
|
|
||||||
// cw_log_debug0("WTP joined\n%s",wtpinfostr);
|
|
||||||
|
|
||||||
//exit(0);
|
|
||||||
/*
|
|
||||||
int msg_counter = 0;
|
|
||||||
while (1) {
|
|
||||||
struct cwrmsg *cwrmsg = conn_get_message(wtpman->conn);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!cwrmsg) {
|
|
||||||
msg_counter++;
|
|
||||||
if (msg_counter < CAPWAP_ECHO_INTERVAL * 2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// cw_log_debug0("WTP died");
|
|
||||||
wtpman_remove(wtpman);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
if (cwrmsg->type == CWMSG_CONFIGURATION_STATUS_REQUEST){
|
|
||||||
process_conf_status_request(&wtpman->wtpinfo,cwrmsg->msgelems,cwrmsg->msgelems_len);
|
|
||||||
{
|
|
||||||
char wtpinfostr[8192];
|
|
||||||
wtpinfo_print(wtpinfostr,&wtpman->wtpinfo);
|
|
||||||
cw_dbg(DBG_CW_INFO,"Join request gave us the follwing WTP Info:\n%s",wtpinfostr);
|
|
||||||
|
|
||||||
cwsend_conf_status_response(wtpman->conn,cwrmsg->seqnum,result_code,&radioinfo,acinfo,&wtpman->wtpinfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
msg_counter = 0;
|
|
||||||
|
|
||||||
|
|
||||||
if (cwrmsg->type == CW_MSG_ECHO_REQUEST) {
|
|
||||||
cwsend_echo_response(wtpman->conn, cwrmsg->seqnum,
|
|
||||||
wtpman->wtpinfo.radioinfo);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// printf("Got msg: %i\n",cwrmsg->type);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// process_discovery(wtpman,cwrmsg);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
while (1) {
|
|
||||||
uint8_t *packet = conn_q_get_packet(wtpman->conn);
|
|
||||||
// int len = *( (uint32_t*)(packet));
|
|
||||||
|
|
||||||
|
|
||||||
// conn_process_packet(wtpman->conn,packet+4,len);
|
|
||||||
free(packet);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wtpman_destroy(struct wtpman *wtpman)
|
void wtpman_destroy(struct wtpman *wtpman)
|
||||||
{
|
{
|
||||||
@ -754,11 +557,11 @@ void wtpman_lw_addpacket(struct wtpman *wtpman, uint8_t * packet, int len)
|
|||||||
void wtpman_start(struct wtpman *wtpman, int dtlsmode)
|
void wtpman_start(struct wtpman *wtpman, int dtlsmode)
|
||||||
{
|
{
|
||||||
if (dtlsmode) {
|
if (dtlsmode) {
|
||||||
cw_dbg(DBG_CW_INFO, "Starting wtpman in DTLS mode");
|
cw_dbg(DBG_INFO, "Starting wtpman in DTLS mode");
|
||||||
pthread_create(&wtpman->thread, NULL, (void *) &wtpman_run,
|
pthread_create(&wtpman->thread, NULL, (void *) &wtpman_run,
|
||||||
(void *) wtpman);
|
(void *) wtpman);
|
||||||
} else {
|
} else {
|
||||||
cw_dbg(DBG_CW_INFO, "Starting wtpman in non-dtls mode");
|
cw_dbg(DBG_INFO, "Starting wtpman in non-dtls mode");
|
||||||
pthread_create(&wtpman->thread, NULL, (void *) &wtpman_run_discovery,
|
pthread_create(&wtpman->thread, NULL, (void *) &wtpman_run_discovery,
|
||||||
(void *) wtpman);
|
(void *) wtpman);
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,8 @@ LOGOBJS=log.o \
|
|||||||
log_syslog.o \
|
log_syslog.o \
|
||||||
log_file.o \
|
log_file.o \
|
||||||
cw_log_debug.o \
|
cw_log_debug.o \
|
||||||
cw_log_str2dbglevel.o \
|
cw_dbg_elem.o \
|
||||||
cw_dbg_elem.o
|
dbg_strings.o
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -74,7 +74,6 @@ LWAPPOBJS = \
|
|||||||
lw_checksum.o \
|
lw_checksum.o \
|
||||||
lw_put_ac_descriptor.o \
|
lw_put_ac_descriptor.o \
|
||||||
lw_put_cisco_path_mtu.o \
|
lw_put_cisco_path_mtu.o \
|
||||||
lw_readelem_wtp_name.o \
|
|
||||||
lw_put_80211_wtp_wlan_radio_configuration.o \
|
lw_put_80211_wtp_wlan_radio_configuration.o \
|
||||||
lw_readelem_vendor_specific.o \
|
lw_readelem_vendor_specific.o \
|
||||||
lw_vendor_id_to_str.o \
|
lw_vendor_id_to_str.o \
|
||||||
@ -83,6 +82,8 @@ LWAPPOBJS = \
|
|||||||
lw_cisco_id_to_str.o \
|
lw_cisco_id_to_str.o \
|
||||||
lw_put_sockaddr.o \
|
lw_put_sockaddr.o \
|
||||||
|
|
||||||
|
# lw_readelem_wtp_name.o \
|
||||||
|
lw_readelem_wtp_board_data.o \
|
||||||
|
|
||||||
|
|
||||||
# LWAPP cisco vendor specific objs
|
# LWAPP cisco vendor specific objs
|
||||||
@ -95,20 +96,17 @@ LWAPPCISCOOBJS = \
|
|||||||
|
|
||||||
|
|
||||||
CAPWAPOBJS= \
|
CAPWAPOBJS= \
|
||||||
cwmsg_addelem_maximum_message_length.o \
|
|
||||||
cwmsg_addelem_image_identifier.o \
|
|
||||||
cwmsg_send.o \
|
cwmsg_send.o \
|
||||||
wtpinfo.o \
|
wtpinfo.o \
|
||||||
aciplist.o \
|
aciplist.o \
|
||||||
acinfo.o \
|
|
||||||
acinfo_print.o \
|
acinfo_print.o \
|
||||||
lwmsg_init.o \
|
lwmsg_init.o \
|
||||||
wtpinfo_lwreadelem_wtp_descriptor.o \
|
wtpinfo_lwreadelem_wtp_descriptor.o \
|
||||||
hdr_print.o \
|
hdr_print.o \
|
||||||
cwmsg_addelem_vendor_cisco_mwar_addr.o \
|
cwmsg_addelem_vendor_cisco_mwar_addr.o \
|
||||||
lw_readelem_wtp_board_data.o \
|
|
||||||
cw_cisco_id_to_str.o\
|
cw_cisco_id_to_str.o\
|
||||||
cw_strlist_get_str.o \
|
cw_strlist_get_str.o \
|
||||||
|
cw_strlist_get_id.o \
|
||||||
capwap_strings_msg.o \
|
capwap_strings_msg.o \
|
||||||
capwap_strings_elem80211.o\
|
capwap_strings_elem80211.o\
|
||||||
acpriolist.o\
|
acpriolist.o\
|
||||||
@ -122,9 +120,12 @@ CAPWAPOBJS= \
|
|||||||
cw_in_check_disc_resp.o\
|
cw_in_check_disc_resp.o\
|
||||||
cw_in_check_join_req.o \
|
cw_in_check_join_req.o \
|
||||||
cw_in_check_join_resp.o \
|
cw_in_check_join_resp.o \
|
||||||
cw_in_check_img_data_req.o \
|
cw_in_check_img_data_req_ac.o \
|
||||||
|
cw_in_check_img_data_req_wtp.o \
|
||||||
|
cw_in_check_img_data_resp.o \
|
||||||
cw_out_generic.o \
|
cw_out_generic.o \
|
||||||
cw_out_ac_descriptor.o \
|
cw_out_ac_descriptor.o \
|
||||||
|
cw_out_wtp_descriptor.o \
|
||||||
cw_out_cisco_ac_descriptor.o \
|
cw_out_cisco_ac_descriptor.o \
|
||||||
cw_out_cisco_ap_timesync.o \
|
cw_out_cisco_ap_timesync.o \
|
||||||
cw_in_cisco_image_identifier.o\
|
cw_in_cisco_image_identifier.o\
|
||||||
@ -137,12 +138,15 @@ CAPWAPOBJS= \
|
|||||||
format.o \
|
format.o \
|
||||||
|
|
||||||
|
|
||||||
|
#acinfo.o \
|
||||||
# cwsend_unknow_response.o \
|
# cwsend_unknow_response.o \
|
||||||
cw_send_configuration_update_response.o \
|
cw_send_configuration_update_response.o \
|
||||||
cwsend_echo_request.o \
|
cwsend_echo_request.o \
|
||||||
cwmsg_init_echo_request.o \
|
cwmsg_init_echo_request.o \
|
||||||
cwmsg_addelem.o \
|
cwmsg_addelem.o \
|
||||||
cwmsg_vaddelem.o \
|
cwmsg_vaddelem.o \
|
||||||
|
cw_log_str2dbglevel.o \
|
||||||
|
cwmsg_addelem_maximum_message_length.o \
|
||||||
cwmsg_addelem_ac_descriptor.o \
|
cwmsg_addelem_ac_descriptor.o \
|
||||||
cwmsg_addelem_wtp_descriptor.o \
|
cwmsg_addelem_wtp_descriptor.o \
|
||||||
cwmsg_addelem_cw_local_ip_addr.o \
|
cwmsg_addelem_cw_local_ip_addr.o \
|
||||||
@ -157,6 +161,7 @@ cw_readelem_maximum_message_length.o \
|
|||||||
cw_readelem_result_code.o\
|
cw_readelem_result_code.o\
|
||||||
cw_readelem_ac_name.o \
|
cw_readelem_ac_name.o \
|
||||||
cw_readelem_ac_descriptor.o \
|
cw_readelem_ac_descriptor.o \
|
||||||
|
conn_detect_capwap.o \
|
||||||
cw_readelem_radio_administrative_state.o \
|
cw_readelem_radio_administrative_state.o \
|
||||||
cw_readelem_radio_operational_state.o \
|
cw_readelem_radio_operational_state.o \
|
||||||
cw_readelem_statistics_timer.o \
|
cw_readelem_statistics_timer.o \
|
||||||
@ -164,6 +169,7 @@ cw_readelem_maximum_message_length.o \
|
|||||||
cw_readelem_vendor_specific_payload.o \
|
cw_readelem_vendor_specific_payload.o \
|
||||||
cw_readelem_capwap_local_ip_addr.o \
|
cw_readelem_capwap_local_ip_addr.o \
|
||||||
cw_readelem_wtp_reboot_statistics.o\
|
cw_readelem_wtp_reboot_statistics.o\
|
||||||
|
cwmsg_addelem_image_identifier.o \
|
||||||
conn_get_response.o \
|
conn_get_response.o \
|
||||||
# cwsend_change_state_event_response.o \
|
# cwsend_change_state_event_response.o \
|
||||||
cwread_discovery_response.o \
|
cwread_discovery_response.o \
|
||||||
@ -174,6 +180,7 @@ cw_readelem_maximum_message_length.o \
|
|||||||
cwread_wtp_event_request.o \
|
cwread_wtp_event_request.o \
|
||||||
process_conf_status_request.o \
|
process_conf_status_request.o \
|
||||||
cw_readelem_ecn_support.o \
|
cw_readelem_ecn_support.o \
|
||||||
|
conn_wait_for_message.o \
|
||||||
|
|
||||||
# wtpinfo_readelem_wtp_mac_type.o \
|
# wtpinfo_readelem_wtp_mac_type.o \
|
||||||
# wtpinfo_readelem_wtp_descriptor.o \
|
# wtpinfo_readelem_wtp_descriptor.o \
|
||||||
@ -251,7 +258,6 @@ endif
|
|||||||
DTLSOBJS+=dtls_bio.o
|
DTLSOBJS+=dtls_bio.o
|
||||||
|
|
||||||
CONNOBJS= conn_create.o \
|
CONNOBJS= conn_create.o \
|
||||||
conn_detect_capwap.o \
|
|
||||||
conn_send_packet.o \
|
conn_send_packet.o \
|
||||||
conn_process_packet.o \
|
conn_process_packet.o \
|
||||||
conn_q_add_packet.o \
|
conn_q_add_packet.o \
|
||||||
@ -266,7 +272,6 @@ CONNOBJS= conn_create.o \
|
|||||||
cw_prepare_configuration_status_request.o \
|
cw_prepare_configuration_status_request.o \
|
||||||
cw_prepare_change_state_event_request.o \
|
cw_prepare_change_state_event_request.o \
|
||||||
conn_prepare_request.o \
|
conn_prepare_request.o \
|
||||||
conn_wait_for_message.o \
|
|
||||||
conn_init.o \
|
conn_init.o \
|
||||||
conn_send_msg.o
|
conn_send_msg.o
|
||||||
#conn_get_message.o \
|
#conn_get_message.o \
|
||||||
@ -288,6 +293,7 @@ CWACTION=action.o \
|
|||||||
cw_in_generic.o \
|
cw_in_generic.o \
|
||||||
cw_in_wtp_descriptor.o \
|
cw_in_wtp_descriptor.o \
|
||||||
cw_out_wtp_board_data.o \
|
cw_out_wtp_board_data.o \
|
||||||
|
cw_out_image_data.o \
|
||||||
cipwap_actions_ac.o \
|
cipwap_actions_ac.o \
|
||||||
cipwap_strings_elem.o \
|
cipwap_strings_elem.o \
|
||||||
capwap_strings_result.o\
|
capwap_strings_result.o\
|
||||||
@ -311,7 +317,7 @@ O:=$(OBJS);
|
|||||||
OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS))
|
OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS))
|
||||||
|
|
||||||
CFLAGS = -Wall -g -O0 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I /usr/local/include
|
CFLAGS = -Wall -g -O0 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I /usr/local/include
|
||||||
CFLAGS = -Wall -O3 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I/usr/local/include
|
#CFLAGS = -Wall -O3 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I/usr/local/include
|
||||||
|
|
||||||
CFLAGS += $(GNUTLS_CFLAGS) \
|
CFLAGS += $(GNUTLS_CFLAGS) \
|
||||||
-DWITH_CW_LOG \
|
-DWITH_CW_LOG \
|
||||||
|
@ -137,11 +137,12 @@ static int cw_action_out_cmp(const void *elem1, const void *elem2)
|
|||||||
*/
|
*/
|
||||||
void *cw_actionlist_add(struct avltree *t, void *a, size_t s)
|
void *cw_actionlist_add(struct avltree *t, void *a, size_t s)
|
||||||
{
|
{
|
||||||
|
|
||||||
void *r = avltree_replace_data(t, a, sizeof(struct cw_action_in));
|
void *r = avltree_replace_data(t, a, sizeof(struct cw_action_in));
|
||||||
if (r)
|
if (r)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
void *an = malloc(sizeof(struct cw_action_in));
|
void *an = malloc(s);
|
||||||
if (!an)
|
if (!an)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -78,7 +78,9 @@ struct cw_action_out{
|
|||||||
struct cw_item *(*get)(struct conn *conn,struct cw_action_out *a);
|
struct cw_item *(*get)(struct conn *conn,struct cw_action_out *a);
|
||||||
uint8_t mand;
|
uint8_t mand;
|
||||||
uint8_t itemtype;
|
uint8_t itemtype;
|
||||||
|
|
||||||
void *defval;
|
void *defval;
|
||||||
|
int xopt;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
|
|
||||||
#include "lwapp.h"
|
#include "lwapp.h"
|
||||||
#include "strheap.h"
|
#include "strlist.h"
|
||||||
|
|
||||||
/* capwap version and iana number */
|
/* capwap version and iana number */
|
||||||
#define CW_VERSION 0
|
#define CW_VERSION 0
|
||||||
@ -480,7 +480,7 @@ extern int cw_readelem_vendor_specific_payload(void *data, int msgtype, int elem
|
|||||||
*/
|
*/
|
||||||
#define CW_RESULT_IMAGE_DATA_IVALID_LENGTH 15 //Image Data Error (Invalid Data Length)
|
#define CW_RESULT_IMAGE_DATA_IVALID_LENGTH 15 //Image Data Error (Invalid Data Length)
|
||||||
|
|
||||||
#define CW_RESULT_IMAGE_DATA_OTHER_ERROR 16 //Image Data Error (Other Error)
|
#define CW_RESULT_IMAGE_DATA_ERROR 16 //Image Data Error (Other Error)
|
||||||
/*
|
/*
|
||||||
17 Image Data Error (Image Already Present)
|
17 Image Data Error (Image Already Present)
|
||||||
*/
|
*/
|
||||||
@ -572,7 +572,8 @@ extern int cw_readmsg_configuration_update_request(uint8_t * elems, int elems_le
|
|||||||
* @param th pointer to the header
|
* @param th pointer to the header
|
||||||
* @param hlen velue to set (max. 5 bits)
|
* @param hlen velue to set (max. 5 bits)
|
||||||
*/
|
*/
|
||||||
static inline void cw_set_hdr_hlen(uint8_t *th,int hlen){
|
static inline void cw_set_hdr_hlen(uint8_t * th, int hlen)
|
||||||
|
{
|
||||||
uint32_t d = cw_get_dword(th);
|
uint32_t d = cw_get_dword(th);
|
||||||
d &= (0x1f << 19) ^ 0xffffffff;
|
d &= (0x1f << 19) ^ 0xffffffff;
|
||||||
d |= ((hlen) & 0x1f) << 19;
|
d |= ((hlen) & 0x1f) << 19;
|
||||||
@ -584,7 +585,8 @@ static inline void cw_set_hdr_hlen(uint8_t *th,int hlen){
|
|||||||
* @param th pointer to the header
|
* @param th pointer to the header
|
||||||
* @param hlen velue to set (max. 5 bits)
|
* @param hlen velue to set (max. 5 bits)
|
||||||
*/
|
*/
|
||||||
static inline void cw_set_hdr_wbid(uint8_t *th,int wbid){
|
static inline void cw_set_hdr_wbid(uint8_t * th, int wbid)
|
||||||
|
{
|
||||||
uint32_t d = cw_get_dword(th);
|
uint32_t d = cw_get_dword(th);
|
||||||
d &= (0x1f << 9) ^ 0xffffffff;
|
d &= (0x1f << 9) ^ 0xffffffff;
|
||||||
d |= ((wbid) & 0x1f) << 9;
|
d |= ((wbid) & 0x1f) << 9;
|
||||||
@ -596,7 +598,8 @@ static inline void cw_set_hdr_wbid(uint8_t *th,int wbid){
|
|||||||
* @param th pointer to the header
|
* @param th pointer to the header
|
||||||
* @param hlen velue to set (max. 5 bits)
|
* @param hlen velue to set (max. 5 bits)
|
||||||
*/
|
*/
|
||||||
static inline void cw_set_hdr_rid(uint8_t *th,int rid){
|
static inline void cw_set_hdr_rid(uint8_t * th, int rid)
|
||||||
|
{
|
||||||
uint32_t d = cw_get_dword(th);
|
uint32_t d = cw_get_dword(th);
|
||||||
d &= (0x1f << 9) ^ 0xffffffff;
|
d &= (0x1f << 9) ^ 0xffffffff;
|
||||||
d |= ((rid) & 0x1f) << 14;
|
d |= ((rid) & 0x1f) << 14;
|
||||||
@ -855,7 +858,15 @@ extern struct cw_str capwap_strings_result[];
|
|||||||
#define cw_strresult(id) cw_strlist_get_str(capwap_strings_result,(id))
|
#define cw_strresult(id) cw_strlist_get_str(capwap_strings_result,(id))
|
||||||
|
|
||||||
|
|
||||||
static inline const char * cw_strelemp_(cw_strheap_t h, int msg_id) {
|
#define cw_strrc(rc) \
|
||||||
|
((rc)<0 ? ((rc)!=EAGAIN ? strerror(errno):"Timed out"): cw_strresult(rc))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static inline const char *cw_strelemp_(cw_strheap_t h, int msg_id)
|
||||||
|
{
|
||||||
const char *rc = cw_strheap_get(h, msg_id);
|
const char *rc = cw_strheap_get(h, msg_id);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
@ -864,7 +875,6 @@ static inline const char * cw_strelemp_(cw_strheap_t h, int msg_id) {
|
|||||||
|
|
||||||
#define cw_strelemp(p,id) cw_strelemp_((p)->strelem,id)
|
#define cw_strelemp(p,id) cw_strelemp_((p)->strelem,id)
|
||||||
|
|
||||||
extern const char *cw_strlist_get_str(struct cw_str *s, int id);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -882,8 +892,8 @@ extern int cw_in_wtp_board_data(struct conn *conn, struct cw_action_in *a, uint8
|
|||||||
int len);
|
int len);
|
||||||
extern int cw_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
extern int cw_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||||
int len);
|
int len);
|
||||||
extern int cw_in_capwap_control_ipv4_address(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
extern int cw_in_capwap_control_ipv4_address(struct conn *conn, struct cw_action_in *a,
|
||||||
int len);
|
uint8_t * data, int len);
|
||||||
|
|
||||||
//extern int cw_out_generic(struct conn *conn,struct cw_action_in * a,uint8_t *data,int len);
|
//extern int cw_out_generic(struct conn *conn,struct cw_action_in * a,uint8_t *data,int len);
|
||||||
extern int cw_out_generic(struct conn *conn, struct cw_action_out *a, uint8_t * dst); //, struct cw_item *item);
|
extern int cw_out_generic(struct conn *conn, struct cw_action_out *a, uint8_t * dst); //, struct cw_item *item);
|
||||||
@ -891,13 +901,18 @@ extern int cw_out_generic(struct conn *conn, struct cw_action_out *a, uint8_t *
|
|||||||
//extern int cw_out_ac_descriptor(struct conn *conn, uint32_t elem_id, uint8_t * dst,
|
//extern int cw_out_ac_descriptor(struct conn *conn, uint32_t elem_id, uint8_t * dst,
|
||||||
//struct cw_item *item);
|
//struct cw_item *item);
|
||||||
extern int cw_out_ac_descriptor(struct conn *conn, struct cw_action_out *a, uint8_t * dst); //,struct cw_item * item)
|
extern int cw_out_ac_descriptor(struct conn *conn, struct cw_action_out *a, uint8_t * dst); //,struct cw_item * item)
|
||||||
|
extern int cw_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a,
|
||||||
|
uint8_t * dst);
|
||||||
|
|
||||||
|
|
||||||
//extern int cw_out_capwap_control_ip_addrs(struct conn *conn, uint32_t elem_id,
|
//extern int cw_out_capwap_control_ip_addrs(struct conn *conn, uint32_t elem_id,
|
||||||
// uint8_t * dst, struct cw_item *item);
|
// uint8_t * dst, struct cw_item *item);
|
||||||
|
|
||||||
extern int cw_out_capwap_control_ip_addr_list(struct conn *conn,struct cw_action_out *a,uint8_t *dst) ;
|
extern int cw_out_capwap_control_ip_addr_list(struct conn *conn, struct cw_action_out *a,
|
||||||
|
uint8_t * dst);
|
||||||
|
|
||||||
extern int cw_put_msg(struct conn *conn, uint8_t * rawout);
|
extern int cw_put_msg(struct conn *conn, uint8_t * rawout);
|
||||||
|
int cw_out_image_data(struct conn *conn, struct cw_action_out *a, uint8_t * dst); // ,struct cw_item * item)
|
||||||
|
|
||||||
|
|
||||||
struct cw_ac_status {
|
struct cw_ac_status {
|
||||||
@ -918,12 +933,14 @@ struct cw_ac_status {
|
|||||||
* This function is only useful (used) in conjunction with
|
* This function is only useful (used) in conjunction with
|
||||||
* putting AC Descriptor message elements.
|
* putting AC Descriptor message elements.
|
||||||
*/
|
*/
|
||||||
static inline int cw_put_ac_status(uint8_t *dst, struct cw_ac_status *s){
|
static inline int cw_put_ac_status(uint8_t * dst, struct cw_ac_status *s)
|
||||||
|
{
|
||||||
uint8_t *d = dst;
|
uint8_t *d = dst;
|
||||||
|
|
||||||
d += cw_put_dword(d, (s->stations << 16) | (s->limit));
|
d += cw_put_dword(d, (s->stations << 16) | (s->limit));
|
||||||
d += cw_put_dword(d, (s->active_wtps << 16) | (s->max_wtps));
|
d += cw_put_dword(d, (s->active_wtps << 16) | (s->max_wtps));
|
||||||
d += cw_put_dword (d, (s->security<<24) | (s->rmac_field<<16) | (s->dtls_policy));
|
d += cw_put_dword(d,
|
||||||
|
(s->security << 24) | (s->rmac_field << 16) | (s->dtls_policy));
|
||||||
return d - dst;
|
return d - dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -944,19 +961,26 @@ int cw_register_actions_cipwap_ac(struct cw_actiondef *def);
|
|||||||
int cw_register_actions_capwap_wtp(struct cw_actiondef *def);
|
int cw_register_actions_capwap_wtp(struct cw_actiondef *def);
|
||||||
|
|
||||||
|
|
||||||
int cw_in_set_state_none(struct conn *conn,struct cw_action_in * a,uint8_t *data,int len);
|
int cw_in_set_state_none(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||||
|
int len);
|
||||||
struct cw_item *cw_out_get_outgoing(struct conn *conn, struct cw_action_out *a);
|
struct cw_item *cw_out_get_outgoing(struct conn *conn, struct cw_action_out *a);
|
||||||
struct cw_item *cw_out_get_local(struct conn *conn, struct cw_action_out *a);
|
struct cw_item *cw_out_get_local(struct conn *conn, struct cw_action_out *a);
|
||||||
extern int cw_in_check_join_resp(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
extern int cw_in_check_join_resp(struct conn *conn, struct cw_action_in *a,
|
||||||
int len);
|
uint8_t * data, int len);
|
||||||
|
|
||||||
extern int cw_in_check_disc_req(struct conn *conn,struct cw_action_in * a,uint8_t *data,int len);
|
extern int cw_in_check_disc_req(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||||
|
int len);
|
||||||
int cw_in_check_disc_resp(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
int cw_in_check_disc_resp(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||||
int len);
|
int len);
|
||||||
|
|
||||||
int cw_check_missing_mand(cw_action_in_t ** out, struct conn *conn, cw_action_in_t * a);
|
int cw_check_missing_mand(cw_action_in_t ** out, struct conn *conn, cw_action_in_t * a);
|
||||||
int cw_in_check_join_req(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len);
|
int cw_in_check_join_req(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||||
int cw_in_check_img_data_req(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
int len);
|
||||||
|
extern int cw_in_check_img_data_req_wtp(struct conn *conn, struct cw_action_in *a,
|
||||||
|
uint8_t * data, int len);
|
||||||
|
extern int cw_in_check_img_data_req_ac(struct conn *conn, struct cw_action_in *a,
|
||||||
|
uint8_t * data, int len);
|
||||||
|
int cw_in_check_img_data_resp(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||||
int len);
|
int len);
|
||||||
|
|
||||||
int cw_out_wtp_board_data(struct conn *conn, struct cw_action_out *a, uint8_t * dst);
|
int cw_out_wtp_board_data(struct conn *conn, struct cw_action_out *a, uint8_t * dst);
|
||||||
@ -967,30 +991,6 @@ struct cw_item * cw_out_get_session_id(struct conn *conn,struct cw_action_out *
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @defgroup TimerFunctions Timer functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start a timer.
|
|
||||||
* @param t number of seconds until the timer expires
|
|
||||||
* @return timer value to initialize a variable of time_t
|
|
||||||
*
|
|
||||||
* Example: time_t timer = cw_timer_start(60);
|
|
||||||
*/
|
|
||||||
#define cw_timer_start(t) (time(NULL)+t)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a timer is expired.
|
|
||||||
* @param t an time_t variable intializes by #cw_timer_start
|
|
||||||
* @return 0=timer is not expired\n 1=timer is expired.
|
|
||||||
*/
|
|
||||||
#define cw_timer_timeout(t) (time(NULL)>t ? 1 : 0)
|
|
||||||
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
|
|
||||||
int cw_send_request(struct conn *conn, int msg_id);
|
int cw_send_request(struct conn *conn, int msg_id);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -37,15 +37,12 @@ struct cw_item *cw_out_get_local(struct conn *conn, struct cw_action_out *a)
|
|||||||
|
|
||||||
struct cw_item * cw_out_get_session_id(struct conn *conn,struct cw_action_out * a)
|
struct cw_item * cw_out_get_session_id(struct conn *conn,struct cw_action_out * a)
|
||||||
{
|
{
|
||||||
printf("Vendor ID: %d\n", a->vendor_id);
|
|
||||||
uint8_t session_id[16];
|
uint8_t session_id[16];
|
||||||
int l = cw_rand(session_id,16);
|
int l = cw_rand(session_id,16);
|
||||||
if ( l!=16 ) {
|
if ( l!=16 ) {
|
||||||
cw_log(LOG_ERR,"Can't init session ID.");
|
cw_log(LOG_ERR,"Can't init session ID.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
return cw_itemstore_set_bstrn(conn->local,CW_ITEM_SESSION_ID,session_id,16);
|
||||||
|
|
||||||
return cw_itemstore_set_bstrn(conn->local,CW_ITEM_SESSION_ID,session_id,4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,13 +127,26 @@ cw_action_in_t capwap_actions_ac_in[] = {
|
|||||||
|
|
||||||
/* Message: Image Data Request - in Config State */
|
/* Message: Image Data Request - in Config State */
|
||||||
{0, 0, CW_STATE_CONFIGURE, CW_MSG_IMAGE_DATA_REQUEST, 0,
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_IMAGE_DATA_REQUEST, 0,
|
||||||
0, cw_in_check_img_data_req}
|
0, cw_in_check_img_data_req_ac}
|
||||||
,
|
,
|
||||||
{0, 0, CW_STATE_CONFIGURE, CW_MSG_IMAGE_DATA_REQUEST,
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_IMAGE_DATA_REQUEST,
|
||||||
CW_ACTION_IN_IMAGE_IDENTIFIER,
|
CW_ACTION_IN_IMAGE_IDENTIFIER,
|
||||||
0}
|
0}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* Message Image Data Response IN */
|
||||||
|
{0, 0, CW_STATE_IMAGE_DATA, CW_MSG_IMAGE_DATA_RESPONSE, 0,
|
||||||
|
0, cw_in_check_img_data_resp }
|
||||||
|
,
|
||||||
|
|
||||||
|
/* Element: Result Code */
|
||||||
|
{0, 0, CW_STATE_IMAGE_DATA, CW_MSG_IMAGE_DATA_RESPONSE,
|
||||||
|
CW_ACTION_IN_RESULT_CODE, 1}
|
||||||
|
|
||||||
|
,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -198,6 +211,21 @@ cw_action_out_t capwap_actions_ac_out[] = {
|
|||||||
,
|
,
|
||||||
|
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------------
|
||||||
|
* Image Data Request OUT
|
||||||
|
*/
|
||||||
|
|
||||||
|
{CW_MSG_IMAGE_DATA_REQUEST, CW_ITEM_NONE}
|
||||||
|
,
|
||||||
|
/* Image Data */
|
||||||
|
{CW_MSG_IMAGE_DATA_REQUEST, CW_ITEM_IMAGE_FILEHANDLE, 0,
|
||||||
|
CW_ELEM_IMAGE_DATA, NULL,cw_out_image_data, cw_out_get_outgoing,0}
|
||||||
|
,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* End of list */
|
/* End of list */
|
||||||
{0, 0}
|
{0, 0}
|
||||||
@ -224,7 +252,6 @@ int cw_register_actions_capwap_ac(struct cw_actiondef *def)
|
|||||||
rc += cw_strheap_register_strings(def->strelem, capwap_strings_elem);
|
rc += cw_strheap_register_strings(def->strelem, capwap_strings_elem);
|
||||||
|
|
||||||
|
|
||||||
printf("Registered %d strings\n", rc);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,26 @@ cw_action_in_t capwap_actions_wtp_in[] = {
|
|||||||
CW_ACTION_IN_RESULT_CODE, 1}
|
CW_ACTION_IN_RESULT_CODE, 1}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* Message Image Data Response */
|
||||||
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_IMAGE_DATA_RESPONSE, 0,
|
||||||
|
0, cw_in_check_img_data_resp }
|
||||||
|
,
|
||||||
|
|
||||||
|
/* Element: Result Code */
|
||||||
|
{0, 0, CW_STATE_CONFIGURE, CW_MSG_IMAGE_DATA_RESPONSE,
|
||||||
|
CW_ACTION_IN_RESULT_CODE, 1}
|
||||||
|
|
||||||
|
,
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* Message Image Data Request */
|
||||||
|
{0, 0, CW_STATE_IMAGE_DATA, CW_MSG_IMAGE_DATA_REQUEST, 0,
|
||||||
|
0, cw_in_check_img_data_req_wtp }
|
||||||
|
,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -113,21 +133,60 @@ cw_action_out_t capwap_actions_wtp_out[] = {
|
|||||||
|
|
||||||
/* WTP Board Data */
|
/* WTP Board Data */
|
||||||
{CW_MSG_JOIN_REQUEST, CW_ITEM_WTP_BOARD_DATA, 0,
|
{CW_MSG_JOIN_REQUEST, CW_ITEM_WTP_BOARD_DATA, 0,
|
||||||
CW_ELEM_WTP_BOARD_DATA, NULL,cw_out_wtp_board_data, cw_out_get_outgoing}
|
CW_ELEM_WTP_BOARD_DATA, NULL,cw_out_wtp_board_data, cw_out_get_outgoing,1}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
/* WTP Descriptor */
|
||||||
|
{CW_MSG_JOIN_REQUEST, CW_ITEM_WTP_DESCRIPTOR, 0,
|
||||||
|
CW_ELEM_WTP_DESCRIPTOR, NULL,cw_out_wtp_descriptor, NULL,1}
|
||||||
|
,
|
||||||
|
|
||||||
/* WTP Name */
|
/* WTP Name */
|
||||||
{CW_MSG_JOIN_REQUEST, CW_ITEM_WTP_NAME, 0,
|
{CW_MSG_JOIN_REQUEST, CW_ITEM_WTP_NAME, 0,
|
||||||
CW_ELEM_WTP_NAME, NULL,cw_out_generic, cw_out_get_local,1}
|
CW_ELEM_WTP_NAME, NULL,cw_out_generic, cw_out_get_local,1}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
/* WTP MAC Type */
|
||||||
|
{CW_MSG_JOIN_REQUEST, CW_ITEM_WTP_MAC_TYPE, 0,
|
||||||
|
CW_ELEM_WTP_MAC_TYPE, NULL,cw_out_generic, cw_out_get_local,1}
|
||||||
|
,
|
||||||
|
|
||||||
|
/* WTP MAC Type */
|
||||||
|
{CW_MSG_JOIN_REQUEST, CW_ITEM_WTP_FRAME_TUNNEL_MODE, 0,
|
||||||
|
CW_ELEM_WTP_FRAME_TUNNEL_MODE, NULL,cw_out_generic, cw_out_get_local,1}
|
||||||
|
,
|
||||||
|
|
||||||
/* Session ID */
|
/* Session ID */
|
||||||
{CW_MSG_JOIN_REQUEST, CW_ITEM_SESSION_ID, 0,
|
{CW_MSG_JOIN_REQUEST, CW_ITEM_SESSION_ID, 0,
|
||||||
CW_ELEM_SESSION_ID, NULL,cw_out_generic, cw_out_get_session_id,1}
|
CW_ELEM_SESSION_ID, NULL,cw_out_generic, cw_out_get_session_id,1}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------------
|
||||||
|
* Image Data Request OUT
|
||||||
|
*/
|
||||||
|
|
||||||
|
{CW_MSG_IMAGE_DATA_REQUEST, CW_ITEM_NONE}
|
||||||
|
,
|
||||||
|
/* Image Identifier */
|
||||||
|
{CW_MSG_IMAGE_DATA_REQUEST, CW_ITEM_IMAGE_IDENTIFIER, 0,
|
||||||
|
CW_ELEM_IMAGE_IDENTIFIER, NULL,cw_out_generic, cw_out_get_outgoing,0}
|
||||||
|
,
|
||||||
|
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------------
|
||||||
|
* Image Data Response OUT
|
||||||
|
*/
|
||||||
|
{CW_MSG_IMAGE_DATA_RESPONSE, CW_ITEM_NONE}
|
||||||
|
,
|
||||||
|
|
||||||
|
/* Result Code */
|
||||||
|
{CW_MSG_IMAGE_DATA_RESPONSE, CW_ITEM_RESULT_CODE, 0,
|
||||||
|
CW_ELEM_RESULT_CODE, NULL,cw_out_generic, cw_out_get_outgoing, 1}
|
||||||
|
,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{0, 0}
|
{0, 0}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -151,7 +210,6 @@ int cw_register_actions_capwap_wtp(struct cw_actiondef *def)
|
|||||||
rc += cw_strheap_register_strings(def->strelem, capwap_strings_elem);
|
rc += cw_strheap_register_strings(def->strelem, capwap_strings_elem);
|
||||||
|
|
||||||
|
|
||||||
printf("Registered %d strings\n", rc);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -53,9 +53,10 @@ enum capwap_items {
|
|||||||
|
|
||||||
/* Other Items */
|
/* Other Items */
|
||||||
CW_ITEM_AC_IMAGE_DIR, /* Path where WTP images are stored */
|
CW_ITEM_AC_IMAGE_DIR, /* Path where WTP images are stored */
|
||||||
CW_ITEM_WTP_IMAGE_FILENAME, /* Full path of image filename */
|
CW_ITEM_IMAGE_FILENAME, /* Full path of image filename */
|
||||||
CW_ITEM_DISCOVERIES,
|
CW_ITEM_DISCOVERIES,
|
||||||
CW_ITEM_AC_PRIO_LIST /* AC Name with Priority list */
|
CW_ITEM_AC_PRIO_LIST, /* AC Name with Priority list */
|
||||||
|
CW_ITEM_IMAGE_FILEHANDLE /* FILE handle for uploading and downloading images */
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ struct cw_str capwap_strings_result[] = {
|
|||||||
{CW_RESULT_SUCCESS,"Success"}, /* 0 */
|
{CW_RESULT_SUCCESS,"Success"}, /* 0 */
|
||||||
{CW_RESULT_MISSING_AC_LIST,"AC List Message Element MUST be Present"}, /* 1 */
|
{CW_RESULT_MISSING_AC_LIST,"AC List Message Element MUST be Present"}, /* 1 */
|
||||||
{CW_RESULT_SUCCESS_NAT,"Success - NAT Detected"}, /* 2 */
|
{CW_RESULT_SUCCESS_NAT,"Success - NAT Detected"}, /* 2 */
|
||||||
|
{CW_RESULT_IMAGE_DATA_ERROR,"Image Data Error (Unspecified)"}, /* 16 */
|
||||||
{CW_RESULT_MISSING_MAND_ELEM,"Missing Mandatory Message Element"}, /* 20 */
|
{CW_RESULT_MISSING_MAND_ELEM,"Missing Mandatory Message Element"}, /* 20 */
|
||||||
|
|
||||||
{CW_STR_STOP,"Unknown Result Code"}
|
{CW_STR_STOP,"Unknown Result Code"}
|
||||||
|
@ -5,6 +5,7 @@ struct cw_str capwap_strings_state[] = {
|
|||||||
{ CW_STATE_JOIN,"Join" },
|
{ CW_STATE_JOIN,"Join" },
|
||||||
{ CW_STATE_RUN,"Run" },
|
{ CW_STATE_RUN,"Run" },
|
||||||
{ CW_STATE_CONFIGURE,"Configure" },
|
{ CW_STATE_CONFIGURE,"Configure" },
|
||||||
{ CW_STR_STOP,"Undefined" }
|
{ CW_STATE_IMAGE_DATA,"Image Data" },
|
||||||
|
{ CW_STR_STOP,"Undefined" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -173,7 +173,8 @@ static int cw_process_msg(struct conn *conn, uint8_t * rawmsg, int len)
|
|||||||
"Message type %d (%s) unexpected/illigal in %s State, discarding.",
|
"Message type %d (%s) unexpected/illigal in %s State, discarding.",
|
||||||
as.msg_id, cw_strmsg(as.msg_id),
|
as.msg_id, cw_strmsg(as.msg_id),
|
||||||
cw_strstate(conn->capwap_state));
|
cw_strstate(conn->capwap_state));
|
||||||
return 0;
|
errno=EAGAIN;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Request message not found in current state, check if we know
|
/* Request message not found in current state, check if we know
|
||||||
@ -339,65 +340,61 @@ static int process_message(struct conn *conn, uint8_t * rawmsg, int rawlen,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//int conn_process_packet(struct conn *conn, uint8_t * packet, int len,
|
|
||||||
// int (*cb) (void *, uint8_t *, int), void *cbarg)
|
|
||||||
|
|
||||||
int conn_process_packet(struct conn *conn, uint8_t * packet, int len)
|
int conn_process_packet(struct conn *conn, uint8_t * packet, int len)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* log this packet */
|
||||||
|
cw_dbg_pkt(DBG_PKT_IN,conn, packet, len);
|
||||||
|
|
||||||
if (len < 8) {
|
if (len < 8) {
|
||||||
/* packet too short */
|
/* packet too short */
|
||||||
cw_dbg(DBG_CW_PKT_ERR,
|
cw_dbg(DBG_PKT_ERR,
|
||||||
"Discarding packet from %s, packet too short, len=%d",
|
"Discarding packet from %s, packet too short, len=%d",
|
||||||
sock_addr2str(&conn->addr), len);
|
sock_addr2str(&conn->addr), len);
|
||||||
return 0;
|
errno = EAGAIN;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int preamble = cw_get_hdr_preamble(packet);
|
int preamble = cw_get_hdr_preamble(packet);
|
||||||
|
|
||||||
if ((preamble & 0xf0) != CW_VERSION) {
|
if ((preamble & 0xf0) != CW_VERSION) {
|
||||||
/* wrong version */
|
/* wrong version */
|
||||||
cw_dbg(DBG_CW_PKT_ERR,
|
cw_dbg(DBG_PKT_ERR,
|
||||||
"Discarding packet from %s, wrong version, version=%d",
|
"Discarding packet from %s, wrong version, version=%d",
|
||||||
sock_addr2str(&conn->addr), (preamble & 0xf0) >> 8);
|
sock_addr2str(&conn->addr), (preamble & 0xf0) >> 8);
|
||||||
return 0;
|
errno=EAGAIN;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preamble & 0xf) {
|
if (preamble & 0xf) {
|
||||||
/* decode dtls */
|
/* dtls encoded, this shuold never happen here */
|
||||||
return 0;
|
cw_dbg(DBG_PKT_ERR,
|
||||||
|
"Discarding packet from %s, encrypted data, after encryption ...",
|
||||||
|
sock_addr2str(&conn->addr));
|
||||||
|
errno = EAGAIN;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* log this packet */
|
|
||||||
cw_dbg_packet(conn, packet, len);
|
|
||||||
|
|
||||||
|
|
||||||
int offs = cw_get_hdr_msg_offset(packet);
|
int offs = cw_get_hdr_msg_offset(packet);
|
||||||
|
|
||||||
|
|
||||||
int payloadlen = len - offs;
|
int payloadlen = len - offs;
|
||||||
if (payloadlen < 0) {
|
if (payloadlen < 0) {
|
||||||
cw_dbg(DBG_CW_PKT_ERR,
|
cw_dbg(DBG_PKT_ERR,
|
||||||
"Discarding packet from %s, header length greater than len, hlen=%d",
|
"Discarding packet from %s, header length greater than len, hlen=%d",
|
||||||
sock_addr2str(&conn->addr), offs);
|
sock_addr2str(&conn->addr), offs);
|
||||||
/* EINVAL */
|
/* EINVAL */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
struct cwrmsg cwrmsg;
|
|
||||||
cwrmsg.wbid=(val>>9) & 0x1f;
|
|
||||||
cwrmsg.rid=(val>>14) & 0x1f;
|
|
||||||
*/
|
|
||||||
|
|
||||||
//printf ("Offs is %d RML is %d\n",offs,cw_get_hdr_rmac_len(packet));
|
|
||||||
|
|
||||||
/* Check Radio MAC if preset */
|
/* Check Radio MAC if preset */
|
||||||
if (cw_get_hdr_flag_m(packet)) {
|
if (cw_get_hdr_flag_m(packet)) {
|
||||||
|
|
||||||
if (cw_get_hdr_rmac_len(packet) + 8 > offs) {
|
if (cw_get_hdr_rmac_len(packet) + 8 > offs) {
|
||||||
/* wrong rmac size */
|
/* wrong rmac size */
|
||||||
cw_dbg(DBG_CW_PKT_ERR,
|
cw_dbg(DBG_PKT_ERR,
|
||||||
"Discarding packet, wrong R-MAC size, size=%d",
|
"Discarding packet, wrong R-MAC size, size=%d",
|
||||||
*(packet + 8));
|
*(packet + 8));
|
||||||
return 0;
|
return 0;
|
||||||
@ -415,7 +412,7 @@ int conn_process_packet(struct conn *conn, uint8_t * packet, int len)
|
|||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cw_dbg_packet(conn, f + 4, *(uint32_t *) f);
|
// cw_dbg_packet(conn, f + 4, *(uint32_t *) f);
|
||||||
|
|
||||||
|
|
||||||
// extern int cw_process_msg(struct conn * conn,uint8_t*msg,int len);
|
// extern int cw_process_msg(struct conn * conn,uint8_t*msg,int len);
|
||||||
@ -445,6 +442,9 @@ int conn_process_packet(struct conn *conn, uint8_t * packet, int len)
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
//msg_4*((val >> 19) & 0x1f);
|
//msg_4*((val >> 19) & 0x1f);
|
||||||
|
|
||||||
|
cw_dbg_msg(DBG_MSG_IN,conn,packet,len);
|
||||||
|
|
||||||
return process_message(conn, packet, len, NULL,NULL);
|
return process_message(conn, packet, len, NULL,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,7 +462,7 @@ int cw_read_messages(struct conn *conn)
|
|||||||
return n;
|
return n;
|
||||||
|
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
printf("Have a packet with %d bytes\n",n);
|
// printf("Have a packet with %d bytes\n",n);
|
||||||
return conn_process_packet(conn, buf, n);
|
return conn_process_packet(conn, buf, n);
|
||||||
}
|
}
|
||||||
//printf("DTLS_ERROR: %d\n",conn->dtls_error);
|
//printf("DTLS_ERROR: %d\n",conn->dtls_error);
|
||||||
|
@ -19,8 +19,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "log.h"
|
#include "dbg.h"
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
|
#include "sock.h"
|
||||||
|
|
||||||
|
|
||||||
void conn_q_add_packet(struct conn * conn,uint8_t *packet,int len)
|
void conn_q_add_packet(struct conn * conn,uint8_t *packet,int len)
|
||||||
@ -31,7 +32,8 @@ void conn_q_add_packet(struct conn * conn,uint8_t *packet,int len)
|
|||||||
|
|
||||||
if (conn->qrpos==qwpos){
|
if (conn->qrpos==qwpos){
|
||||||
/* no buffers, discard packet */
|
/* no buffers, discard packet */
|
||||||
cw_dbg(DBG_CW_PKT_ERR, "Discarding packet, no queue buffers left");
|
cw_dbg(DBG_PKT_ERR, "Discarding packe from %s, no queue buffers left",
|
||||||
|
sock_addr2str(&conn->addr));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
#include "log.h"
|
#include "dbg.h"
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
|
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ int conn_send_msg(struct conn * conn, uint8_t *rawmsg)
|
|||||||
|
|
||||||
int packetlen = cw_get_hdr_msg_total_len(rawmsg);
|
int packetlen = cw_get_hdr_msg_total_len(rawmsg);
|
||||||
|
|
||||||
uint8_t * msgptr = rawmsg + cw_get_hdr_msg_offset(rawmsg);
|
//uint8_t * msgptr = rawmsg + cw_get_hdr_msg_offset(rawmsg);
|
||||||
|
|
||||||
|
|
||||||
/* Zyxel doesn't count msg element length from
|
/* Zyxel doesn't count msg element length from
|
||||||
@ -34,12 +34,13 @@ int conn_send_msg(struct conn * conn, uint8_t *rawmsg)
|
|||||||
cw_put_dword(ptr+4, conn->fragid<<16 | fragoffset<<3 );
|
cw_put_dword(ptr+4, conn->fragid<<16 | fragoffset<<3 );
|
||||||
|
|
||||||
|
|
||||||
|
//XXX
|
||||||
{
|
{
|
||||||
char h[200];
|
char h[200];
|
||||||
hdr_print(h,ptr,mtu);
|
hdr_print(h,ptr,mtu);
|
||||||
cw_dbg(DBG_CW_PKT_OUT,"Sending capwap packet to %s:\n%s",sock_addr2str(&conn->addr),h);
|
cw_dbg(DBG_PKT_OUT,"Sending capwap packet to %s:\n%s",sock_addr2str(&conn->addr),h);
|
||||||
}
|
}
|
||||||
cw_dbg_dmp(DBG_CW_PKT_DMP,ptr,mtu,"Sending packet ...");
|
cw_dbg_dmp(DBG_PKT_DMP,ptr,mtu,"Sending packet ...");
|
||||||
|
|
||||||
|
|
||||||
if (conn->write(conn,ptr,mtu)<0)
|
if (conn->write(conn,ptr,mtu)<0)
|
||||||
@ -86,12 +87,12 @@ int conn_send_msg(struct conn * conn, uint8_t *rawmsg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cw_dbg_dmp(DBG_CW_PKT_DMP,ptr,packetlen,"Sending packet ...");
|
cw_dbg_dmp(DBG_PKT_DMP,ptr,packetlen,"Sending packet ...");
|
||||||
//return conn->write(conn,ptr,msglen-fragoffset*8+hlen);
|
//return conn->write(conn,ptr,msglen-fragoffset*8+hlen);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
printf("Send packet len %p %d\n",ptr,packetlen);
|
//printf("Send packet len %p %d\n",ptr,packetlen);
|
||||||
|
|
||||||
return conn->write(conn,ptr,packetlen);
|
return conn->write(conn,ptr,packetlen);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ struct args {
|
|||||||
struct avltree *mand;
|
struct avltree *mand;
|
||||||
int n;
|
int n;
|
||||||
};
|
};
|
||||||
|
/*
|
||||||
static int check_mand_cb(void *priv, void *val)
|
static int check_mand_cb(void *priv, void *val)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ return 1;
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
int cw_check_missing_mand(cw_action_in_t ** out, struct conn * conn, cw_action_in_t *a)
|
int cw_check_missing_mand(cw_action_in_t ** out, struct conn * conn, cw_action_in_t *a)
|
||||||
{
|
{
|
||||||
|
@ -40,10 +40,11 @@ int cw_foreach_msgelem(uint8_t * msgelems, int len,
|
|||||||
elen = val & 0xffff;
|
elen = val & 0xffff;
|
||||||
if (i + elen + 4 > len) {
|
if (i + elen + 4 > len) {
|
||||||
|
|
||||||
|
/*
|
||||||
printf("***************************************************************************\n");
|
printf("***************************************************************************\n");
|
||||||
printf("Type: %d\n",type);
|
printf("Type: %d\n",type);
|
||||||
printf("Bumm %d %d\n",i+elen+4,len);
|
printf("Bumm %d %d\n",i+elen+4,len);
|
||||||
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ int cw_in_check_disc_req(struct conn *conn, struct cw_action_in *a, uint8_t * da
|
|||||||
|
|
||||||
/* if mandatory elements are missing send no discovery response */
|
/* if mandatory elements are missing send no discovery response */
|
||||||
if (n) {
|
if (n) {
|
||||||
cw_dbg(DBG_CW_INFO,
|
cw_dbg(DBG_MSG_ERR,
|
||||||
"Ignoring Discovery Request from %s - missing mandatory elements.",
|
"Ignoring Discovery Request from %s - missing mandatory elements.",
|
||||||
sock_addr2str(&conn->addr));
|
sock_addr2str(&conn->addr));
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -13,12 +13,12 @@ int cw_in_check_disc_resp(struct conn *conn, struct cw_action_in *a, uint8_t * d
|
|||||||
int n = cw_check_missing_mand(mlist, conn, a);
|
int n = cw_check_missing_mand(mlist, conn, a);
|
||||||
cw_dbg_missing_mand(DBG_ELEM, conn, mlist, n, a);
|
cw_dbg_missing_mand(DBG_ELEM, conn, mlist, n, a);
|
||||||
|
|
||||||
cw_dbg(DBG_CW_INFO,"This response came from: %s\n",sock_addr2str(&conn->addr));
|
//cw_dbg(DBG_INFO,"This response came from: %s",sock_addr2str(&conn->addr));
|
||||||
|
|
||||||
|
|
||||||
/* if mandatory elements are missing, ignore this response */
|
/* if mandatory elements are missing, ignore this response */
|
||||||
if (n) {
|
if (n) {
|
||||||
cw_dbg(DBG_CW_INFO,
|
cw_dbg(DBG_MSG_ERR,
|
||||||
"Ignoring Discovery Response from %s - missing mandatory elements.",
|
"Ignoring Discovery Response from %s - missing mandatory elements.",
|
||||||
sock_addr2str(&conn->addr));
|
sock_addr2str(&conn->addr));
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "capwap_items.h"
|
#include "capwap_items.h"
|
||||||
|
|
||||||
|
|
||||||
int cw_in_check_img_data_req(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
int cw_in_check_img_data_req_ac(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
/* Check for mandatory elements */
|
/* Check for mandatory elements */
|
||||||
@ -25,11 +25,13 @@ int cw_in_check_img_data_req(struct conn *conn, struct cw_action_in *a, uint8_t
|
|||||||
uint32_t vendor_id = vendorstr_get_vendor_id(i->data);
|
uint32_t vendor_id = vendorstr_get_vendor_id(i->data);
|
||||||
|
|
||||||
const char * image_dir;
|
const char * image_dir;
|
||||||
//XXX image_dir = cw_itemstore_get_str(conn->local,CW_ITEM_AC_IMAGE_DIR);
|
image_dir = cw_itemstore_get_str(conn->local,CW_ITEM_AC_IMAGE_DIR);
|
||||||
|
if ( !image_dir )
|
||||||
|
image_dir="./img/"; //XXX
|
||||||
|
|
||||||
char * image_filename = malloc(6+vendorstr_len(i->data)+1+strlen(image_dir));
|
char * image_filename = malloc(6+vendorstr_len(i->data)+1+strlen(image_dir));
|
||||||
if (!image_filename)
|
if (!image_filename)
|
||||||
return CW_RESULT_IMAGE_DATA_OTHER_ERROR;
|
return CW_RESULT_IMAGE_DATA_ERROR;
|
||||||
|
|
||||||
sprintf(image_filename,"%s%04X/%s",image_dir,vendor_id,vendorstr_data(i->data));
|
sprintf(image_filename,"%s%04X/%s",image_dir,vendor_id,vendorstr_data(i->data));
|
||||||
|
|
||||||
@ -39,21 +41,17 @@ int cw_in_check_img_data_req(struct conn *conn, struct cw_action_in *a, uint8_t
|
|||||||
cw_log(LOG_WARNING,"Can't open image file: %s - %s - requestet by WTP",
|
cw_log(LOG_WARNING,"Can't open image file: %s - %s - requestet by WTP",
|
||||||
image_filename,strerror(errno));
|
image_filename,strerror(errno));
|
||||||
free(image_filename);
|
free(image_filename);
|
||||||
return CW_RESULT_IMAGE_DATA_OTHER_ERROR;
|
return CW_RESULT_IMAGE_DATA_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
cw_itemstore_set_str(conn->outgoing,CW_ITEM_WTP_IMAGE_FILENAME,image_filename);
|
cw_itemstore_set_str(conn->outgoing,CW_ITEM_IMAGE_FILENAME,image_filename);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* set result code to ok and change to configure state */
|
|
||||||
// cw_itemstore_set_dword(conn->local,CW_ITEM_RESULT_CODE,0);
|
|
||||||
// conn->capwap_state = CW_STATE_CONFIGURE;
|
|
||||||
|
|
||||||
cw_itemstore_set_dword(conn->outgoing,CW_ITEM_RESULT_CODE,0);
|
cw_itemstore_set_dword(conn->outgoing,CW_ITEM_RESULT_CODE,0);
|
||||||
conn->capwap_state=CW_STATE_IMAGE_DATA;
|
conn->capwap_state=CW_STATE_IMAGE_DATA;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return CW_RESULT_IMAGE_DATA_ERROR;
|
||||||
|
|
||||||
}
|
}
|
@ -9,8 +9,6 @@ int cw_in_check_join_req(struct conn *conn, struct cw_action_in *a, uint8_t * da
|
|||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
|
|
||||||
printf("join req checker\n");
|
|
||||||
|
|
||||||
cw_action_in_t * mlist[60];
|
cw_action_in_t * mlist[60];
|
||||||
|
|
||||||
/* Check for mandatory elements */
|
/* Check for mandatory elements */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
#include "log.h"
|
#include "dbg.h"
|
||||||
#include "itemstore.h"
|
#include "itemstore.h"
|
||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
#include "log.h"
|
#include "dbg.h"
|
||||||
#include "itemstore.h"
|
#include "itemstore.h"
|
||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
|
#include "dbg.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "sock.h" //Tube
|
#include "sock.h" //Tube
|
||||||
/**
|
/**
|
||||||
@ -20,10 +21,10 @@ int cw_in_vendor_specific_payload(struct conn *conn,struct cw_action_in * a,uint
|
|||||||
|
|
||||||
af = cw_actionlist_in_get(conn->actions->in,&as);
|
af = cw_actionlist_in_get(conn->actions->in,&as);
|
||||||
|
|
||||||
cw_dbg(DBG_ELEM,"From might be: %s\n",sock_addr2str(&conn->addr));
|
//cw_dbg(DBG_ELEM,"From might be: %s\n",sock_addr2str(&conn->addr));
|
||||||
|
|
||||||
if (!af) {
|
if (!af) {
|
||||||
cw_log(DBG_ELEM,"Can't handle Vendor Specific Payload %s/%d, in msg %d (%s) in %s state.",
|
cw_dbg(DBG_ELEM,"Can't handle Vendor Specific Payload %s/%d, in msg %d (%s) in %s state.",
|
||||||
cw_strvendor(as.vendor_id),
|
cw_strvendor(as.vendor_id),
|
||||||
as.elem_id,as.msg_id,cw_strmsg(as.msg_id),cw_strstate(as.capwap_state));
|
as.elem_id,as.msg_id,cw_strmsg(as.msg_id),cw_strstate(as.capwap_state));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "itemstore.h"
|
#include "itemstore.h"
|
||||||
|
|
||||||
#include "cw_util.h"
|
#include "cw_util.h"
|
||||||
#include "log.h"
|
#include "dbg.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "wtpinfo.h"
|
#include "wtpinfo.h"
|
||||||
|
|
||||||
#include "cw_util.h"
|
#include "cw_util.h"
|
||||||
#include "log.h"
|
#include "dbg.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ static int readelem_wtp_descriptor(struct conn *conn, struct cw_action_in *a, ui
|
|||||||
int i;
|
int i;
|
||||||
if (ncrypt == 0 ){
|
if (ncrypt == 0 ){
|
||||||
/* non-conform */
|
/* non-conform */
|
||||||
cw_dbg(DBG_CW_RFC,"Non-standard-conform WTP descriptor detected (See RFC 5415)");
|
cw_dbg(DBG_RFC,"Non-standard-conform WTP descriptor detected (See RFC 5415)");
|
||||||
if (!cq)
|
if (!cq)
|
||||||
i=3;
|
i=3;
|
||||||
else
|
else
|
||||||
@ -102,7 +102,7 @@ int cw_in_wtp_descriptor(struct conn *conn,struct cw_action_in * a,uint8_t *data
|
|||||||
{
|
{
|
||||||
int rc =readelem_wtp_descriptor(conn, a,data,len,0);
|
int rc =readelem_wtp_descriptor(conn, a,data,len,0);
|
||||||
if (rc==-1){
|
if (rc==-1){
|
||||||
cw_dbg(DBG_CW_RFC,"Bad WTP descriptor, trying cisco hack");
|
cw_dbg(DBG_RFC,"Bad WTP descriptor, trying cisco hack");
|
||||||
rc =readelem_wtp_descriptor(conn, a,data,len,1);
|
rc =readelem_wtp_descriptor(conn, a,data,len,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,10 +34,7 @@
|
|||||||
|
|
||||||
#include "cw_util.h"
|
#include "cw_util.h"
|
||||||
|
|
||||||
|
#include "dbg.h"
|
||||||
int cw_dbg_opt_detail = 0;
|
|
||||||
int cw_dbg_opt_level = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int cw_log_debug_level = 0;
|
int cw_log_debug_level = 0;
|
||||||
@ -56,7 +53,7 @@ void cw_log_dbg_(int level, const char *file, int line, const char *format, ...)
|
|||||||
vsprintf(buf, format, args);
|
vsprintf(buf, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (cw_dbg_opt_detail & DBG_DETAIL_LINE_NUMBERS)
|
if (cw_dbg_opt_display & DBG_DISP_LINE_NUMBERS)
|
||||||
cw_log(LOG_DEBUG, "%s:%d: %s", file, line, buf);
|
cw_log(LOG_DEBUG, "%s:%d: %s", file, line, buf);
|
||||||
else
|
else
|
||||||
cw_log(LOG_DEBUG, buf);
|
cw_log(LOG_DEBUG, buf);
|
||||||
|
@ -36,12 +36,11 @@ int cw_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *dst
|
|||||||
|
|
||||||
|
|
||||||
i = cw_itemstore_get(conn->outgoing,CW_ITEM_AC_HARDWARE_VERSION);
|
i = cw_itemstore_get(conn->outgoing,CW_ITEM_AC_HARDWARE_VERSION);
|
||||||
|
|
||||||
if ( i ) {
|
if ( i ) {
|
||||||
d += cw_put_version(d,CW_SUBELEM_AC_HARDWARE_VERSION,i->data);
|
d += cw_put_version(d,CW_SUBELEM_AC_HARDWARE_VERSION,i->data);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cw_dbg(DBG_ELEM_ERR, "Can't send hard version in AC descriptor, not set.");
|
cw_log(LOG_ERR, "Can't send hard version in AC descriptor, not set.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ int cw_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *dst
|
|||||||
d += cw_put_version(d,CW_SUBELEM_AC_SOFTWARE_VERSION,i->data);
|
d += cw_put_version(d,CW_SUBELEM_AC_SOFTWARE_VERSION,i->data);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cw_dbg(DBG_ELEM_ERR, "Can't send software version in AC descriptor, not set.");
|
cw_log(LOG_ERR, "Can't send software version in AC descriptor, not set.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = d-dst-4;
|
int len = d-dst-4;
|
||||||
|
@ -27,7 +27,7 @@ int cw_out_cisco_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_
|
|||||||
d += cw_put_version(d,1,i->data);
|
d += cw_put_version(d,1,i->data);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cw_dbg(DBG_ELEM_ERR, "Can't send software version in AC descriptor, not set.");
|
cw_log(LOG_ERR, "Can't set Software Version in AC descriptor, No value defined.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = d-dst-4;
|
int len = d-dst-4;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
#include "capwap_items.h"
|
#include "capwap_items.h"
|
||||||
|
|
||||||
|
#include "dbg.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
|
||||||
@ -20,6 +21,15 @@ int cw_put_item(uint8_t * dst, struct cw_item *item)
|
|||||||
return cw_put_dword(dst, item->dword);
|
return cw_put_dword(dst, item->dword);
|
||||||
case CW_ITEMTYPE_BSTR:
|
case CW_ITEMTYPE_BSTR:
|
||||||
return cw_put_bstr(dst, item->data);
|
return cw_put_bstr(dst, item->data);
|
||||||
|
case CW_ITEMTYPE_VENDORSTR:
|
||||||
|
{
|
||||||
|
int l=0;
|
||||||
|
l+=cw_put_dword(dst, vendorstr_get_vendor_id(item->data));
|
||||||
|
l+=cw_put_data(dst+4, vendorstr_data(item->data),vendorstr_len(item->data));
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
cw_log(LOG_ERR,"No method to put items of type %d",item->type);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,8 +55,17 @@ int cw_out_generic(struct conn *conn, struct cw_action_out *a, uint8_t * dst) //
|
|||||||
int len;
|
int len;
|
||||||
if (!item) {
|
if (!item) {
|
||||||
if (a->mand) {
|
if (a->mand) {
|
||||||
cw_log(LOG_ERR, "Error: Cannot send mandatory message element %d - (%s)",
|
cw_log(LOG_ERR,
|
||||||
a->elem_id, cw_strelemp(conn->actions, a->elem_id));
|
"Can't put mandatory element %d - (%s) into %s. No value found.",
|
||||||
|
a->elem_id, cw_strelemp(conn->actions, a->elem_id)
|
||||||
|
, cw_strmsg(a->msg_id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
cw_dbg(DBG_ELEM,"No output for elemnt %d -(%s) in %s. Item %d not found.",
|
||||||
|
a->elem_id, cw_strelemp(conn->actions, a->elem_id)
|
||||||
|
, cw_strmsg(a->msg_id),a->item_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -64,7 +64,7 @@ int cw_out_wtp_board_data(struct conn *conn, struct cw_action_out *a, uint8_t *
|
|||||||
d += cw_put_data(d, bstr_data(i->data), bstr_len(i->data));
|
d += cw_put_data(d, bstr_data(i->data), bstr_len(i->data));
|
||||||
}
|
}
|
||||||
|
|
||||||
int l = d - dst;
|
int l = d - dst-4;
|
||||||
return l + cw_put_elem_hdr(dst, CW_ELEM_WTP_BOARD_DATA, l - 4);
|
return l + cw_put_elem_hdr(dst, CW_ELEM_WTP_BOARD_DATA, l );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "dbg.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,21 +67,37 @@ int cw_put_msg(struct conn *conn, uint8_t * rawout)
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
while(NULL != (ae=avliter_next(&i))) {
|
while(NULL != (ae=avliter_next(&i))) {
|
||||||
|
|
||||||
printf("Put %d %d\n",ae->msg_id,ae->elem_id);
|
//printf("Put %d %d\n",ae->msg_id,ae->elem_id);
|
||||||
|
|
||||||
if (ae->msg_id != as.msg_id) {
|
if (ae->msg_id != as.msg_id) {
|
||||||
/* Element is from next msg, close action */
|
/* Element is from next msg, close action */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ae->out) {
|
if (ae->out) {
|
||||||
len += ae->out(conn, ae, dst+len);
|
int l=0;
|
||||||
|
l= ae->out(conn, ae, dst+len);
|
||||||
|
len +=l;
|
||||||
|
// cw_dbg_elem_colored(DBG_ELEM, conn, ae->msg_id, ae->elem_id,
|
||||||
|
// dst+len-l,l);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//cw_dbg_elem_colored(DBG_ELEM,"Adding element %d to msg %d, len = %d",ae->msg_id,ae->elem_id,l);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
cw_set_msg_elems_len(msgptr, len);
|
cw_set_msg_elems_len(msgptr, len);
|
||||||
|
|
||||||
|
if (as.msg_id) {
|
||||||
|
/* It's a request, so we have to set seqnum */
|
||||||
|
int s = conn_get_next_seqnum(conn);
|
||||||
|
cw_set_msg_seqnum(msgptr,s);
|
||||||
|
// printf("Set seqnum to : %d\n",s);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
* Send an image file to an AP
|
* Send an image file to an AP
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void cw_send_image_file(struct conn *conn, FILE *infile)
|
void cw_send_image_file(struct conn *conn)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -53,8 +53,14 @@ void cw_send_image_file(struct conn *conn, FILE *infile)
|
|||||||
cw_log(LOG_INFO, "Sending image file %s to %s", filename, sock_addr2str(&conn->addr));
|
cw_log(LOG_INFO, "Sending image file %s to %s", filename, sock_addr2str(&conn->addr));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct cwrmsg *cwrmsg;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t buffer[1024]; /* buffer MUST be 1024 */
|
uint8_t buffer[1024]; /* buffer MUST be 1024 */
|
||||||
|
|
||||||
|
|
||||||
struct cwimage_data data;
|
struct cwimage_data data;
|
||||||
memset(&data,0,sizeof(struct cwimage_data));
|
memset(&data,0,sizeof(struct cwimage_data));
|
||||||
data.data = buffer;
|
data.data = buffer;
|
||||||
@ -82,8 +88,8 @@ void cw_send_image_file(struct conn *conn, FILE *infile)
|
|||||||
|
|
||||||
bl++;
|
bl++;
|
||||||
|
|
||||||
conn_prepare_image_data_request(conn, &data, 0);
|
// conn_prepare_image_data_request(conn, &data, 0);
|
||||||
cwrmsg = conn_send_request(conn);
|
// cwrmsg = conn_send_request(conn);
|
||||||
|
|
||||||
if (!cwrmsg) {
|
if (!cwrmsg) {
|
||||||
cw_log(LOG_ERR,"Error sneding image file to %s",sock_addr2str(&conn->addr));
|
cw_log(LOG_ERR,"Error sneding image file to %s",sock_addr2str(&conn->addr));
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "capwap.h"
|
|
||||||
|
#include "strlist.h"
|
||||||
|
|
||||||
const char * cw_strlist_get_str(struct cw_str *s,int id)
|
const char * cw_strlist_get_str(struct cw_str *s,int id)
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
|
|
||||||
|
/*
|
||||||
void cw_mand_elem_found(int *l,int type)
|
void cw_mand_elem_found(int *l,int type)
|
||||||
{
|
{
|
||||||
if (!cw_dbg_is_level(DBG_CW_RFC))
|
if (!cw_dbg_is_level(DBG_CW_RFC))
|
||||||
@ -37,7 +38,9 @@ void cw_mand_elem_found(int *l,int type)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
void cw_get_missing_mand_elems(char *dst, int *l)
|
void cw_get_missing_mand_elems(char *dst, int *l)
|
||||||
{
|
{
|
||||||
if (!cw_dbg_is_level(DBG_CW_RFC))
|
if (!cw_dbg_is_level(DBG_CW_RFC))
|
||||||
@ -54,6 +57,7 @@ void cw_get_missing_mand_elems(char *dst, int *l)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
int cw_is_missing_mand_elems(int *l)
|
int cw_is_missing_mand_elems(int *l)
|
||||||
|
306
src/capwap/dbg.c
306
src/capwap/dbg.c
@ -21,11 +21,26 @@
|
|||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "strlist.h"
|
||||||
|
#include "format.h"
|
||||||
|
#include "capwap.h"
|
||||||
|
|
||||||
|
|
||||||
|
void (*cw_dbg_cb) (int level, const char *format, ...) = CW_LOG_DEFAULT_LOG;
|
||||||
|
void (*cw_dbg_vcb) (int level, const char *fromat, va_list args) = CW_LOG_DEFAULT_VLOG;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t cw_dbg_opt_display = 0;
|
||||||
|
uint32_t cw_dbg_opt_level = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a list of missing mandatory message elements to debug output
|
* Put a list of missing mandatory message elements to debug output
|
||||||
*/
|
*/
|
||||||
void cw_dbg_missing_mand(int level,struct conn *conn,cw_action_in_t ** ml,int n,cw_action_in_t *a)
|
void cw_dbg_missing_mand(int level, struct conn *conn, cw_action_in_t ** ml, int n,
|
||||||
|
cw_action_in_t * a)
|
||||||
{
|
{
|
||||||
if (!cw_dbg_is_level(DBG_ELEM) || n == 0)
|
if (!cw_dbg_is_level(DBG_ELEM) || n == 0)
|
||||||
return;
|
return;
|
||||||
@ -35,17 +50,104 @@ void cw_dbg_missing_mand(int level,struct conn *conn,cw_action_in_t ** ml,int n,
|
|||||||
int i;
|
int i;
|
||||||
char *delim = "";
|
char *delim = "";
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
p+=sprintf(p,"%s",delim); delim=", ";
|
p += sprintf(p, "%s", delim);
|
||||||
|
delim = ", ";
|
||||||
p += sprintf(p, "%s", cw_strelemp(conn->actions, ml[i]->elem_id));
|
p += sprintf(p, "%s", cw_strelemp(conn->actions, ml[i]->elem_id));
|
||||||
}
|
}
|
||||||
cw_dbg(DBG_ELEM, "Missing mandatory elements: [%s]", buffer);
|
cw_dbg(DBG_ELEM, "Missing mandatory elements: [%s]", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cw_format_pkt(char *dst,int level,struct conn *conn, uint8_t * packet, int len)
|
||||||
|
|
||||||
void cw_dbg_packet(struct conn *conn, uint8_t * packet, int len)
|
|
||||||
{
|
{
|
||||||
if (!cw_dbg_is_level(DBG_CW_PKT_IN || DBG_CW_PKT_OUT))
|
char *s=dst;
|
||||||
|
switch (level) {
|
||||||
|
case DBG_PKT_IN:
|
||||||
|
s+=sprintf(s,"From %s",sock_addr2str(&conn->addr));
|
||||||
|
break;
|
||||||
|
case DBG_PKT_OUT:
|
||||||
|
s+=sprintf(s,"To %s",sock_addr2str(&conn->addr));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
s+=sprintf(s," l=%d: ",len);
|
||||||
|
|
||||||
|
int preamble = cw_get_hdr_preamble(packet);
|
||||||
|
if (preamble==01){
|
||||||
|
s+=sprintf(s," (encrypted)");
|
||||||
|
return s-dst;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len<4)
|
||||||
|
goto abort;
|
||||||
|
|
||||||
|
|
||||||
|
if (cw_get_hdr_flag_f(packet)){
|
||||||
|
s+=sprintf(s," (fragmented)");
|
||||||
|
}
|
||||||
|
|
||||||
|
int hlen = cw_get_hdr_hlen(packet);
|
||||||
|
int rid = cw_get_hdr_rid(packet);
|
||||||
|
int wbid = cw_get_hdr_wbid(packet);
|
||||||
|
s+=sprintf(s," H:%d R:%02d W:%02d",hlen,rid,wbid);
|
||||||
|
|
||||||
|
|
||||||
|
s+=sprintf(s," Flgs:");
|
||||||
|
s+=cw_format_hdr_flags(s,packet);
|
||||||
|
|
||||||
|
if (len<8)
|
||||||
|
goto abort;
|
||||||
|
int frag_id = cw_get_hdr_fragid(packet);
|
||||||
|
int frag_offs = cw_get_hdr_fragoffset(packet);
|
||||||
|
s+=sprintf(s," Frag/Offs: %d/%d",frag_id,frag_offs);
|
||||||
|
|
||||||
|
return s-dst;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
abort:
|
||||||
|
s+=sprintf(s," Incomplete...");
|
||||||
|
return s-dst;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void cw_dbg_pkt(int level,struct conn *conn, uint8_t * packet, int len)
|
||||||
|
{
|
||||||
|
if (!cw_dbg_is_level(level))
|
||||||
|
return;
|
||||||
|
|
||||||
|
char buf[1024];
|
||||||
|
cw_format_pkt(buf,level,conn,packet,len);
|
||||||
|
cw_dbg(level,"%s",buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void cw_dbg_msg(int level,struct conn *conn, uint8_t * packet, int len)
|
||||||
|
{
|
||||||
|
if (!cw_dbg_is_level(level))
|
||||||
|
return;
|
||||||
|
|
||||||
|
char buf[1024];
|
||||||
|
char *s = buf;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t * msgptr = cw_get_hdr_msg_ptr(packet);
|
||||||
|
int pplen = len - (msgptr-packet);
|
||||||
|
|
||||||
|
int msg_id=cw_get_msg_id(msgptr);
|
||||||
|
s+=sprintf(s,"%s Message type %d",cw_strmsg(msg_id),msg_id);
|
||||||
|
s+=sprintf(s,"from %s ",sock_addr2str(&conn->addr));
|
||||||
|
s+=sprintf(s,", Seqnum: %d ElemLen: %d",cw_get_msg_seqnum(msgptr),cw_get_msg_elems_len(msgptr));
|
||||||
|
|
||||||
|
abort:
|
||||||
|
cw_dbg(level,"%s",buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cw_dbg_packet_m(struct conn *conn, uint8_t * packet, int len)
|
||||||
|
{
|
||||||
|
if (!cw_dbg_is_level(DBG_PKT_IN | DBG_PKT_OUT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
@ -54,24 +156,24 @@ void cw_dbg_packet(struct conn *conn, uint8_t * packet, int len)
|
|||||||
hdr_print(hdr, packet, len);
|
hdr_print(hdr, packet, len);
|
||||||
|
|
||||||
|
|
||||||
if (!cw_dbg_is_level(DBG_CW_PKT_DMP)) {
|
if (!cw_dbg_is_level(DBG_PKT_DMP)) {
|
||||||
cw_dbg(DBG_CW_PKT_IN, "Processing capwap packet from %s, len=%d\n%s",
|
cw_dbg(DBG_PKT_IN, "Processing capwap packet from %s, len=%d\n%s",
|
||||||
sock_addr2str(&conn->addr), len, hdr);
|
sock_addr2str(&conn->addr), len, hdr);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cw_dbg_dmp(DBG_CW_PKT_DMP, packet, len,
|
cw_dbg_dmp(DBG_PKT_DMP, packet, len,
|
||||||
"Processing packet from %s, len=%d\n%s\n\tDump:",
|
"Processing packet from %s, len=%d\n%s\n\tDump:",
|
||||||
sock_addr2str(&conn->addr), len, hdr);
|
sock_addr2str(&conn->addr), len, hdr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cw_log_dbg_dmp_(int level, const char *file, int line,
|
void cw_dbg_dmp_(int level, const char *file, int line,
|
||||||
const uint8_t * data, int len, const char *format, ...)
|
const uint8_t * data, int len, const char *format, ...)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
if (!(level & cw_dbg_opt_level))
|
if (!(level & cw_dbg_opt_level))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -83,14 +185,14 @@ void cw_log_dbg_dmp_(int level, const char *file, int line,
|
|||||||
int tlen = 0;
|
int tlen = 0;
|
||||||
|
|
||||||
int md;
|
int md;
|
||||||
if (cw_dbg_opt_detail & DBG_DETAIL_ASC_DMP)
|
if (cw_dbg_opt_display & DBG_DISP_ASC_DMP)
|
||||||
md = 2;
|
md = 2;
|
||||||
else
|
else
|
||||||
md = 1;
|
md = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char *dst = malloc(md * (len * 3 + (rows * 2) + 8 + maxtlen));
|
char *dst = malloc(2*(md * (len * 3 + (rows * 2) + 8 + maxtlen)));
|
||||||
if (!dst)
|
if (!dst)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -118,7 +220,7 @@ void cw_log_dbg_dmp_(int level, const char *file, int line,
|
|||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
sprintf(pdst, "%02X ", data[i] & 0xff);
|
sprintf(pdst, "%02X ", data[i] & 0xff);
|
||||||
|
|
||||||
if (cw_dbg_opt_detail & DBG_DETAIL_ASC_DMP) {
|
if (cw_dbg_opt_display & DBG_DISP_ASC_DMP) {
|
||||||
int c = data[i] & 0xff;
|
int c = data[i] & 0xff;
|
||||||
if (c < 0x20 || c > 0x80)
|
if (c < 0x20 || c > 0x80)
|
||||||
c = '.';
|
c = '.';
|
||||||
@ -129,7 +231,7 @@ void cw_log_dbg_dmp_(int level, const char *file, int line,
|
|||||||
pdst += 3;
|
pdst += 3;
|
||||||
if ((i + 1) % rowlen == 0) {
|
if ((i + 1) % rowlen == 0) {
|
||||||
int l;
|
int l;
|
||||||
if (cw_dbg_opt_detail & DBG_DETAIL_ASC_DMP) {
|
if (cw_dbg_opt_display & DBG_DISP_ASC_DMP) {
|
||||||
*ascdst = 0;
|
*ascdst = 0;
|
||||||
l = sprintf(pdst, " | %s\n\t", asc_buffer);
|
l = sprintf(pdst, " | %s\n\t", asc_buffer);
|
||||||
ascdst = asc_buffer;
|
ascdst = asc_buffer;
|
||||||
@ -142,17 +244,18 @@ void cw_log_dbg_dmp_(int level, const char *file, int line,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cw_dbg_opt_detail & DBG_DETAIL_ASC_DMP) {
|
if (cw_dbg_opt_display & DBG_DISP_ASC_DMP) {
|
||||||
*ascdst = 0;
|
*ascdst = 0;
|
||||||
if (strlen(asc_buffer))
|
if (strlen(asc_buffer))
|
||||||
pdst += sprintf(pdst, " | %s", asc_buffer);
|
pdst += sprintf(pdst, " | %s", asc_buffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cw_dbg_opt_detail & DBG_DETAIL_LINE_NUMBERS)
|
if (cw_dbg_opt_display & DBG_DISP_LINE_NUMBERS)
|
||||||
cw_log(LOG_DEBUG, "%s:%d: %s", file, line, dst);
|
cw_log_cb(LOG_DEBUG, "%s:%d: %s", file, line, dst);
|
||||||
else
|
else{
|
||||||
cw_log(LOG_DEBUG, dst);
|
cw_log_cb(LOG_DEBUG, "%s",dst);
|
||||||
|
}
|
||||||
|
|
||||||
free(dst);
|
free(dst);
|
||||||
return;
|
return;
|
||||||
@ -160,3 +263,166 @@ void cw_log_dbg_dmp_(int level, const char *file, int line,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* print debug info for message elements
|
||||||
|
*/
|
||||||
|
|
||||||
|
void cw_dbg_elem_colored(int level, struct conn *conn, int msg, int msgelem,
|
||||||
|
const uint8_t * msgbuf, int len)
|
||||||
|
{
|
||||||
|
if (!cw_dbg_is_level(level))
|
||||||
|
return;
|
||||||
|
|
||||||
|
const char *elemname;
|
||||||
|
char vendorname[256];
|
||||||
|
char vendor_details[265];
|
||||||
|
*vendor_details = 0;
|
||||||
|
|
||||||
|
if (msgelem == CW_ELEM_VENDOR_SPECIFIC_PAYLOAD) {
|
||||||
|
uint32_t vendor_id = ntohl(*((uint32_t *) msgbuf));
|
||||||
|
int type = ntohs(*((uint16_t *) (msgbuf + 4)));
|
||||||
|
cw_format_vendor(vendor_details, vendor_id, type, msgbuf);
|
||||||
|
sprintf(vendorname, "%s/%s/%s",
|
||||||
|
cw_strelemp(conn->actions, msgelem),
|
||||||
|
(char *) lw_vendor_id_to_str(vendor_id), vendor_details);
|
||||||
|
elemname = vendorname;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
elemname = cw_strelemp(conn->actions, msgelem);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!cw_dbg_is_level(DBG_ELEM_DMP))
|
||||||
|
cw_dbg(DBG_ELEM,
|
||||||
|
"%s, CAWPAP element: %d (%s), len=%d%s",
|
||||||
|
cw_strmsg(msg), msgelem, elemname, len, "");
|
||||||
|
|
||||||
|
else
|
||||||
|
cw_dbg_dmp(DBG_ELEM, msgbuf, len,
|
||||||
|
"%s, CAPWAP element: %d (%s), len=%d%s\n\tDump ...",
|
||||||
|
cw_strmsg(msg), msgelem, elemname, len, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static struct cw_str color_on[] = {
|
||||||
|
{ DBG_PKT_IN, "\x1b[33m" },
|
||||||
|
{ CW_STR_STOP, "" }
|
||||||
|
};
|
||||||
|
static struct cw_str color_ontext[] = {
|
||||||
|
|
||||||
|
{ CW_STR_STOP, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static struct cw_str color_off[] = {
|
||||||
|
|
||||||
|
{ CW_STR_STOP, "\033[22;39m" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct cw_str prefix[] = {
|
||||||
|
{ DBG_INFO, " Info -" },
|
||||||
|
{ DBG_PKT_IN, " Pkt IN -" },
|
||||||
|
{ CW_STR_STOP, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static const char * get_dbg_color_on(int level){
|
||||||
|
if ( ! (cw_dbg_opt_display & DBG_DISP_COLORS ) )
|
||||||
|
return "";
|
||||||
|
return cw_strlist_get_str(color_on,level);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char * get_dbg_color_off(int level){
|
||||||
|
if ( ! (cw_dbg_opt_display & DBG_DISP_COLORS ) )
|
||||||
|
return "";
|
||||||
|
return cw_strlist_get_str(color_off,level);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char * get_dbg_prefix(int level){
|
||||||
|
return cw_strlist_get_str(prefix,level);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char * get_dbg_color_ontext(int level){
|
||||||
|
if ( ! (cw_dbg_opt_display & DBG_DISP_COLORS ) )
|
||||||
|
return "";
|
||||||
|
return cw_strlist_get_str(color_ontext,level);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
void cw_log_colored(int level, const char *format, ...)
|
||||||
|
{
|
||||||
|
char fbuf[1024];
|
||||||
|
|
||||||
|
sprintf(fbuf, "%s%s%s: %s%s",
|
||||||
|
get_log_color_on(level),
|
||||||
|
get_log_prefix(level),
|
||||||
|
get_log_color_ontext(level),
|
||||||
|
format,
|
||||||
|
get_log_color_off(level)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
cw_log_vcb(level,fbuf,args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cw_dbg_colored(int level, const char *file, int line, const char *format, ...)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!(level & cw_dbg_opt_level))
|
||||||
|
return;
|
||||||
|
|
||||||
|
char fbuf[1024];
|
||||||
|
|
||||||
|
sprintf(fbuf, "DBG:%s%s %s%s%s",
|
||||||
|
get_dbg_color_on(level),
|
||||||
|
get_dbg_prefix(level),
|
||||||
|
get_dbg_color_ontext(level),
|
||||||
|
format,
|
||||||
|
get_dbg_color_off(level)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
cw_log_vcb(level,fbuf,args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char buf[2048];
|
||||||
|
|
||||||
|
// va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
vsprintf(buf, format, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
if (cw_dbg_opt_display & DBG_DISP_LINE_NUMBERS)
|
||||||
|
cw_log(LOG_DEBUG, "%s:%d: %s", file, line, buf);
|
||||||
|
else
|
||||||
|
cw_log(LOG_DEBUG, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,18 +30,82 @@ void cw_dbg_packet(struct conn *conn, uint8_t * packet, int len);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup DebugOptions Dbug Options
|
* @defgroup DebugOptions Dbug Options
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define CW_DBG_PKT_IN 0x00000001 /* Headers of incoming CAPWAP packets */
|
|
||||||
#define CW_DBG_PKT_OUT 0x00000002 /* Headers of outgoing CAPWAP packets */
|
|
||||||
|
|
||||||
|
|
||||||
|
#define DBG_PKT_IN 0x00000001 /* Headers of incoming CAPWAP packets */
|
||||||
|
#define DBG_PKT_OUT 0x00000002 /* Headers of outgoing CAPWAP packets */
|
||||||
|
#define DBG_PKT_ERR 0x00000004 /* Error of packets */
|
||||||
|
#define DBG_PKT_DMP 0x00000008 /* Dump packts */
|
||||||
|
|
||||||
|
|
||||||
|
#define DBG_MSG_IN 0x00000010 /* Parsed CAPWAP/LWAPP messages */
|
||||||
|
#define DBG_MSG_OUT 0x00000020 /* Parsed CAPWAP/LWAPP messages */
|
||||||
|
|
||||||
|
#define DBG_ELEM 0x00000000 /* Show message elements */
|
||||||
|
#define DBG_ELEM_DMP 0x00000000 /* Dump message elements */
|
||||||
|
|
||||||
|
#define DBG_INFO 0x00000000
|
||||||
|
#define DBG_RFC 0x00000080 /* RCF-realted CAPWAP errors */
|
||||||
|
|
||||||
|
|
||||||
|
#define DBG_MSG_ERR 0x00000000 /* Errors in CAPWAP messages */
|
||||||
|
#define DBG_ELEM_ERR 0x00000000
|
||||||
|
|
||||||
|
/* driver specific debugs */
|
||||||
|
#define DBG_DRV 0x00010000
|
||||||
|
#define DBG_DRV_ERR 0x00020000
|
||||||
|
|
||||||
|
/* DTLS debugs */
|
||||||
|
#define DBG_DTLS 0x10000000
|
||||||
|
#define DBG_DTLS_DETAIL 0x20000000
|
||||||
|
#define DBG_DTLS_BIO 0x40000000
|
||||||
|
#define DBG_DTLS_BIO_DMP 0x80000000
|
||||||
|
|
||||||
|
#define DBG_ALL 0xffffffff
|
||||||
|
#define DBG_PKT_INOUT (DBG_CW_PKT_IN | DBG_CW_PKT_OUT)
|
||||||
|
|
||||||
|
|
||||||
|
#define DBG_DISP_LINE_NUMBERS 0x00000001
|
||||||
|
#define DBG_DISP_ASC_DMP 0x00000002
|
||||||
|
#define DBG_DISP_COLORS 0x00000004
|
||||||
|
|
||||||
|
|
||||||
|
#define DBG_DETAIL_ALL 0xffffffff
|
||||||
|
#define DBG_ERR (DBG_MSG_ERR | DBG_CW_PKT_ERR)
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern uint32_t cw_dbg_opt_display;
|
||||||
|
extern uint32_t cw_dbg_opt_level;
|
||||||
|
extern struct cw_str cw_dbg_strings[];
|
||||||
|
|
||||||
|
|
||||||
|
/**@}*/
|
||||||
|
|
||||||
|
|
||||||
|
#define cw_dbg(type,...) cw_dbg_colored(type,__FILE__,__LINE__,__VA_ARGS__)
|
||||||
|
#define cw_dbg_dmp(type,...) cw_dbg_dmp_(type,__FILE__,__LINE__,__VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
|
void cw_dbg_colored(int level, const char *file, int line, const char *format, ...);
|
||||||
|
void cw_dbg_dmp_(int level, const char *file, int line,
|
||||||
|
const uint8_t * data, int len, const char *format, ...);
|
||||||
|
|
||||||
|
|
||||||
|
extern void cw_dbg_elem_colored(int level, struct conn *conn, int msg, int msgelem,
|
||||||
|
const uint8_t * msgbuf, int len);
|
||||||
|
|
||||||
|
void cw_dbg_pkt(int level,struct conn *conn, uint8_t * packet, int len);
|
||||||
|
void cw_dbg_msg(int level,struct conn *conn, uint8_t * packet, int len);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,9 +19,21 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "log.h"
|
#include "dbg.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct cw_str cw_dbg_strings[] = {
|
||||||
|
{ DBG_INFO, "info" },
|
||||||
|
{ DBG_PKT_IN, "pkt_in" },
|
||||||
|
{ DBG_PKT_OUT, "pkt_out" },
|
||||||
|
{ CW_STR_STOP, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
struct cw_dbg_cfgstrs cw_dbg_cfgstrs[] = {
|
struct cw_dbg_cfgstrs cw_dbg_cfgstrs[] = {
|
||||||
|
|
||||||
{"info",DBG_CW_INFO},
|
{"info",DBG_CW_INFO},
|
||||||
@ -50,7 +62,9 @@ struct cw_dbg_cfgstrs cw_dbg_cfgstrs[] = {
|
|||||||
{0,0}
|
{0,0}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
int cw_log_str2dbglevel(const char * str)
|
int cw_log_str2dbglevel(const char * str)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -60,4 +74,4 @@ int cw_log_str2dbglevel(const char * str)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
@ -25,6 +25,7 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "dbg.h"
|
||||||
#include "dtls.h"
|
#include "dtls.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,11 +25,13 @@
|
|||||||
|
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "dbg.h"
|
||||||
#include "cw_util.h"
|
#include "cw_util.h"
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
int dtls_gnutls_init()
|
int dtls_gnutls_init()
|
||||||
{
|
{
|
||||||
cw_dbg(DBG_CW_INFO,"Init SSL library - using GnuTLS %s",gnutls_check_version(NULL));
|
cw_dbg(DBG_INFO,"Init SSL library - using GnuTLS %s",gnutls_check_version(NULL));
|
||||||
gnutls_global_init();
|
gnutls_global_init();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,12 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
|
#include "dbg.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
#include "dtls_gnutls.h"
|
#include "dtls_gnutls.h"
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
|
|
||||||
int dtls_gnutls_accept(struct conn *conn)
|
int dtls_gnutls_accept(struct conn *conn)
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "dtls.h"
|
#include "dtls.h"
|
||||||
#include "dtls_gnutls.h"
|
#include "dtls_gnutls.h"
|
||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "dbg.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,9 +23,13 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "dtls_openssl.h"
|
#include "dtls_openssl.h"
|
||||||
|
#include "capwap.h"
|
||||||
|
|
||||||
|
#include "dbg.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#include "cw_util.h"
|
#include "cw_util.h"
|
||||||
|
#include "rand.h"
|
||||||
|
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
@ -120,7 +124,7 @@ int pem_passwd_cb(char *buf, int size, int rwflag, void *password)
|
|||||||
int dtls_openssl_init()
|
int dtls_openssl_init()
|
||||||
{
|
{
|
||||||
const char * version = SSLeay_version(SSLEAY_VERSION);
|
const char * version = SSLeay_version(SSLEAY_VERSION);
|
||||||
cw_dbg(DBG_CW_INFO,"Init SSL library - %s",version);
|
cw_dbg(DBG_INFO,"Init SSL library - %s",version);
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
int rc = SSL_library_init();
|
int rc = SSL_library_init();
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "dbg.h"
|
||||||
|
|
||||||
|
|
||||||
BIO_METHOD *dtls_openssl_bio_method()
|
BIO_METHOD *dtls_openssl_bio_method()
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
#include "dtls_openssl.h"
|
#include "dtls_openssl.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "dbg.h"
|
||||||
#include "cw_util.h"
|
#include "cw_util.h"
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
static BIO_METHOD bio_methods = {
|
static BIO_METHOD bio_methods = {
|
||||||
|
@ -54,3 +54,8 @@ int cw_format_hex_bytes(char *dst, const char *format, const char *delim,
|
|||||||
}
|
}
|
||||||
return d - dst;
|
return d - dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,4 +55,30 @@ extern int cw_format_hex_bytes(char *dst, const char *format, const char *delim,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*#define cw_format_hdr_flags(s,th) \
|
||||||
|
sprintf(s,"(T=%d,F=%d,L=%d,W=%d,M=%d,K=%d)",\
|
||||||
|
cw_get_hdr_flag_t(packet),\
|
||||||
|
cw_get_hdr_flag_f(packet),\
|
||||||
|
cw_get_hdr_flag_l(packet),\
|
||||||
|
cw_get_hdr_flag_w(packet),\
|
||||||
|
cw_get_hdr_flag_m(packet),\
|
||||||
|
cw_get_hdr_flag_k(packet)\
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline int cw_format_hdr_flags(char *dst,uint8_t *th)
|
||||||
|
{
|
||||||
|
char * s = dst;
|
||||||
|
s+=sprintf(s,"%s", "(");
|
||||||
|
s+=sprintf(s,"%s", cw_get_hdr_flag_t(th) ? "T":"");
|
||||||
|
s+=sprintf(s,"%s", cw_get_hdr_flag_f(th) ? "F":"");
|
||||||
|
s+=sprintf(s,"%s", cw_get_hdr_flag_l(th) ? "L":"");
|
||||||
|
s+=sprintf(s,"%s", cw_get_hdr_flag_w(th) ? "W":"");
|
||||||
|
s+=sprintf(s,"%s", cw_get_hdr_flag_m(th) ? "M":"");
|
||||||
|
s+=sprintf(s,"%s", cw_get_hdr_flag_k(th) ? "K":"");
|
||||||
|
s+=sprintf(s,"%s", ")");
|
||||||
|
return s-dst;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -58,10 +58,8 @@ int hdr_print(char *str, uint8_t *packet, int len)
|
|||||||
|
|
||||||
|
|
||||||
int hlen = cw_get_hdr_hlen(packet); //CWTH_GET_HLEN(packet);
|
int hlen = cw_get_hdr_hlen(packet); //CWTH_GET_HLEN(packet);
|
||||||
|
|
||||||
int rid = cw_get_hdr_rid(packet);
|
int rid = cw_get_hdr_rid(packet);
|
||||||
int wbid = cw_get_hdr_wbid(packet);
|
int wbid = cw_get_hdr_wbid(packet);
|
||||||
|
|
||||||
s+=sprintf(s,"\tHLEN: %d, RID: %02X, WBID %02X",hlen,rid,wbid);
|
s+=sprintf(s,"\tHLEN: %d, RID: %02X, WBID %02X",hlen,rid,wbid);
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ static inline struct cw_item *cw_itemstore_get(cw_itemstore_t s, uint32_t id)
|
|||||||
|
|
||||||
|
|
||||||
extern cw_itemstore_t cw_itemstore_create();
|
extern cw_itemstore_t cw_itemstore_create();
|
||||||
|
extern int cw_itemstore_set_const_ptr(cw_itemstore_t s, uint32_t id, void *ptr);
|
||||||
extern int cw_itemstore_set_strn(cw_itemstore_t s, uint32_t id, const char *str, int n);
|
extern int cw_itemstore_set_strn(cw_itemstore_t s, uint32_t id, const char *str, int n);
|
||||||
extern int cw_itemstore_set_str(cw_itemstore_t s, uint32_t id, const char *str);
|
extern int cw_itemstore_set_str(cw_itemstore_t s, uint32_t id, const char *str);
|
||||||
extern int cw_itemstore_set_ptr(cw_itemstore_t s, uint32_t id, void *ptr);
|
extern int cw_itemstore_set_ptr(cw_itemstore_t s, uint32_t id, void *ptr);
|
||||||
|
@ -45,61 +45,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @defgroup DebugOptions Dbug Options
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define DBG_MSG 0x00000001 /* Parsed CAPWAP/LWAPP messages */
|
|
||||||
|
|
||||||
#define DBG_ELEM 0x00000002 /* Parsed CAPWAP/LWAPP message elements */
|
|
||||||
#define DBG_ELEM_DMP 0x00000004 /* Dump CAPWAP message elements */
|
|
||||||
|
|
||||||
#define DBG_CW_INFO 0x00000008
|
|
||||||
#define DBG_CW_RFC 0x00000010 /* RCF-realted CAPWAP errors */
|
|
||||||
#define DBG_CW_STRICT 0x00000010
|
|
||||||
#define DBG_CW_PKT_IN 0x00000020 /* Headers of incoming CAPWAP packets */
|
|
||||||
#define DBG_CW_PKT_OUT 0x00000040 /* Headers of outgoing CAPWAP packets */
|
|
||||||
#define DBG_CW_PKT_DMP 0x00000080 /* Dump packts */
|
|
||||||
#define DBG_CW_PKT_DTL 0x00000100
|
|
||||||
#define DBG_CW_PKT_ERR 0x00000200
|
|
||||||
#define DBG_MSG_ERR 0x00000400 /* Errors in CAPWAP messages */
|
|
||||||
#define DBG_CW_IMG_DTL 0x00000800 /* Detail about image transfer */
|
|
||||||
#define DBG_ELEM_ERR 0x00001000
|
|
||||||
|
|
||||||
/* driver specific debugs */
|
|
||||||
#define DBG_DRV 0x00010000
|
|
||||||
#define DBG_DRV_ERR 0x00020000
|
|
||||||
|
|
||||||
/* DTLS debugs */
|
|
||||||
#define DBG_DTLS 0x10000000
|
|
||||||
#define DBG_DTLS_DETAIL 0x20000000
|
|
||||||
#define DBG_DTLS_BIO 0x40000000
|
|
||||||
#define DBG_DTLS_BIO_DMP 0x80000000
|
|
||||||
|
|
||||||
#define DBG_ALL 0xffffffff
|
|
||||||
#define DBG_CW_PKT_INOUT (DBG_CW_PKT_IN | DBG_CW_PKT_OUT)
|
|
||||||
|
|
||||||
|
|
||||||
#define DBG_DETAIL_LINE_NUMBERS 0x00000001
|
|
||||||
#define DBG_DETAIL_ASC_DMP 0x00000002
|
|
||||||
|
|
||||||
|
|
||||||
#define DBG_DETAIL_ALL 0xffffffff
|
|
||||||
#define DBG_ERR (DBG_MSG_ERR | DBG_CW_PKT_ERR)
|
|
||||||
|
|
||||||
/**@}*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//extern void cw_log_dbg_(int type, const char *file, int line, const char *fromat, ...);
|
||||||
|
//extern void cw_log_dbg_dmp_(int type, const char *file, int line, const uint8_t * data,
|
||||||
extern void cw_log_dbg_(int type, const char *file, int line, const char *fromat, ...);
|
//int len, const char *format, ...);
|
||||||
extern void cw_log_dbg_dmp_(int type, const char *file, int line, const uint8_t * data,
|
|
||||||
int len, const char *format, ...);
|
|
||||||
extern int cw_dbg_opt_detail;
|
|
||||||
extern int cw_dbg_opt_level;
|
|
||||||
|
|
||||||
|
|
||||||
#define cw_dbg_is_level(level) (cw_dbg_opt_level & level)
|
#define cw_dbg_is_level(level) (cw_dbg_opt_level & level)
|
||||||
|
|
||||||
@ -111,28 +62,31 @@ extern int cw_dbg_opt_level;
|
|||||||
#define cw_log(...)
|
#define cw_log(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_CW_LOG_DEBUG
|
//#ifdef WITH_CW_LOG_DEBUG
|
||||||
|
|
||||||
|
|
||||||
#define cw_log_dbg(type,...) cw_log_dbg_(type,__FILE__,__LINE__,__VA_ARGS__)
|
//#define cw_log_dbg(type,...) cw_log_dbg_(type,__FILE__,__LINE__,__VA_ARGS__)
|
||||||
#define cw_dbg(type,...) cw_log_dbg_(type,__FILE__,__LINE__,__VA_ARGS__)
|
|
||||||
#define cw_log_dbg_dmp(type,str,len,...) cw_log_dbg_dmp_(type,__FILE__,__LINE__,str,len,__VA_ARGS__)
|
|
||||||
#define cw_dbg_dmp(type,str,len,...) cw_log_dbg_dmp_(type,__FILE__,__LINE__,str,len,__VA_ARGS__)
|
|
||||||
#define cw_dbg_msgelem(msgtype,msgelemtype,msgbuf,msglen) cw_dbg_msgelem_(msgtype,msgelemtype,msgbuf,msglen)
|
|
||||||
#define cw_dbg_missing_mand_elems(conn, msgtyoe, mand) cw_dbg_missing_mand_elems_(conn, msgtyoe, mand)
|
|
||||||
|
|
||||||
#define lw_dbg_elem(msgtype,msgelemtype,msgbuf,msglen) lw_dbg_elem_(msgtype,msgelemtype,msgbuf,msglen)
|
|
||||||
|
|
||||||
#else
|
|
||||||
#define cw_log_dbg(...)
|
|
||||||
#define cw_dbg(...)
|
|
||||||
|
|
||||||
#define cw_dbg_missing_mand_elems(conn, msgtyoe, mand)
|
//#define cw_log_dbg_dmp(type,str,len,...) cw_log_dbg_dmp_(type,__FILE__,__LINE__,str,len,__VA_ARGS__)
|
||||||
|
//#define cw_dbg_dmp(type,str,len,...) cw_log_dbg_dmp_(type,__FILE__,__LINE__,str,len,__VA_ARGS__)
|
||||||
|
|
||||||
#endif
|
//#define cw_dbg_msgelem(msgtype,msgelemtype,msgbuf,msglen) cw_dbg_msgelem_(msgtype,msgelemtype,msgbuf,msglen)
|
||||||
|
//#define cw_dbg_missing_mand_elems(conn, msgtyoe, mand) cw_dbg_missing_mand_elems_(conn, msgtyoe, mand)
|
||||||
|
|
||||||
|
//#define lw_dbg_elem(msgtype,msgelemtype,msgbuf,msglen) lw_dbg_elem_(msgtype,msgelemtype,msgbuf,msglen)
|
||||||
|
|
||||||
|
//#else
|
||||||
|
//#define cw_log_dbg(...)
|
||||||
|
//#define cw_dbg(...)
|
||||||
|
|
||||||
|
//#define cw_dbg_missing_mand_elems(conn, msgtyoe, mand)
|
||||||
|
|
||||||
|
//#endif
|
||||||
|
|
||||||
extern void (*cw_log_cb) (int level, const char *fromat, ...);
|
extern void (*cw_log_cb) (int level, const char *fromat, ...);
|
||||||
extern void (*cw_vlog_cb) (int level, const char *fromat, va_list args);
|
extern void (*cw_log_vcb) (int level, const char *fromat, va_list args);
|
||||||
|
|
||||||
/* Syslog functins */
|
/* Syslog functins */
|
||||||
extern void cw_log_syslog(int level, const char *format, ...);
|
extern void cw_log_syslog(int level, const char *format, ...);
|
||||||
|
@ -10,21 +10,8 @@ char * cw_log_filename = NULL;
|
|||||||
|
|
||||||
void cw_log_vfile(int level,const char * format, va_list args)
|
void cw_log_vfile(int level,const char * format, va_list args)
|
||||||
{
|
{
|
||||||
/* switch(level){
|
|
||||||
case LOG_DEBUG:
|
|
||||||
printf("DBG:");
|
|
||||||
break;
|
|
||||||
case LOG_INFO:
|
|
||||||
printf("INFO:");
|
|
||||||
break;
|
|
||||||
case LOG_ERR:
|
|
||||||
printf("ERROR:");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
vprintf(format,args);
|
vprintf(format,args);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cw_log_file(int level,const char *format, ...)
|
void cw_log_file(int level,const char *format, ...)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
int cw_send_request(struct conn *conn,int msg_id)
|
int cw_send_request(struct conn *conn,int msg_id)
|
||||||
{
|
{
|
||||||
@ -18,6 +19,9 @@ int cw_send_request(struct conn *conn,int msg_id)
|
|||||||
int i;
|
int i;
|
||||||
int rc=-1;
|
int rc=-1;
|
||||||
for (i=0; i<conn->max_retransmit && rc<0; i++){
|
for (i=0; i<conn->max_retransmit && rc<0; i++){
|
||||||
|
if ( i>0 ){
|
||||||
|
cw_log(LOG_WARNING,"Retransmitting request ... %d",i);
|
||||||
|
}
|
||||||
time_t timer = cw_timer_start(conn->retransmit_interval);
|
time_t timer = cw_timer_start(conn->retransmit_interval);
|
||||||
while (!cw_timer_timeout(timer) && rc<0){
|
while (!cw_timer_timeout(timer) && rc<0){
|
||||||
|
|
||||||
@ -36,9 +40,13 @@ int cw_send_request(struct conn *conn,int msg_id)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( rc <0 ) {
|
if ( rc <0 && errno != EAGAIN) {
|
||||||
cw_log(LOG_ERR,"Error reading from %s:%s",sock_addr2str(&conn->addr),strerror(errno));
|
cw_log(LOG_ERR,"Error reading from %s:%s",sock_addr2str(&conn->addr),strerror(errno));
|
||||||
}
|
}
|
||||||
|
if ( rc <0 && errno == EAGAIN) {
|
||||||
|
errno=ETIMEDOUT;
|
||||||
|
rc=-1;
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -3,17 +3,12 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "strlist.h"
|
||||||
#include "avltree.h"
|
#include "avltree.h"
|
||||||
|
|
||||||
|
|
||||||
typedef struct avltree * cw_strheap_t;
|
typedef struct avltree * cw_strheap_t;
|
||||||
|
|
||||||
struct cw_str {
|
|
||||||
int id;
|
|
||||||
const char *str;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define CW_STR_STOP -1138
|
|
||||||
|
|
||||||
extern cw_strheap_t cw_strheap_create();
|
extern cw_strheap_t cw_strheap_create();
|
||||||
extern int cw_strheap_register_strings(cw_strheap_t h, struct cw_str *s);
|
extern int cw_strheap_register_strings(cw_strheap_t h, struct cw_str *s);
|
||||||
|
@ -20,7 +20,7 @@ ifndef ARCH
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
CFLAGS += -Os -Wall -g
|
CFLAGS += -O0 -Wall -g
|
||||||
#CFLAGS += -Os -Wall
|
#CFLAGS += -Os -Wall
|
||||||
LDFLAGS += -L../../src/capwap/$(ARCH)
|
LDFLAGS += -L../../src/capwap/$(ARCH)
|
||||||
|
|
||||||
@ -79,6 +79,8 @@ CFLAGS += -I../../src -I /usr/local/include
|
|||||||
|
|
||||||
|
|
||||||
OBJS += wtp_main.o
|
OBJS += wtp_main.o
|
||||||
|
OBJS += image_update.o
|
||||||
|
|
||||||
|
|
||||||
#OBJS += wtp_conf.o
|
#OBJS += wtp_conf.o
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "wtp_conf.h"
|
#include "wtp_conf.h"
|
||||||
|
|
||||||
#include "capwap/log.h"
|
#include "capwap/log.h"
|
||||||
|
#include "capwap/dbg.h"
|
||||||
|
|
||||||
#include "capwap/bstr.h"
|
#include "capwap/bstr.h"
|
||||||
|
|
||||||
@ -59,8 +60,9 @@ static void read_dbg_options(struct uci_context *ctx, struct uci_section *sectio
|
|||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i=0; cw_dbg_cfgstrs[i].name; i++) {
|
for (i=0; cw_dbg_strings[i].id!=CW_STR_STOP; i++) {
|
||||||
set_dbg_opt(ctx,section,cw_dbg_cfgstrs[i].level,cw_dbg_cfgstrs[i].name);
|
|
||||||
|
set_dbg_opt(ctx,section,cw_dbg_strings[i].id,cw_dbg_strings[i].str);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,13 +98,13 @@ int read_config(const char * filename){
|
|||||||
if (filename == NULL){
|
if (filename == NULL){
|
||||||
filename = "wtp_uci.conf";
|
filename = "wtp_uci.conf";
|
||||||
}
|
}
|
||||||
cw_dbg(DBG_ALL,"Reading config file %s",filename);
|
cw_dbg(DBG_INFO,"Reading config file %s",filename);
|
||||||
|
|
||||||
|
|
||||||
int rc = uci_load(ctx, filename, &pkg );
|
int rc = uci_load(ctx, filename, &pkg );
|
||||||
|
|
||||||
if (rc == UCI_ERR_NOTFOUND){
|
if (rc == UCI_ERR_NOTFOUND){
|
||||||
cw_dbg(DBG_CW_INFO,"Config file '%s' not found, running without config",filename);
|
cw_log(LOG_INFO,"Config file '%s' not found, running without config",filename);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +128,7 @@ int read_config(const char * filename){
|
|||||||
|
|
||||||
section = get_anon_section(pkg,"wtp");
|
section = get_anon_section(pkg,"wtp");
|
||||||
if (!section) {
|
if (!section) {
|
||||||
cw_dbg(DBG_CW_INFO,"No 'wtp' section found, running without config");
|
cw_dbg(DBG_INFO,"No 'wtp' section found, running without config");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "capwap/dtls.h"
|
#include "capwap/dtls.h"
|
||||||
#include "capwap/log.h"
|
#include "capwap/log.h"
|
||||||
|
#include "capwap/dbg.h"
|
||||||
#include "capwap/sock.h"
|
#include "capwap/sock.h"
|
||||||
#include "capwap/dtls.h"
|
#include "capwap/dtls.h"
|
||||||
#include "capwap/aciplist.h"
|
#include "capwap/aciplist.h"
|
||||||
@ -214,92 +215,3 @@ int join()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
int join(struct sockaddr *sa)
|
|
||||||
{
|
|
||||||
int sockfd;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
// sockfd = socket(AF_INET,SOCK_DGRAM,0);
|
|
||||||
|
|
||||||
sockfd = get_sock();
|
|
||||||
if (sockfd==-1){
|
|
||||||
cw_log(LOG_ERR,"Can't create socket: %s\n",strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
sock_set_recvtimeout(sockfd,1);
|
|
||||||
|
|
||||||
rc = connect(sockfd,(struct sockaddr*)sa,sock_addrlen((struct sockaddr*)sa));
|
|
||||||
if (rc<0){
|
|
||||||
char str[100];
|
|
||||||
sock_addrtostr(sa,str,100);
|
|
||||||
cw_log(LOG_ERR,"Can't connect to %s: %s\n",str,strerror(errno));
|
|
||||||
close(sockfd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct conn * conn = get_conn();
|
|
||||||
|
|
||||||
conn->capwap_mode = CWMODE_CISCO;
|
|
||||||
conn->seqnum=-1;
|
|
||||||
|
|
||||||
|
|
||||||
conn->sock=sockfd;
|
|
||||||
sock_copyaddr(&conn->addr,sa);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WITH_DTLS
|
|
||||||
cw_dbg (DBG_DTLS,"Establishing DTLS session with %s",sock_addr2str(sa));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (conf_dtls_psk){
|
|
||||||
conn->dtls_psk=conf_dtls_psk;
|
|
||||||
conn->dtls_psk_len=strlen(conn->dtls_psk);
|
|
||||||
conn->dtls_cipher=conf_dtls_cipher;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conf_sslkeyfilename && conf_sslcertfilename){
|
|
||||||
|
|
||||||
conn->dtls_key_file = conf_sslkeyfilename;
|
|
||||||
conn->dtls_cert_file = conf_sslcertfilename;
|
|
||||||
conn->dtls_key_pass = conf_sslkeypass;
|
|
||||||
conn->dtls_cipher=conf_dtls_cipher;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rc = dtls_connect(conn);
|
|
||||||
if (rc!=1){
|
|
||||||
dtls_shutdown(conn);
|
|
||||||
char str[100];
|
|
||||||
sock_addrtostr(sa,str,100);
|
|
||||||
cw_log(LOG_ERR,"Can't establish DTLS connection to %s",str);
|
|
||||||
close(sockfd);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
cw_dbg (DBG_DTLS,"DTLS session established with %s, cipher=%s",sock_addr2str(sa),dtls_get_cipher(conn));
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WITH_CW_LOG_DEBUG
|
|
||||||
{
|
|
||||||
char str[100];
|
|
||||||
sock_addrtostr(sa,str,100);
|
|
||||||
// cw_log_debug0("DTLS connection to %s established",str);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
join_state(conn);
|
|
||||||
|
|
||||||
printf("Joined with conn %p\n",conn);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <netlink/msg.h>
|
#include <netlink/msg.h>
|
||||||
|
|
||||||
#include "capwap/log.h"
|
#include "capwap/log.h"
|
||||||
|
#include "capwap/dbg.h"
|
||||||
#include "capwap/avltree.h"
|
#include "capwap/avltree.h"
|
||||||
|
|
||||||
#include "nlt.h"
|
#include "nlt.h"
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "capwap/log.h"
|
#include "capwap/dbg.h"
|
||||||
|
|
||||||
#include "wtp.h"
|
#include "wtp.h"
|
||||||
#include "wtp_conf.h"
|
#include "wtp_conf.h"
|
||||||
|
|
||||||
int sulking_state()
|
int sulking_state()
|
||||||
{
|
{
|
||||||
cw_dbg(DBG_CW_INFO,"Entering Sulking state");
|
cw_dbg(DBG_INFO,"Sulking state, sleeping for %i seconds",conf_silent_interval);
|
||||||
cw_dbg(DBG_CW_INFO,"Sleeping for %i seconds",conf_silent_interval);
|
|
||||||
sleep(conf_silent_interval);
|
sleep(conf_silent_interval);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
extern int sulking_state();
|
extern int sulking_state();
|
||||||
extern int join();
|
extern int join();
|
||||||
extern int discovery();
|
extern int discovery();
|
||||||
|
extern int image_update();
|
||||||
|
|
||||||
|
|
||||||
struct conn * get_conn();
|
struct conn * get_conn();
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#include "capwap/capwap.h"
|
#include "capwap/capwap.h"
|
||||||
#include "capwap/log.h"
|
#include "capwap/log.h"
|
||||||
|
#include "capwap/dbg.h"
|
||||||
|
|
||||||
#include "capwap/cw_util.h"
|
#include "capwap/cw_util.h"
|
||||||
|
|
||||||
#include "wtp_conf.h"
|
#include "wtp_conf.h"
|
||||||
@ -111,7 +113,7 @@ int wtpconf_primary_if()
|
|||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
cw_dbg(DBG_CW_INFO, "Primary interface: %s, mac address: %s.",
|
cw_dbg(DBG_INFO, "Primary interface: %s, mac address: %s.",
|
||||||
conf_primary_if,
|
conf_primary_if,
|
||||||
sock_hwaddr2str(conf_macaddress,conf_macaddress_len)
|
sock_hwaddr2str(conf_macaddress,conf_macaddress_len)
|
||||||
);
|
);
|
||||||
@ -133,7 +135,7 @@ int wtpconf_name()
|
|||||||
if (!conf_wtpname)
|
if (!conf_wtpname)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cw_dbg(DBG_CW_INFO,"Using self assigned wtp name: %s",conf_wtpname);
|
cw_dbg(DBG_INFO,"Using self assigned wtp name: %s",conf_wtpname);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -190,7 +192,7 @@ int wtpconf_ac_list()
|
|||||||
conf_ac_list_len=len;
|
conf_ac_list_len=len;
|
||||||
#ifdef WITH_CW_LOG_DEBUG
|
#ifdef WITH_CW_LOG_DEBUG
|
||||||
for (i=0; i<conf_ac_list_len; i++){
|
for (i=0; i<conf_ac_list_len; i++){
|
||||||
cw_dbg(DBG_CW_INFO,"Using AC: %s\n",conf_ac_list[i]);
|
cw_dbg(DBG_INFO,"Using AC: %s",conf_ac_list[i]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
#include "wtp.h"
|
#include "wtp.h"
|
||||||
#include "wtp_conf.h"
|
#include "wtp_conf.h"
|
||||||
|
|
||||||
|
#include "capwap/dbg.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** The one and only connection object */
|
/** The one and only connection object */
|
||||||
@ -34,7 +36,9 @@ int main()
|
|||||||
|
|
||||||
wtpconf_init();
|
wtpconf_init();
|
||||||
|
|
||||||
cw_dbg_opt_detail = DBG_DETAIL_ASC_DMP;
|
cw_dbg_opt_display = DBG_DISP_ASC_DMP | DBG_DISP_COLORS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dtls_init();
|
dtls_init();
|
||||||
@ -74,10 +78,14 @@ int main()
|
|||||||
cw_itemstore_set_str(conn->local,CW_ITEM_LOCATION_DATA,"Berlin");
|
cw_itemstore_set_str(conn->local,CW_ITEM_LOCATION_DATA,"Berlin");
|
||||||
cw_itemstore_set_str(conn->local,CW_ITEM_WTP_NAME,"WTP Tube");
|
cw_itemstore_set_str(conn->local,CW_ITEM_WTP_NAME,"WTP Tube");
|
||||||
|
|
||||||
|
cw_itemstore_set_byte(conn->local,CW_ITEM_WTP_MAC_TYPE,0);
|
||||||
|
cw_itemstore_set_byte(conn->local,CW_ITEM_WTP_FRAME_TUNNEL_MODE,0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
discovery();
|
discovery();
|
||||||
join();
|
join();
|
||||||
|
image_update();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "capwap/radioinfo.h"
|
#include "capwap/radioinfo.h"
|
||||||
#include "capwap/sock.h"
|
#include "capwap/sock.h"
|
||||||
#include "capwap/capwap_80211.h"
|
#include "capwap/capwap_80211.h"
|
||||||
|
#include "capwap/dbg.h"
|
||||||
|
|
||||||
int wpa_printf()
|
int wpa_printf()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user