diff --git a/src/ac/Makefile b/src/ac/Makefile index 7b159270..53bfbe2b 100644 --- a/src/ac/Makefile +++ b/src/ac/Makefile @@ -80,7 +80,7 @@ all: $(AC_NAME) $(AC_NAME): $(AC_OBJS) # $(CC) $(AC_OBJS) ../mod/modload_ac.o -o $(AC_NAME) $(LDFLAGS) $(LIBS) - $(CC) $(AC_OBJS) -v -o $(AC_NAME) $(LDFLAGS) $(LIBS) + $(CC) $(AC_OBJS) -o $(AC_NAME) $(LDFLAGS) $(LIBS) clean: diff --git a/src/cw/Makefile b/src/cw/Makefile index 8e424f62..f6a71c52 100644 --- a/src/cw/Makefile +++ b/src/cw/Makefile @@ -12,6 +12,31 @@ DNAME := $(LIBARCHDIR)/libcw.so LDFLAGS+=-g -D_REENTRANT -L/usr/local/lib +LIBS= + +ifeq ($(WITH_OPENSSL),1) +CFLAGS+=$(OPENSSL_CFLAGS) +CFLAGS+=-DWITH_OPENSSL +DTLSOBJS += dtls_openssl.o \ + dtls_openssl_accept.o \ + dtls_openssl_connect.o \ + dtls_openssl_get_cipher.o \ + dtls_openssl_bio.o +LIBS+=-lssl +endif + +ifeq ($(WITH_GNUTLS),1) +CFLAGS+=$(GNUTLS_CFLAGS) +CFLAGS+=-DWITH_GNUTLS +DTLSOBJS+= dtls_gnutls.o \ + dtls_gnutls_accept.o \ + dtls_gnutls_connect.o \ + dtls_gnutls_bio.o \ + dtls_gnutls_get_cipher.o \ + dtls_gnutls_get_peers_cert.o +LIBS+=-lgnutls +endif + SRC=$(wildcard *.c) OBJS=$(patsubst %.c,%.o,$(SRC)) diff --git a/src/cw/conn_prepare_configuration_update_request.c b/src/cw/conn_prepare_configuration_update_request.c deleted file mode 100644 index 768b646d..00000000 --- a/src/cw/conn_prepare_configuration_update_request.c +++ /dev/null @@ -1,12 +0,0 @@ - - -#include "conn.h" -#include "capwap.h" - - -void conn_prepare_configuration_update_request(struct conn * conn) -{ - struct cwmsg * cwmsg = &conn->req_msg; - uint8_t * buffer = conn->req_buffer; - cwmsg_init(cwmsg,buffer,CW_MSG_CONFIGURATION_UPDATE_REQUEST,conn_get_next_seqnum(conn),0); -} diff --git a/src/cw/conn_prepare_request.c b/src/cw/conn_prepare_request.c deleted file mode 100644 index 165abeb0..00000000 --- a/src/cw/conn_prepare_request.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "conn.h" -#include "capwap.h" - -void conn_prepare_request(struct conn * conn, int type) -{ - struct cwmsg * cwmsg = &conn->req_msg; - uint8_t * buffer = conn->req_buffer; - cwmsg_init(cwmsg,buffer,type,conn_get_next_seqnum(conn),0); - cwmsg->capwap_mode=conn->capwap_mode; -} diff --git a/src/cw/cw_out_init_session_id.c b/src/cw/cw_out_init_session_id.c deleted file mode 100644 index 974a6b8f..00000000 --- a/src/cw/cw_out_init_session_id.c +++ /dev/null @@ -1,24 +0,0 @@ - - -#include "capwap.h" -#include "capwap_items.h" - -#include "log.h" -#include "rand.h" - -int cw_out_init_session_id(struct conn *conn,struct cw_action_out * a,uint8_t *dst) -{ - printf("Vendor ID: %d\n", a->vendor_id); - uint8_t session_id[16]; - int l = cw_rand(session_id,16); - if ( l!=16 ) { - cw_log(LOG_ERR,"Can't init session ID."); - return -1; - } - - - cw_itemstore_set_bstrn(conn->local,CW_ITEM_SESSION_ID,session_id,16); - return 0; - -} - diff --git a/src/cw/cw_read_image_data_request.c b/src/cw/cw_read_image_data_request.c deleted file mode 100644 index e7deeaf4..00000000 --- a/src/cw/cw_read_image_data_request.c +++ /dev/null @@ -1,76 +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 . - -*/ - -/** - *@file - *@brief Image Data handling - */ -#include - -#include "capwap.h" - -#include "log.h" -#include "dbg.h" -#include "cw_util.h" - -#include - -int cw_readelem_image_identifier(struct cwimage_data *data, int type,uint8_t *msgelem, int len) -{ - if (type != CW_ELEM_IMAGE_IDENTIFIER) - return 0; - - data->vendor_id = ntohl(*((uint32_t*)msgelem)); - - if (len >= 1024) { - cw_dbg(DBG_MSG_ERR,"Image identifier too long (>1024), truncating"); - len = 1024; - } - - if ( data->identifier ){ - memcpy(data->identifier,msgelem,len); - *(data->identifier+len)=0; - } - - return 1; -} - -static int imgdata_request(void * ptr,int type,uint8_t* msgelem,int len) -{ - cw_dbg_msgelem(CW_MSG_IMAGE_DATA_REQUEST, type, msgelem, len); - - - //cw_dbg(DBG_ALL,"Reading image data req msgelem, type=%d - %s ,len=%d\n",type,cw_strelem(type),len); - - if (cw_readelem_image_identifier(ptr,type,msgelem,len)) - return 1; - - return 0; -} - - -/** - * Read an image data request message - */ -void cw_read_image_data_request(struct cwimage_data *data, uint8_t * msg, int len) -{ - cw_foreach_msgelem(msg,len,imgdata_request,data); -} - - - diff --git a/src/cw/cw_send_echo_response.c b/src/cw/cw_send_echo_response.c index d5a18adc..f88645e6 100644 --- a/src/cw/cw_send_echo_response.c +++ b/src/cw/cw_send_echo_response.c @@ -33,8 +33,8 @@ int cw_send_echo_response(struct conn * conn,int seqnum,struct radioinfo * radioinfo) { struct cwmsg * cwmsg = &conn->resp_msg; - cwmsg_init(cwmsg,conn->resp_buffer,CW_MSG_ECHO_RESPONSE,seqnum,radioinfo); +// cwmsg_init(cwmsg,conn->resp_buffer,CW_MSG_ECHO_RESPONSE,seqnum,radioinfo); - conn_send_response(conn,cwmsg,seqnum); +// conn_send_response(conn,cwmsg,seqnum); return 1; } diff --git a/src/cw/cwmsg_addelem_vendor_cisco_mwar_addr.c b/src/cw/cwmsg_addelem_vendor_cisco_mwar_addr.c deleted file mode 100644 index 6bacdc36..00000000 --- a/src/cw/cwmsg_addelem_vendor_cisco_mwar_addr.c +++ /dev/null @@ -1,58 +0,0 @@ -#include -#include -#include - -#include - - -#include "capwap.h" -#include "capwap_cisco.h" - -#include "cwmsg.h" -#include "conn.h" - - -#include "sock.h" - -void cwmsg_addelem_vendor_cisco_mwar_addr(struct cwmsg *msg, struct conn *conn) -{ - uint8_t data [7]; - - switch (((struct sockaddr*)&conn->addr)->sa_family){ - case AF_INET: - { - data[0]=2; /* mwar type */ - data[5]=0; - data[6]=0; - -printf("Adding mwar addr %s\n",sock_addr2str(&conn->addr)); - - struct sockaddr_in * sain = (struct sockaddr_in*)&conn->addr; - memcpy(data+1,(uint8_t*)&sain->sin_addr,4); - cwmsg_addelem_vendor_specific_payload(msg, CW_VENDOR_ID_CISCO, - CW_CISCO_MWAR_ADDR, - data,7); - - - break; - } - - -/* case AF_INET6: - { - int id; - if (cw_mode == CWMODE_CISCO) - id = CWMSGELEM_WTP_IPV6_IP_ADDR; - else - id = CWMSGELEM_CAPWAP_LOCAL_IPV6_ADDRESS; - struct sockaddr_in6 * sain = (struct sockaddr_in6*)&a; - return cwmsg_addelem(msg,id,(uint8_t*)&sain->sin6_addr,16); - } - break; -*/ - } - - - - -}