Fixed some compiler warnings
FossilOrigin-Name: 0264b0f96f1a8ec7ee01b15de7ef208802cca95d35f1f2ba6ab380b82667b4d5
This commit is contained in:
parent
9d28e72a6b
commit
27869b8c11
@ -3,9 +3,9 @@
|
||||
<Project Name="ac" Path="ac.project" Active="No"/>
|
||||
<Project Name="wtp" Path="wtp.project" Active="No"/>
|
||||
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
|
||||
<Project Name="mod_capwap" Path="mod_capwap.project" Active="Yes"/>
|
||||
<Project Name="mod_capwap" Path="mod_capwap.project" Active="No"/>
|
||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
||||
<Project Name="libcw" Path="libcw.project" Active="No"/>
|
||||
<Project Name="libcw" Path="libcw.project" Active="Yes"/>
|
||||
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
||||
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
||||
<BuildMatrix>
|
||||
|
@ -270,7 +270,6 @@
|
||||
<File Name="src/cw/mavl_foreach.c"/>
|
||||
<File Name="src/cw/lwapp_cisco.h"/>
|
||||
<File Name="src/cw/hdr_print.c"/>
|
||||
<File Name="src/cw/mbag_type_vendorstr.c"/>
|
||||
<File Name="src/cw/cw_out_wtp_board_data.c"/>
|
||||
<File Name="src/cw/mbag_type_str.c"/>
|
||||
<File Name="src/cw/cw_init_data_keep_alive_msg.c"/>
|
||||
|
@ -154,6 +154,7 @@ typedef uint8_t * bstrv_t;
|
||||
*@}
|
||||
*/
|
||||
|
||||
/*
|
||||
#define bstrv_get_vendor_id(str)\
|
||||
( *((uint32_t*)((str)+2)))
|
||||
|
||||
@ -171,7 +172,7 @@ typedef uint8_t * bstrv_t;
|
||||
|
||||
#define bstrv_size(n)\
|
||||
(1+6+(n)*sizeof(uint8_t))
|
||||
|
||||
*/
|
||||
|
||||
uint8_t * bstrv_create_from_str(uint32_t vendor_id,const char *s);
|
||||
uint8_t * bstrv_create(uint32_t vendor_id, uint8_t *data, uint8_t len);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "bstr.h"
|
||||
|
||||
/*
|
||||
uint8_t * bstrv_create(uint32_t vendor_id, uint8_t *data, uint8_t len)
|
||||
{
|
||||
uint8_t * str = malloc(bstrv_size(len));
|
||||
@ -14,4 +15,4 @@ uint8_t * bstrv_create(uint32_t vendor_id, uint8_t *data, uint8_t len)
|
||||
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
@ -124,10 +124,10 @@ struct cw_itemdef capwap_itemdefs[] = {
|
||||
{CW_ITEM_CAPWAP_TRANSPORT_PROTOCOL,CW_ITEM_NONE,MBAG_BYTE},
|
||||
|
||||
{CW_ITEM_LOCATION_DATA,CW_ITEM_NONE,MBAG_STR},
|
||||
{CW_ITEM_WTP_HARDWARE_VERSION,CW_ITEM_NONE,MBAG_VENDORSTR},
|
||||
{CW_ITEM_WTP_SOFTWARE_VERSION,CW_ITEM_NONE,MBAG_VENDORSTR},
|
||||
{CW_ITEM_WTP_BOOT_VERSION,CW_ITEM_NONE,MBAG_VENDORSTR},
|
||||
{CW_ITEM_WTP_OTHER_VERSION,CW_ITEM_NONE,MBAG_VENDORSTR},
|
||||
|
||||
|
||||
|
||||
|
||||
//{CW_ITEM_WTP_GROUP_NAME,CW_ITEM_NONE,MBAG_STR},
|
||||
{CW_ITEM_MAXIMUM_MESSAGE_LENGTH,CW_ITEM_NONE,MBAG_WORD},
|
||||
{CW_ITEM_STATISTICS_TIMER,CW_ITEM_NONE,MBAG_WORD},
|
||||
|
@ -17,7 +17,7 @@ void cw_dbg_elem(int level, struct conn *conn, int msg,
|
||||
{
|
||||
|
||||
|
||||
const char *elemname;
|
||||
/* const char *elemname;*/
|
||||
char vendorname[256];
|
||||
char vendor_details[265];
|
||||
|
||||
|
@ -31,7 +31,7 @@ int cw_in_cisco_image_identifier(struct conn *conn,struct cw_action_in * a,uint8
|
||||
}
|
||||
|
||||
// mbag_set(conn->remote,a->item_id,a->itemtype,data+dstart,len);
|
||||
mbag_set_bstrv(conn->incomming,a->item_id,vendor_id,data+dstart,len);
|
||||
// mbag_set_bstrv(conn->incomming,a->item_id,vendor_id,data+dstart,len);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
int cw_put_mbag_item(uint8_t * dst, struct mbag_item *item)
|
||||
{
|
||||
/*
|
||||
if (item->type->put){
|
||||
cw_dbg(DBG_X,"User put method to put ");
|
||||
return item->type->put(item,dst);
|
||||
@ -72,7 +73,7 @@ int cw_put_mbag_item(uint8_t * dst, struct mbag_item *item)
|
||||
|
||||
cw_log(LOG_ERR,"No method to put items of type %s",item->type->name);
|
||||
|
||||
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -36,11 +36,12 @@
|
||||
*/
|
||||
int cw_save_file(const char *filename, char *data, int len)
|
||||
{
|
||||
int bytes;
|
||||
FILE *outfile = fopen(filename, "wb");
|
||||
if (!outfile)
|
||||
return 0;
|
||||
|
||||
int bytes = fwrite(data, 1, len, outfile);
|
||||
bytes = fwrite(data, 1, len, outfile);
|
||||
fclose(outfile);
|
||||
return bytes;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ static struct cw_KVT *get ( struct cw_KVT * data, const uint8_t * src, int len )
|
||||
|
||||
if ( !s )
|
||||
return NULL;
|
||||
|
||||
|
||||
data->type = &cw_type_bstr16;
|
||||
data->val.ptr = s;
|
||||
return data;
|
||||
|
@ -28,7 +28,7 @@ static cw_KVT_t *get(cw_KVT_t * data, const uint8_t * src, int len)
|
||||
return data;
|
||||
}
|
||||
|
||||
static int put(cw_KVT_t *data, uint8_t * dst)
|
||||
static int put(const cw_KVT_t *data, uint8_t * dst)
|
||||
{
|
||||
return cw_put_byte(dst, data->val.byte);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ static struct cw_KVT *get(struct cw_KVT * data, const uint8_t * src, int len)
|
||||
return data;
|
||||
}
|
||||
|
||||
static int put(struct cw_KVT *data, uint8_t * dst)
|
||||
static int put(const struct cw_KVT *data, uint8_t * dst)
|
||||
{
|
||||
return cw_put_dword(dst, data->val.dword);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ static struct cw_KVT *get(struct cw_KVT * data, const uint8_t * src, int len)
|
||||
return data;
|
||||
}
|
||||
|
||||
static int put(cw_KVT_t *data, uint8_t * dst)
|
||||
static int put(const cw_KVT_t *data, uint8_t * dst)
|
||||
{
|
||||
return cw_put_word(dst, data->val.word);
|
||||
}
|
||||
|
@ -336,6 +336,8 @@ void cw_dbg_msg(int level, struct conn *conn, uint8_t * packet, int len,
|
||||
cw_dbg(level, "%s", buf);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
static int cw_format_vendor(char *dst, uint32_t vendor_id, int elem_id,
|
||||
const uint8_t * elem_data)
|
||||
{
|
||||
@ -349,7 +351,7 @@ static int cw_format_vendor(char *dst, uint32_t vendor_id, int elem_id,
|
||||
}
|
||||
|
||||
|
||||
/* dive into LWAPP vendor specific decoding */
|
||||
// dive into LWAPP vendor specific decoding
|
||||
lw_elem_id = lw_get_word(elem_data + 4 + 6);
|
||||
return sprintf(dst, "%d/LWAPP Vendor: %d - %s",
|
||||
elem_id,
|
||||
@ -371,7 +373,7 @@ static int cw_format_vendor(char *dst, uint32_t vendor_id, int elem_id,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
@ -28,15 +28,13 @@ static BIO_METHOD bio_methods = {
|
||||
unsigned int max_identity_len,
|
||||
unsigned char *psk, unsigned int max_psk_len)
|
||||
{
|
||||
|
||||
int l;
|
||||
BIO *b = SSL_get_rbio(ssl);
|
||||
struct conn *conn = b->ptr;
|
||||
|
||||
// printf("KEYY: %s\n",conn->dtls_psk);
|
||||
|
||||
snprintf(identity, max_identity_len, "CLient_identity");
|
||||
|
||||
int l = conn->dtls_psk_len < max_psk_len ? conn->dtls_psk_len : max_psk_len;
|
||||
l = conn->dtls_psk_len < max_psk_len ? conn->dtls_psk_len : max_psk_len;
|
||||
memcpy(psk, conn->dtls_psk, l);
|
||||
return l;
|
||||
|
||||
@ -45,22 +43,27 @@ static BIO_METHOD bio_methods = {
|
||||
|
||||
int dtls_openssl_connect(struct conn *conn)
|
||||
{
|
||||
struct dtls_openssl_data *d;
|
||||
int rc;
|
||||
time_t timer;
|
||||
|
||||
if (!conn->dtls_data)
|
||||
conn->dtls_data =
|
||||
dtls_openssl_data_create(conn, DTLSv1_client_method(),
|
||||
dtls_openssl_bio_method());
|
||||
|
||||
struct dtls_openssl_data *d = (struct dtls_openssl_data *) conn->dtls_data;
|
||||
d = (struct dtls_openssl_data *) conn->dtls_data;
|
||||
if (!d)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
// if (conn->dtls_psk)
|
||||
// SSL_set_psk_client_callback(d->ssl, psk_client_cb);
|
||||
*/
|
||||
|
||||
int rc;
|
||||
|
||||
errno =0;
|
||||
time_t timer = cw_timer_start(10);
|
||||
timer = cw_timer_start(10);
|
||||
do {
|
||||
rc = SSL_connect(d->ssl);
|
||||
}while(rc!=1 && errno==EAGAIN && !cw_timer_timeout(timer));
|
||||
|
@ -21,14 +21,16 @@
|
||||
|
||||
const char * dtls_openssl_get_cipher(struct conn * conn)
|
||||
{
|
||||
struct dtls_openssl_data * d;
|
||||
const SSL_CIPHER * c;
|
||||
if (!conn->dtls_data)
|
||||
return "None";
|
||||
|
||||
struct dtls_openssl_data * d = (struct dtls_openssl_data*)conn->dtls_data;
|
||||
d = (struct dtls_openssl_data*)conn->dtls_data;
|
||||
|
||||
if ( !d->ssl )
|
||||
return "None";
|
||||
|
||||
const SSL_CIPHER * c = SSL_get_current_cipher(d->ssl);
|
||||
c = SSL_get_current_cipher(d->ssl);
|
||||
return SSL_CIPHER_get_name(c);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ static struct frag * frag_new(struct frag * frags, int fragid)
|
||||
int i;
|
||||
for (i=0; i<FRAG_MAXIDS; i++){
|
||||
if (frags[i].buffer==NULL || (t.tv_sec - frags[i].t.tv_sec>FRAG_TTL) ){
|
||||
// printf("******************************new frag, %p\n",frags[i].buffer);
|
||||
|
||||
|
||||
frags[i].buffer=realloc(frags[i].buffer,FRAG_MAXSIZE);
|
||||
if (frags[i].buffer==NULL)
|
||||
|
@ -26,7 +26,7 @@ struct cw_Type {
|
||||
void (*del) (struct cw_KVT * data);
|
||||
|
||||
/** A method to put this object to a buffer */
|
||||
int (*put) (struct cw_KVT * data, uint8_t * dst);
|
||||
int (*put) (const struct cw_KVT * data, uint8_t * dst);
|
||||
|
||||
/** The get method */
|
||||
struct cw_KVT *(*get) (struct cw_KVT * data, const uint8_t * src, int len);
|
||||
|
@ -332,7 +332,7 @@ int mbag_set_data(mbag_t s, const char *id, const struct mbag_typedef *type, voi
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
bstrv_t mbag_set_bstrv(mbag_t s, const char *id, uint32_t vendor_id,
|
||||
uint8_t * version, int len)
|
||||
{
|
||||
@ -346,7 +346,7 @@ bstrv_t mbag_set_bstrv(mbag_t s, const char *id, uint32_t vendor_id,
|
||||
}
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
@ -114,7 +114,7 @@ extern const struct mbag_typedef mtype_dword;
|
||||
extern const struct mbag_typedef mbag_type_mbag;
|
||||
extern const struct mbag_typedef mbag_type_bstr;
|
||||
extern const struct mbag_typedef mbag_type_bstr16;
|
||||
extern const struct mbag_typedef mbag_type_bstrv;
|
||||
|
||||
extern const struct mbag_typedef mbag_type_str;
|
||||
extern const struct mbag_typedef mbag_type_ptr;
|
||||
extern const struct mbag_typedef mbag_type_avltree;
|
||||
@ -151,8 +151,6 @@ extern const struct mbag_typedef mbag_type_data;
|
||||
#define MBAG_DATA (&mbag_type_data)
|
||||
#define MBAG_BIN MBAG_DATA
|
||||
|
||||
/** MBAG_BSTRV holds a #bstr_t value */
|
||||
#define MBAG_VENDORSTR (&mbag_type_bstrv)
|
||||
/** MBAG_STR holds a zero terminated string */
|
||||
#define MBAG_STR (&mbag_type_str)
|
||||
/**
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
int mbag_set_from_buf(mbag_t dst, mbagtype_t type, const char *item_id, uint8_t *data, int len)
|
||||
{
|
||||
|
||||
/*
|
||||
if (type == MBAG_BYTE) {
|
||||
mbag_set_byte(dst, item_id, *data);
|
||||
return 1;
|
||||
@ -46,7 +46,7 @@ int mbag_set_from_buf(mbag_t dst, mbagtype_t type, const char *item_id, uint8_t
|
||||
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
@ -1,80 +0,0 @@
|
||||
/*
|
||||
This file is part of libcapwap.
|
||||
|
||||
libcapwap is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
libcapwap is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
*@file
|
||||
*@brief Implementation of mbag_type bstrv
|
||||
*@addtogroup MbagFunctions
|
||||
*@{
|
||||
*/
|
||||
|
||||
#include "mbag.h"
|
||||
#include "format.h"
|
||||
|
||||
|
||||
static int to_str(void *item,char *dst)
|
||||
{
|
||||
|
||||
mbag_item_t *i= item;
|
||||
|
||||
char *d=dst;
|
||||
d+=sprintf(d,"%d,",bstrv_get_vendor_id(i->u2.data));
|
||||
|
||||
if (format_is_utf8(bstrv_data(i->u2.data), bstrv_len(i->u2.data))) {
|
||||
d += sprintf(d, "%.*s", bstrv_len(i->u2.data),
|
||||
bstrv_data(i->u2.data));
|
||||
} else {
|
||||
d += sprintf(d, ".x");
|
||||
d += format_hex(d, bstrv_data(i->u2.data), bstrv_len(i->u2.data));
|
||||
}
|
||||
|
||||
return d-dst;
|
||||
}
|
||||
|
||||
|
||||
static struct mbag_item * from_str(const char *src)
|
||||
{
|
||||
mbag_item_t * i = mbag_item_new(MBAG_VENDORSTR);
|
||||
if (!i)
|
||||
return NULL;
|
||||
|
||||
uint32_t vendor_id=atoi(src);
|
||||
const char *s = strchr(src,',');
|
||||
|
||||
|
||||
if (s){
|
||||
i->u2.data=bstrv_create_from_str(vendor_id,s+1);
|
||||
}
|
||||
else{
|
||||
i->u2.data=bstrv_create_from_str(vendor_id,"");
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the VendorStr type.
|
||||
*
|
||||
* MBAG items of this type containing a variable of type #bstrv_t.
|
||||
*/
|
||||
const struct mbag_typedef mbag_type_bstrv = {
|
||||
"VendorStr",free,to_str,from_str
|
||||
};
|
||||
|
||||
|
||||
/**@}*/
|
@ -23,11 +23,11 @@
|
||||
|
||||
int sock_mwait(int * socklist, int socklistlen,fd_set * fset)
|
||||
{
|
||||
int i;
|
||||
int i,max,n;
|
||||
|
||||
FD_ZERO(fset);
|
||||
|
||||
int max = 0;
|
||||
max = 0;
|
||||
for (i=0; i<socklistlen; i++){
|
||||
if (socklist[i]<=0)
|
||||
continue;
|
||||
@ -36,7 +36,6 @@ int sock_mwait(int * socklist, int socklistlen,fd_set * fset)
|
||||
max=socklist[i];
|
||||
}
|
||||
|
||||
int n;
|
||||
while((n=select(max+1, fset, NULL, NULL, NULL)) < 0) {
|
||||
if (errno != EINTR)
|
||||
return n;
|
||||
|
@ -95,7 +95,7 @@ static struct cw_ElemHandler handlers[] = {
|
||||
0,0, /* Vendor / Proto */
|
||||
0,0, /* min/max length */
|
||||
NULL, /* type */
|
||||
NULL, /* Key */
|
||||
"mtu_discovery_padding", /* Key */
|
||||
capwap_in_mtu_discovery_padding /* get */
|
||||
}
|
||||
,
|
||||
|
@ -106,7 +106,7 @@ static int init()
|
||||
}
|
||||
|
||||
uint8_t * str;
|
||||
|
||||
/*
|
||||
str = bstr_create_from_cfgstr(hardware_version);
|
||||
mbag_set_bstrv(cisco_config, CW_ITEM_AC_HARDWARE_VERSION,
|
||||
CW_VENDOR_ID_CISCO,
|
||||
@ -122,6 +122,7 @@ static int init()
|
||||
);
|
||||
free(str);
|
||||
}
|
||||
*/
|
||||
errX:
|
||||
if (hardware_version)
|
||||
free (hardware_version);
|
||||
|
Loading…
Reference in New Issue
Block a user