Work in progress ...
FossilOrigin-Name: a76e8760f309d36aad22507f961ac5a03f46df9ee585c2f8601ee0a5a088738e
This commit is contained in:
parent
84e6d01348
commit
c851831463
@ -364,14 +364,15 @@ static void wtpman_run_discovery(void *arg)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
cwread_discovery_request(&wtpman->wtpinfo,cwrmsg->msgelems,cwrmsg->msgelems_len);
|
||||
|
||||
|
||||
conn_detect_capwap(wtpman->conn,&wtpman->wtpinfo);
|
||||
|
||||
char wtpinfostr[8192];
|
||||
wtpinfo_print(wtpinfostr,&wtpman->wtpinfo);
|
||||
cw_dbg(DBG_CW_INFO,"Discovery request gave us the follwing WTP Info:\n%s",wtpinfostr);
|
||||
|
||||
//exit(0);
|
||||
|
||||
|
||||
struct radioinfo radioinfo;
|
||||
@ -508,6 +509,7 @@ static int wtpman_join(void *arg,time_t timer)
|
||||
|
||||
}
|
||||
process_join_request(&wtpman->wtpinfo,cwrmsg->msgelems,cwrmsg->msgelems_len);
|
||||
conn_detect_capwap(wtpman->conn,&wtpman->wtpinfo);
|
||||
|
||||
{
|
||||
char wtpinfostr[8192];
|
||||
@ -581,10 +583,16 @@ static void wtpman_run(void *arg)
|
||||
break;
|
||||
case CWMSG_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,"/home/tube/Downloads/c1130-rcvk9w8-tar.124-25e.JAO5.tar");
|
||||
|
||||
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");
|
||||
// send_image_file(wtpman->conn,"/home/tube/Downloads/c1130-rcvk9w8-tar.124-25e.JAP.tar");
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -20,13 +20,15 @@ int conn_recv_packet(struct conn* conn,uint8_t *buf,int len)
|
||||
if (errno == EWOULDBLOCK)
|
||||
{
|
||||
printf("would block\n");
|
||||
|
||||
// continue;
|
||||
}
|
||||
if ( errno==EAGAIN )
|
||||
{
|
||||
printf("again\n");
|
||||
}
|
||||
perror("recv");
|
||||
|
||||
printf("Return n %d\n",n);
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <string.h>
|
||||
#include "capwap.h"
|
||||
|
||||
|
||||
void cwmsg_addelem_ac_descriptor(struct cwmsg *msg,struct ac_info * acinfo)
|
||||
{
|
||||
uint8_t buffer[12+2048];
|
||||
@ -26,11 +27,14 @@ void cwmsg_addelem_ac_descriptor(struct cwmsg *msg,struct ac_info * acinfo)
|
||||
|
||||
*((uint32_t*)(acd))=htonl((acinfo->stations<<16) | (acinfo->limit));
|
||||
*((uint32_t*)(acd+4))=htonl((acinfo->active_wtps<<16) | acinfo->max_wtps);
|
||||
|
||||
//printf("(((((((((((((((((((((((((((((((((((((((((((((((((((((((( %d\n",acinfo->dtls_policy);
|
||||
*((uint32_t*)(acd+8))=htonl((acinfo->security<<24) | (acinfo->rmac<<16) | acinfo->dtls_policy );
|
||||
|
||||
|
||||
int len = 12;
|
||||
int sublen;
|
||||
//goto u;
|
||||
|
||||
sublen = 4;
|
||||
|
||||
@ -40,14 +44,14 @@ void cwmsg_addelem_ac_descriptor(struct cwmsg *msg,struct ac_info * acinfo)
|
||||
len+=4;
|
||||
*(acd+len)=5; len++;
|
||||
*(acd+len)=0; len++;
|
||||
*(acd+len)=72; len++;
|
||||
*(acd+len)=71; len++;
|
||||
*(acd+len)=19; len++;
|
||||
*(acd+len)=2; len++;
|
||||
*(acd+len)=5; len++;
|
||||
*(acd+len)=6; len++;
|
||||
*(acd+len)=7; len++;
|
||||
*(acd+len)=8; len++;
|
||||
|
||||
|
||||
/*
|
||||
*((uint32_t*)(acd+len))=htonl(CW_VENDOR_ID_CISCO);
|
||||
len+=4;
|
||||
*((uint32_t*)(acd+len))=htonl((1<<16)|sublen);
|
||||
@ -61,17 +65,18 @@ void cwmsg_addelem_ac_descriptor(struct cwmsg *msg,struct ac_info * acinfo)
|
||||
*(acd+len)=7; len++;
|
||||
*(acd+len)=8; len++;
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
goto b;
|
||||
//u:
|
||||
|
||||
/* software version subelement */
|
||||
|
||||
*((uint32_t*)(acd+len))=htonl(CW_VENDOR_ID_CISCO);
|
||||
len+=4;
|
||||
sublen=strlen((const char*)acinfo->software_version);
|
||||
*((uint32_t*)(acd+len))=htonl((1<<16)|sublen);
|
||||
*((uint32_t*)(acd+len))=htonl((5<<16)|sublen);
|
||||
len+=4;
|
||||
memcpy(acd+len,acinfo->software_version,sublen);
|
||||
len+=sublen;
|
||||
|
@ -21,7 +21,9 @@
|
||||
|
||||
void cwmsg_addelem_image_identifier(struct cwmsg *cwmsg,uint32_t vendor_id,uint8_t *img, int len)
|
||||
{
|
||||
uint32_t net_vendor_id = htonl(vendor_id);
|
||||
cwmsg_vaddelem(cwmsg,CWMSGELEM_IMAGE_IDENTIFIER,2,&net_vendor_id,sizeof(net_vendor_id),img,len);
|
||||
// uint32_t net_vendor_id = htonl(vendor_id);
|
||||
|
||||
cwmsg_vaddelem(cwmsg,CWMSGELEM_IMAGE_IDENTIFIER,1,img,len);
|
||||
// cwmsg_vaddelem(cwmsg,CWMSGELEM_IMAGE_IDENTIFIER,2,&net_vendor_id,sizeof(net_vendor_id),img,len);
|
||||
}
|
||||
|
||||
|
@ -22,10 +22,14 @@
|
||||
#include "conn.h"
|
||||
#include "cwmsg.h"
|
||||
|
||||
#include <stdio.h> //Tube
|
||||
|
||||
void cwmsg_addelem_mtu_discovery_padding(struct cwmsg * msg, struct conn* conn)
|
||||
{
|
||||
int len = conn->mtu - (msg->msgelems-msg->buffer+msg->pos)-4;
|
||||
|
||||
printf("MTU discovery len %d %d and pos %d:\n",conn->mtu,len,msg->pos);
|
||||
|
||||
if (len < 0 )
|
||||
return;
|
||||
|
||||
@ -33,5 +37,7 @@ void cwmsg_addelem_mtu_discovery_padding(struct cwmsg * msg, struct conn* conn)
|
||||
*((uint32_t*)(msg->msgelems+msg->pos))=htonl(val);
|
||||
memset(msg->msgelems+4+msg->pos,0xff,len);
|
||||
msg->pos+=4+len;
|
||||
|
||||
printf("Nenpos = %d\n",msg->pos);
|
||||
}
|
||||
|
||||
|
@ -3,35 +3,37 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "capwap.h"
|
||||
#include "bstr.h"
|
||||
|
||||
|
||||
void cwmsg_addelem_wtp_board_data(struct cwmsg * cwmsg, struct wtpinfo * wtpinfo)
|
||||
void cwmsg_addelem_wtp_board_data(struct cwmsg *cwmsg, struct wtpinfo *wtpinfo)
|
||||
{
|
||||
uint8_t msg[1030];
|
||||
*((uint32_t*)msg)=htonl(wtpinfo->vendor_id);
|
||||
*((uint32_t *) msg) = htonl(wtpinfo->vendor_id);
|
||||
|
||||
int l;
|
||||
int len=4;
|
||||
int len = 4;
|
||||
|
||||
if (wtpinfo->model_no){
|
||||
l=strlen((char*)wtpinfo->model_no);
|
||||
*((uint32_t*)(msg+len))=htonl(CWBOARDDATA_MODELNO<<16|l);
|
||||
memcpy(msg+len+4,wtpinfo->model_no,l);
|
||||
len+=l+4;
|
||||
if (wtpinfo->model_no) {
|
||||
l = bstr_len(wtpinfo->model_no);
|
||||
*((uint32_t *) (msg + len)) = htonl(CWBOARDDATA_MODELNO << 16 | l);
|
||||
memcpy(msg + len + 4, bstr_data(wtpinfo->model_no), l);
|
||||
len += l + 4;
|
||||
}
|
||||
|
||||
if (wtpinfo->serial_no){
|
||||
l=strlen((char*)wtpinfo->serial_no);
|
||||
*((uint32_t*)(msg+len))=htonl(CWBOARDDATA_SERIALNO<<16|l);
|
||||
memcpy(msg+len+4,wtpinfo->serial_no,l);
|
||||
len+=l+4;
|
||||
if (wtpinfo->serial_no) {
|
||||
l = strlen((char *) wtpinfo->serial_no);
|
||||
*((uint32_t *) (msg + len)) = htonl(CWBOARDDATA_SERIALNO << 16 | l);
|
||||
memcpy(msg + len + 4, wtpinfo->serial_no, l);
|
||||
len += l + 4;
|
||||
}
|
||||
|
||||
if (wtpinfo->macaddress){
|
||||
*((uint32_t*)(msg+len))=htonl(CWBOARDDATA_MACADDRESS<<16|wtpinfo->macaddress_len);
|
||||
memcpy(msg+len+4,wtpinfo->macaddress,wtpinfo->macaddress_len);
|
||||
len+=wtpinfo->macaddress_len+4;
|
||||
if (wtpinfo->macaddress) {
|
||||
*((uint32_t *) (msg + len)) =
|
||||
htonl(CWBOARDDATA_MACADDRESS << 16 | wtpinfo->macaddress_len);
|
||||
memcpy(msg + len + 4, wtpinfo->macaddress, wtpinfo->macaddress_len);
|
||||
len += wtpinfo->macaddress_len + 4;
|
||||
}
|
||||
|
||||
cwmsg_addelem(cwmsg,CWMSGELEM_WTP_BOARD_DATA,msg,len);
|
||||
cwmsg_addelem(cwmsg, CWMSGELEM_WTP_BOARD_DATA, msg, len);
|
||||
}
|
||||
|
@ -50,21 +50,22 @@ void cwmsg_addelem_wtp_descriptor(struct cwmsg * cwmsg, struct wtpinfo * wtpinfo
|
||||
hww[0]=0x1c;
|
||||
hww[1]=0;
|
||||
|
||||
/* hardware subelem*/
|
||||
// len+=wtpdesc_addsubelem(d+len,CWMSGSUBELEM_WTP_DESCRIPTOR_HARDWARE_VERSION,
|
||||
// wtpinfo->hardware_vendor_id,wtpinfo->hardware_version,2);
|
||||
len+=wtpdesc_addsubelem(d+len,CWMSGSUBELEM_WTP_DESCRIPTOR_HARDWARE_VERSION,
|
||||
wtpinfo->hardware_vendor_id,hww,2);
|
||||
|
||||
|
||||
/* software subelem*/
|
||||
len+=wtpdesc_addsubelem(d+len,CWMSGSUBELEM_WTP_DESCRIPTOR_SOFTWARE_VERSION,
|
||||
wtpinfo->software_vendor_id,wtpinfo->software_version,-1);
|
||||
|
||||
/* hardware subelem*/
|
||||
// len+=wtpdesc_addsubelem(d+len,CWMSGSUBELEM_WTP_DESCRIPTOR_HARDWARE_VERSION,
|
||||
// wtpinfo->hardware_vendor_id,wtpinfo->hardware_version,2);
|
||||
|
||||
/* len+=wtpdesc_addsubelem(d+len,CWMSGSUBELEM_WTP_DESCRIPTOR_HARDWARE_VERSION,
|
||||
wtpinfo->hardware_vendor_id,hww,2);
|
||||
*/
|
||||
|
||||
/* bootloader subelem*/
|
||||
len+=wtpdesc_addsubelem(d+len,CWMSGSUBELEM_WTP_DESCRIPTOR_BOOTLOADER_VERSION,
|
||||
/* len+=wtpdesc_addsubelem(d+len,CWMSGSUBELEM_WTP_DESCRIPTOR_BOOTLOADER_VERSION,
|
||||
wtpinfo->bootloader_vendor_id,wtpinfo->bootloader_version,-1);
|
||||
|
||||
|
||||
*/
|
||||
cwmsg_addelem(cwmsg,CWMSGELEM_WTP_DESCRIPTOR,d,len);
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ int cw_readelem_image_identifier(uint8_t **dst, int type,uint8_t *msgelem, int l
|
||||
|
||||
static int imgdata_request(void * a,int type,uint8_t* msgelem,int len)
|
||||
{
|
||||
printf("HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH oioioioioi here\n");
|
||||
cw_dbg_msgelem(CWMSG_DISCOVERY_REQUEST, type, msgelem, len);
|
||||
|
||||
// struct ac_info * acinfo = (struct ac_info *)a;
|
||||
cw_dbg(DBG_ALL,"Reading image data req msgelem, type=%d - %s ,len=%d\n",type,cw_msgelemtostr(type),len);
|
||||
@ -66,7 +68,11 @@ static int imgdata_request(void * a,int type,uint8_t* msgelem,int len)
|
||||
|
||||
void cwread_image_data_request(struct ac_info * acinfo, uint8_t * msg, int len)
|
||||
{
|
||||
/* cw_log_debug1("Reading join response");*/
|
||||
printf("RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRrrr im data eqi\n");
|
||||
printf("RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRrrr im data eqi\n");
|
||||
printf("RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRrrr im data eqi\n");
|
||||
printf("RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRrrr im data eqi\n");
|
||||
printf("RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRrrr im data eqi\n");
|
||||
cw_foreach_msgelem(msg,len,imgdata_request,NULL);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ int cwsend_discovery_request(struct conn * conn,struct radioinfo * radioinfo,str
|
||||
cwmsg_init(&cwmsg,buffer,CWMSG_DISCOVERY_REQUEST,conn_get_next_seqnum(conn),NULL /*radioinfo*/);
|
||||
|
||||
cwmsg_addelem(&cwmsg,CWMSGELEM_DISCOVERY_TYPE,&wtpinfo->discovery_type,sizeof(uint8_t));
|
||||
// cwmsg_addelem_wtp_board_data(&cwmsg,wtpinfo);
|
||||
cwmsg_addelem_wtp_board_data(&cwmsg,wtpinfo);
|
||||
// cwmsg_addelem_wtp_descriptor(&cwmsg,wtpinfo);
|
||||
cwmsg_addelem(&cwmsg,CWMSGELEM_WTP_FRAME_TUNNEL_MODE,&wtpinfo->frame_tunnel_mode,sizeof(uint8_t));
|
||||
cwmsg_addelem(&cwmsg,CWMSGELEM_WTP_MAC_TYPE,&wtpinfo->mac_type,sizeof(uint8_t));
|
||||
|
@ -21,7 +21,7 @@ void cwsend_join_response(struct conn * conn,int seqnum, int rc, struct radioinf
|
||||
|
||||
|
||||
/* */
|
||||
cwmsg_addelem_image_identifier(cwmsg,CW_VENDOR_ID_CISCO,(uint8_t*)"tobias",strlen("tobias"));
|
||||
cwmsg_addelem_image_identifier(cwmsg,CW_VENDOR_ID_CISCO,(uint8_t*)"/tobias",strlen("/tobias"));
|
||||
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ void cwsend_join_response(struct conn * conn,int seqnum, int rc, struct radioinf
|
||||
buffer[5]=5; /* s/w version */
|
||||
buffer[6]=0; /* s/w Release */
|
||||
buffer[7]=19; /* s/w Maint */
|
||||
buffer[8]=3; /* s/w Build */
|
||||
buffer[8]=2; /* s/w Build */
|
||||
|
||||
*((uint16_t*)(buffer+9))=htons(13); /* Active MS */
|
||||
*((uint16_t*)(buffer+9+2))=htons(23); /* Supported MS */
|
||||
|
@ -192,6 +192,7 @@ int dtls_openssl_set_certs(struct conn * conn, struct dtls_openssl_data *d)
|
||||
cw_dbg(DBG_DTLS,"DTLS - Using cert file %s",conn->dtls_cert_file);
|
||||
|
||||
/* rc = SSL_CTX_use_certificate_file(d->ctx,conn->dtls_cert_file,SSL_FILETYPE_PEM);*/
|
||||
|
||||
rc = SSL_CTX_use_certificate_chain_file(d->ctx,conn->dtls_cert_file);
|
||||
if (!rc){
|
||||
|
||||
@ -214,7 +215,7 @@ int generate_session_id(const SSL *ssl, unsigned char * id, unsigned int *id_len
|
||||
|
||||
|
||||
// printf ("MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMaking session id\n");
|
||||
const char * sessid = "123456789";
|
||||
const char * sessid = "9123456789";
|
||||
memcpy(id,sessid,strlen(sessid));
|
||||
*id_len=strlen(sessid);
|
||||
return 1;
|
||||
@ -224,6 +225,21 @@ int generate_session_id(const SSL *ssl, unsigned char * id, unsigned int *id_len
|
||||
|
||||
static int dtls_verify_peer_callback (int ok, X509_STORE_CTX *ctx)
|
||||
{
|
||||
printf ("Verify callback called with ok = %d\n",ok);
|
||||
|
||||
SSL *ssl;
|
||||
ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
|
||||
|
||||
char buf[1024];
|
||||
X509 *err_cert;
|
||||
|
||||
err_cert = X509_STORE_CTX_get_current_cert(ctx);
|
||||
X509_NAME_oneline(X509_get_subject_name(err_cert), buf, 256);
|
||||
|
||||
printf("Err cert: %s\n",buf);
|
||||
|
||||
return 1;
|
||||
exit(0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
int dtls_openssl_bio_write(BIO *b, const char *data, int len)
|
||||
{
|
||||
// printf("bio_write %p %d",data,len);
|
||||
printf("bio_write %p %d",data,len);
|
||||
|
||||
struct conn * conn = b->ptr;
|
||||
uint8_t buffer[2048];
|
||||
@ -14,7 +14,7 @@ int dtls_openssl_bio_write(BIO *b, const char *data, int len)
|
||||
memcpy(buffer+4,data,len);
|
||||
int rc = conn->send_packet(conn,buffer,len+4);
|
||||
|
||||
// printf("Bio wr rc = %d\n",rc);
|
||||
printf("Bio wr rc = %d\n",rc);
|
||||
|
||||
|
||||
if (rc<0)
|
||||
@ -134,7 +134,8 @@ long dtls_openssl_bio_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
|
||||
case BIO_CTRL_DGRAM_QUERY_MTU:
|
||||
{
|
||||
ret = 1500;
|
||||
ret = 1300;
|
||||
break;
|
||||
|
||||
/* sockopt_len = sizeof(sockopt_val);
|
||||
if ((ret = getsockopt(pData->sock, IPPROTO_IP, IP_MTU, (void *)&sockopt_val, &sockopt_len)) < 0 || sockopt_val < 0)
|
||||
|
@ -51,7 +51,7 @@ int dtls_openssl_connect(struct conn * conn)
|
||||
SSL_set_psk_client_callback( d->ssl, psk_client_cb);
|
||||
|
||||
|
||||
dtls_openssl_set_certs(conn,d);
|
||||
// dtls_openssl_set_certs(conn,d);
|
||||
|
||||
if (conn->dtls_cert_file && conn->dtls_key_file){
|
||||
}
|
||||
@ -60,9 +60,9 @@ int dtls_openssl_connect(struct conn * conn)
|
||||
int rc;
|
||||
// do{
|
||||
rc = SSL_connect(d->ssl);
|
||||
/*
|
||||
|
||||
|
||||
/* if (rc <= 0){
|
||||
if (rc <= 0){
|
||||
int e;
|
||||
e = SSL_get_error(d->ssl,rc);
|
||||
printf("Get Err %i\n",e);
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
VERSION="1.0.1i"
|
||||
#VERSION="1.0.2"
|
||||
#VERSION="1.0.1i"
|
||||
VERSION="1.0.2"
|
||||
|
||||
if [ !-e openssl-${VERSION} ]
|
||||
if [ ! -e openssl-${VERSION} ]
|
||||
then
|
||||
wget https://www.openssl.org/source/openssl-${VERSION}.tar.gz
|
||||
fi
|
||||
|
@ -1,4 +1,5 @@
|
||||
include ../WtpConfig.mak
|
||||
include ../Macros.mak
|
||||
|
||||
ifndef CC
|
||||
CC=gcc
|
||||
@ -52,8 +53,8 @@ LIBS+=-lcapwap
|
||||
#LIBS+=-liw
|
||||
LIBS+=-lnl-3
|
||||
LIBS+=-lnl-genl-3
|
||||
LIBS+=-lssl
|
||||
LIBS+=-lcrypto
|
||||
LIBS+=$(OPENSSLLIB)
|
||||
#LIBS+=-lcrypto
|
||||
#LIBS+=-lrt
|
||||
ifdef WITH_UCI
|
||||
LIBS+=-luci -lubox
|
||||
@ -73,6 +74,7 @@ CFLAGS += $(HA_INCS)
|
||||
#CFLAGS += -I../src
|
||||
#CFLAGS += -I../src/utils
|
||||
CFLAGS += -I../../src
|
||||
CFLAGS += -I$(OPENSSLINC)
|
||||
|
||||
#CFLAGS += -I/usr/local/include
|
||||
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include "capwap/cw_log.h"
|
||||
|
||||
#include "capwap/bstr.h"
|
||||
|
||||
|
||||
static struct uci_section * get_anon_section(struct uci_package * pkg, const char *type)
|
||||
{
|
||||
@ -75,7 +77,7 @@ int read_config(const char * filename){
|
||||
|
||||
struct uci_section * section = get_anon_section(pkg,"wtp");
|
||||
if (!section) {
|
||||
cw_dbg(DBG_CW_INFO,"No 'wtp' section found, running withou config");
|
||||
cw_dbg(DBG_CW_INFO,"No 'wtp' section found, running without config");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -85,7 +87,6 @@ int read_config(const char * filename){
|
||||
if (str)
|
||||
conf_wtpname = strdup(str);
|
||||
|
||||
|
||||
str = uci_lookup_option_string(ctx,section,"mtu");
|
||||
if (str)
|
||||
conf_mtu = atoi(str);
|
||||
@ -93,7 +94,31 @@ int read_config(const char * filename){
|
||||
str = uci_lookup_option_string(ctx,section,"mtu_discovery");
|
||||
if (str)
|
||||
conf_mtu_discovery = atoi(str);
|
||||
|
||||
|
||||
str = uci_lookup_option_string(ctx,section,"ssl_key");
|
||||
if (str)
|
||||
conf_sslkeyfilename=strdup(str);
|
||||
|
||||
str = uci_lookup_option_string(ctx,section,"ssl_cert");
|
||||
if (str)
|
||||
conf_sslcertfilename=strdup(str);
|
||||
|
||||
str = uci_lookup_option_string(ctx,section,"vendor_id");
|
||||
if (str)
|
||||
conf_vendor_id=atoi(str);
|
||||
|
||||
str = uci_lookup_option_string(ctx,section,"software_version");
|
||||
if (str){
|
||||
uint8_t * s = bstr_create_from_cfgstr(str);
|
||||
bstr_replace(&conf_software_version,s);
|
||||
}
|
||||
|
||||
str = uci_lookup_option_string(ctx,section,"model_no");
|
||||
if (str){
|
||||
uint8_t * s = bstr_create_from_cfgstr(str);
|
||||
bstr_replace(&conf_model_no,s);
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
|
||||
|
@ -67,10 +67,13 @@ static int msg_cb(void *priv,struct cwrmsg * cwrmsg)
|
||||
|
||||
struct discovery_info * di = (struct discovery_info*)priv;
|
||||
|
||||
/*
|
||||
if (di->conn->seqnum != cwrmsg->seqnum){
|
||||
cw_log_debug0("Ignoring discovery respone, seqnum=%i, expected seqnum %i",cwrmsg->seqnum,di->conn->seqnum);
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
struct ac_info acinfo;
|
||||
memset(&acinfo,0,sizeof(acinfo));
|
||||
|
@ -100,6 +100,10 @@ int join(struct sockaddr *sa)
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
printf("conf_dtls_cipher %s\n",conf_dtls_cipher);
|
||||
|
||||
if (conf_dtls_psk){
|
||||
conn->dtls_psk=conf_dtls_psk;
|
||||
conn->dtls_psk_len=strlen(conn->dtls_psk);
|
||||
|
@ -60,6 +60,19 @@ int conf_mtu_discovery=CONF_DEFAULT_MTU_DISCOVERY;
|
||||
int conf_mtu=0;
|
||||
|
||||
|
||||
uint32_t conf_vendor_id;
|
||||
uint32_t * conf_bootloader_vendor_id;
|
||||
uint8_t * conf_bootloader_version;
|
||||
uint32_t * conf_software_vendor_id;
|
||||
uint8_t * conf_software_version;
|
||||
uint32_t * conf_hardware_vendor_id;
|
||||
uint8_t * conf_hardware_version;
|
||||
|
||||
uint8_t * conf_model_no;
|
||||
uint8_t * cont_serial_no;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int wtpconf_primary_if()
|
||||
@ -177,6 +190,11 @@ int wtpconf_preinit()
|
||||
conf_control_port=strdup(CAPWAP_CONTROL_PORT_STR);
|
||||
conf_dtls_cipher=strdup(CONF_DEFAULT_DTLS_CIPHER);
|
||||
|
||||
|
||||
conf_vendor_id = CONF_DEFAULT_VENDOR_ID;
|
||||
conf_software_version = bstr_create(CONF_DEFAULT_SOFTWARE_VERSION);
|
||||
|
||||
|
||||
}
|
||||
|
||||
int wtpconf_init()
|
||||
|
@ -13,6 +13,16 @@ extern char * conf_sslcertfilename;
|
||||
extern char * conf_sslkeypass;
|
||||
|
||||
|
||||
extern uint32_t conf_vendor_id;
|
||||
extern uint32_t * conf_bootloader_vendor_id;
|
||||
extern uint8_t * conf_bootloader_version;
|
||||
extern uint32_t * conf_software_vendor_id;
|
||||
extern uint8_t * conf_software_version;
|
||||
extern uint32_t * conf_hardware_vendor_id;
|
||||
extern uint8_t * conf_hardware_version;
|
||||
|
||||
extern uint8_t * conf_model_no;
|
||||
extern uint8_t * cont_serial_no;
|
||||
|
||||
|
||||
|
||||
@ -28,6 +38,42 @@ extern uint8_t conf_macaddress[12];
|
||||
extern uint8_t conf_macaddress_len;
|
||||
|
||||
|
||||
#ifndef CONF_DEFAULT_VENDOR_ID
|
||||
#define CONF_DEFAULT_VENDOR_ID CW_VENDOR_ID_FSF
|
||||
#endif
|
||||
|
||||
#ifndef CONF_DEFAULT_HARDWARE_VENDOR_ID
|
||||
#define CONF_DEFAULT_HARDWARE_VENDOR_ID CW_VENDOR_ID_FSF
|
||||
#endif
|
||||
|
||||
#ifndef CONF_DEFAULT_SOFTWARE_VENDOR_ID
|
||||
#define CONF_DEFAULT_SOFTWARE_VENDOR_ID CW_VENDOR_ID_FSF
|
||||
#endif
|
||||
|
||||
#ifndef CONF_DEFAULT_BOOTLOADER_VENDOR_ID
|
||||
#define CONF_DEFAULT_BOOTLOADER_VENDOR_ID CW_VENDOR_ID_FSF
|
||||
#endif
|
||||
|
||||
#ifndef CONF_DEFAULT_MODEL_NO
|
||||
#define CONF_DEFAULT_MODEL_NO "W-FAT"
|
||||
#endif
|
||||
|
||||
#ifndef CONF_DEFAULT_SERIAL_NO
|
||||
#define CONF_DEFAULT_SERIAL_NO "0000"
|
||||
#endif
|
||||
|
||||
#ifndef CONF_DEFAULT_SOFTWARE_VERSION
|
||||
#define CONF_DEFAULT_SOFTWARE_VERSION "0.1"
|
||||
#endif
|
||||
|
||||
#ifndef CONF_DEFAULT_HARDWARE_VERSION
|
||||
#define CONF_DEFAULT_HARDWARE_VERSION "0.1"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CONF_DEFAULT_MAX_DISCOVERY_INTERVAL
|
||||
#define CONF_DEFAULT_MAX_DISCOVERY_INTERVAL CAPWAP_MAX_DISCOVERY_INTERVAL
|
||||
|
@ -27,9 +27,9 @@ struct wtpinfo * get_wtpinfo()
|
||||
}
|
||||
*/
|
||||
wtpinfo->serial_no="123456789";
|
||||
wtpinfo->vendor_id=909090;
|
||||
wtpinfo->vendor_id=conf_vendor_id;
|
||||
|
||||
wtpinfo->model_no="WNDR 3700";
|
||||
wtpinfo->model_no=conf_model_no;
|
||||
|
||||
wtpinfo->bootloader_version="";
|
||||
wtpinfo->bootloader_vendor_id=CW_VENDOR_ID_CISCO;
|
||||
@ -37,7 +37,7 @@ struct wtpinfo * get_wtpinfo()
|
||||
wtpinfo->hardware_version="\0\0";
|
||||
wtpinfo->hardware_vendor_id=CW_VENDOR_ID_CISCO;
|
||||
|
||||
wtpinfo->software_version="2.23(UJA.6)";
|
||||
wtpinfo->software_version=conf_software_version;
|
||||
wtpinfo->software_vendor_id=CW_VENDOR_ID_CISCO;
|
||||
|
||||
wtpinfo->macaddress=conf_macaddress;
|
||||
|
@ -89,15 +89,21 @@ int do_connect(void *priv,void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#include "capwap/bstr.h"
|
||||
|
||||
int wtp_main(const char *ad)
|
||||
{
|
||||
|
||||
|
||||
|
||||
cw_dbg_opt_level = DBG_DTLS | DBG_CW_INFO | DBG_ALL;
|
||||
gr();
|
||||
exit(0);
|
||||
// gr();
|
||||
// exit(0);
|
||||
|
||||
wtpconf_preinit();
|
||||
|
||||
if (!read_config("./wtpconf")){
|
||||
if (!read_config("./wtp_uci.conf")){
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -108,11 +114,14 @@ int wtp_main(const char *ad)
|
||||
|
||||
// cw_log_debug_level=6; //conf_debug_level;
|
||||
|
||||
conf_dtls_psk="Tube";
|
||||
// conf_dtls_psk=0;
|
||||
// conf_dtls_psk="Tube";
|
||||
// conf_sslkeyfilename="../../ssl/wtp.key";
|
||||
// conf_sslcertfilename="../../ssl/wtp.crt";
|
||||
// conf_sslkeypass="7u83";
|
||||
// conf_dtls_psk=0;
|
||||
|
||||
// conf_sslkeyfilename="../../ssl/ac_cisco.key";
|
||||
// conf_sslcertfilename="../../ssl/ac_cisco.pem";
|
||||
conf_sslkeypass="Tube";
|
||||
|
||||
|
||||
|
||||
|
@ -11,5 +11,17 @@ config 'wtp'
|
||||
|
||||
# Do MTU discovery (means append mtu discovery
|
||||
# padding msg element when sendig discovery requests)
|
||||
option mtu_discovery 1
|
||||
option mtu_discovery 1
|
||||
|
||||
# SSL certificate and key
|
||||
# (default is empty, you have to specify one)
|
||||
option ssl_cert
|
||||
option ssl_key
|
||||
|
||||
# vendor id
|
||||
# set the vendor id as integer value
|
||||
# default is gnu
|
||||
option vendor_id
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user