Improved discriptor sub-element handling and debugging.
FossilOrigin-Name: 1be3acc6e8fe2f1b579bf1d84589aca685effc8c551372b536488f66ce0e0d84
This commit is contained in:
parent
f8891001d6
commit
f2d477ec97
@ -65,7 +65,8 @@ UTILOBJS= \
|
||||
send.o \
|
||||
cw_read_wtp_descriptor.o \
|
||||
cw_read_wtp_descriptor_7.o \
|
||||
cw_read_wtp_descriptor_versions.o
|
||||
cw_read_wtp_descriptor_versions.o \
|
||||
cw_read_descriptor_subelems.o
|
||||
|
||||
MAVLOBJS= \
|
||||
mavl_del.o \
|
||||
@ -152,6 +153,7 @@ CAPWAPOBJS= \
|
||||
cw_in_cisco_image_identifier.o\
|
||||
cw_out_radio_operational_state.o\
|
||||
cw_in_ac_descriptor.o\
|
||||
cw_read_ac_descriptor.o\
|
||||
cw_out_capwap_local_ip_address.o\
|
||||
cw_out_wtp_ip_address.o\
|
||||
cw_out_capwap_control_ip_addr_list.o \
|
||||
|
15
src/cw/cw.h
15
src/cw/cw.h
@ -400,13 +400,24 @@ static inline int cw_put_ac_status(uint8_t * dst, struct cw_ac_status *s)
|
||||
}
|
||||
|
||||
|
||||
struct cw_descriptor_subelem_def {
|
||||
int vendor_id;
|
||||
int type;
|
||||
const char *item_id;
|
||||
int maxlen;
|
||||
int mand;
|
||||
};
|
||||
|
||||
|
||||
extern int cw_read_descriptor_subelems(mbag_t store, uint8_t * data, int len, struct cw_descriptor_subelem_def *elems);
|
||||
|
||||
extern int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn,
|
||||
struct cw_action_in *a, uint8_t * data, int len);
|
||||
struct cw_action_in *a, uint8_t * data, int len,struct cw_descriptor_subelem_def *allowed);
|
||||
|
||||
extern int cw_read_wtp_descriptor_7(mbag_t mbag, struct conn *conn,
|
||||
struct cw_action_in *a, uint8_t * data, int len);
|
||||
struct cw_action_in *a, uint8_t * data, int len,struct cw_descriptor_subelem_def *allowed);
|
||||
|
||||
extern int cw_read_ac_descriptor(mbag_t store, uint8_t *data, int len, struct cw_descriptor_subelem_def *allowed);
|
||||
|
||||
extern int cw_read_wtp_descriptor_versions(mbag_t mbag, uint8_t * data, int len);
|
||||
|
||||
|
@ -1,130 +1,42 @@
|
||||
|
||||
#include "cw.h"
|
||||
#include "capwap_items.h"
|
||||
#include "dbg.h"
|
||||
#include "mbag.h"
|
||||
|
||||
/*
|
||||
static int read_subelem_cisco(struct ac_info* acinfo,int subtype,uint8_t * elem, int len)
|
||||
|
||||
int cw_in_ac_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||
int len, struct sockaddr *from)
|
||||
{
|
||||
switch (subtype) {
|
||||
case 0:
|
||||
bstr_replace(&acinfo->hardware_version,bstr_create(elem,len));
|
||||
break;
|
||||
case 1:
|
||||
bstr_replace(&acinfo->software_version,bstr_create(elem,len));
|
||||
break;
|
||||
|
||||
default:
|
||||
//printf("What? %d\n",subtype);
|
||||
break;
|
||||
return cw_read_ac_descriptor(conn->config,data,len,NULL);
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
static int read_subelem(struct ac_info* acinfo,int subtype,uint8_t *elem, int len)
|
||||
{
|
||||
switch (subtype){
|
||||
case 0:
|
||||
case 4:
|
||||
bstr_replace(&acinfo->hardware_version,bstr_create(elem,len));
|
||||
break;
|
||||
case 1:
|
||||
case 5:
|
||||
bstr_replace(&acinfo->software_version,bstr_create(elem,len));
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static int read_subeelms(struct conn *conn,struct cw_action_in * a,uint8_t *data,int len,struct sockaddr *from)
|
||||
{
|
||||
int sub=12;
|
||||
//int sublen;
|
||||
|
||||
|
||||
while (sub<len){
|
||||
if (len-sub<8)
|
||||
return 0;
|
||||
|
||||
|
||||
uint32_t vendor_id = cw_get_dword(data+sub);
|
||||
int sublen = cw_get_word(data+sub+6);
|
||||
int subtype = cw_get_word(data+sub+4);
|
||||
//printf("substart : %d\n",sub);
|
||||
|
||||
bstrv_t vstr=NULL;
|
||||
switch (subtype){
|
||||
case 0:
|
||||
case 4:
|
||||
/* hardware version */
|
||||
vstr = mbag_set_bstrv(conn->incomming,CW_ITEM_AC_HARDWARE_VERSION,
|
||||
vendor_id,data+sub+8,sublen);
|
||||
break;
|
||||
case 1:
|
||||
case 5:
|
||||
/* software version */
|
||||
vstr = mbag_set_bstrv(conn->incomming,CW_ITEM_AC_SOFTWARE_VERSION,
|
||||
vendor_id,data+sub+8,sublen);
|
||||
break;
|
||||
}
|
||||
|
||||
cw_dbg_version_subelem(DBG_SUBELEM,"AC Descriptor", subtype, vstr);
|
||||
|
||||
|
||||
if (sub+sublen>len)
|
||||
return -1;
|
||||
|
||||
sub+=sublen+8;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int cw_in_ac_descriptor(struct conn *conn,struct cw_action_in * a,uint8_t *data,int len,struct sockaddr *from)
|
||||
{
|
||||
struct cw_ac_status *status = malloc(sizeof(struct cw_ac_status));
|
||||
if (!status)
|
||||
return 0;
|
||||
|
||||
status->stations = cw_get_word(data);
|
||||
status->limit = cw_get_word(data+2);
|
||||
status->active_wtps=cw_get_word(data+4);
|
||||
status->max_wtps=cw_get_word(data+6);
|
||||
status->security=cw_get_byte(data+8);
|
||||
status->rmac_field=cw_get_byte(data+9);
|
||||
status->dtls_policy=cw_get_byte(data+11);
|
||||
status->limit = cw_get_word(data + 2);
|
||||
status->active_wtps = cw_get_word(data + 4);
|
||||
status->max_wtps = cw_get_word(data + 6);
|
||||
status->security = cw_get_byte(data + 8);
|
||||
status->rmac_field = cw_get_byte(data + 9);
|
||||
status->dtls_policy = cw_get_byte(data + 11);
|
||||
|
||||
cw_dbg(DBG_SUBELEM,"AC Desriptor: WTPs:%d/%d, Stations:%d/%d, Security:%d, Rmac:%d, DTLS-Policy:%d",
|
||||
status->active_wtps,status->max_wtps,
|
||||
status->stations,status->limit,
|
||||
status->security,
|
||||
status->rmac_field,
|
||||
status->dtls_policy);
|
||||
cw_dbg(DBG_SUBELEM,
|
||||
"AC Descriptor: WTPs:%d/%d, Stations:%d/%d, Security:%d, Rmac:%d, DTLS-Policy:%d",
|
||||
status->active_wtps, status->max_wtps, status->stations, status->limit,
|
||||
status->security, status->rmac_field, status->dtls_policy);
|
||||
|
||||
|
||||
mbag_set_ptr(conn->incomming,CW_ITEM_AC_STATUS,status);
|
||||
mbag_set_ptr(conn->incomming, CW_ITEM_AC_STATUS, status);
|
||||
|
||||
read_subeelms(conn,a,data,len,from);
|
||||
static struct cw_descriptor_subelem_def allowed[] = {
|
||||
{0,CW_SUBELEM_AC_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,1},
|
||||
{0,CW_SUBELEM_AC_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,1},
|
||||
{0,0, NULL,0, 0}
|
||||
};
|
||||
|
||||
cw_read_descriptor_subelems(conn->config, data + 12, len - 12, allowed);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,9 @@
|
||||
|
||||
|
||||
int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn,
|
||||
struct cw_action_in *a, uint8_t * data, int len)
|
||||
struct cw_action_in *a, uint8_t * data, int len,struct cw_descriptor_subelem_def *allowed)
|
||||
{
|
||||
|
||||
|
||||
mbag_set_byte(mbag, CW_ITEM_WTP_MAX_RADIOS, cw_get_byte(data));
|
||||
mbag_set_byte(mbag, CW_ITEM_WTP_RADIOS_IN_USE, cw_get_byte(data + 1));
|
||||
|
||||
@ -33,6 +32,17 @@ int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn,
|
||||
pos += 3;
|
||||
}
|
||||
|
||||
return cw_read_wtp_descriptor_versions(mbag, data + pos, len - pos);
|
||||
static struct cw_descriptor_subelem_def allowed_default[] = {
|
||||
{0,CW_SUBELEM_WTP_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,1},
|
||||
{0,CW_SUBELEM_WTP_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,1},
|
||||
{0,CW_SUBELEM_WTP_BOOTLOADER_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,1},
|
||||
{0,CW_SUBELEM_WTP_OTHERSOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,0},
|
||||
{0,0, NULL, 0,0}
|
||||
};
|
||||
|
||||
if (!allowed) {
|
||||
allowed=allowed_default;
|
||||
}
|
||||
|
||||
return cw_read_descriptor_subelems(conn->incomming, data + pos, len - pos, allowed);
|
||||
}
|
||||
|
@ -7,7 +7,8 @@
|
||||
* Read WTP Descriptor in Cisco-Style (Draft 7)
|
||||
*/
|
||||
int cw_read_wtp_descriptor_7(mbag_t mbag, struct conn *conn,
|
||||
struct cw_action_in *a, uint8_t * data, int len)
|
||||
struct cw_action_in *a, uint8_t * data, int len,
|
||||
struct cw_descriptor_subelem_def *allowed)
|
||||
{
|
||||
|
||||
mbag_set_byte(mbag, CW_ITEM_WTP_MAX_RADIOS, cw_get_byte(data));
|
||||
@ -20,5 +21,17 @@ int cw_read_wtp_descriptor_7(mbag_t mbag, struct conn *conn,
|
||||
//cw_get_word(data + pos + 2);
|
||||
pos += 2;
|
||||
|
||||
return cw_read_wtp_descriptor_versions(mbag, data + pos, len - pos);
|
||||
|
||||
static struct cw_descriptor_subelem_def allowed_default[] = {
|
||||
{-1,CW_SUBELEM_WTP_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,0},
|
||||
{-1,CW_SUBELEM_WTP_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024.0},
|
||||
{-1,CW_SUBELEM_WTP_BOOTLOADER_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,0},
|
||||
{-1,CW_SUBELEM_WTP_OTHERSOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,0},
|
||||
{0,0, NULL, 0,0}
|
||||
};
|
||||
|
||||
if (!allowed)
|
||||
allowed=allowed_default;
|
||||
|
||||
return cw_read_descriptor_subelems(mbag, data + pos, len - pos, allowed);
|
||||
}
|
||||
|
@ -4,12 +4,12 @@ OBJS=\
|
||||
mod_capwap_wtp.o\
|
||||
capwap_actions_ac.o \
|
||||
capwap_actions_wtp.o \
|
||||
capwap_in_wtp_descriptor.o \
|
||||
capwap_in_wtp_board_data.o \
|
||||
capwap_out_wtp_descriptor.o \
|
||||
capwap_out_ac_descriptor.o \
|
||||
capwap_out_get_session_id.o \
|
||||
capwap_out_get_idle_timeout.o
|
||||
capwap_out_get_idle_timeout.o \
|
||||
capwap_out_wtp_descriptor.o \
|
||||
capwap_in_wtp_descriptor.o
|
||||
|
||||
|
||||
NAME=libcapwap.a
|
||||
|
@ -1,155 +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 Definitions for CAPWAP
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __CAPWAPMSG_H
|
||||
#define __CAPWAPMSG_H
|
||||
|
||||
/**
|
||||
*@addtogroup CAPWAPConstants
|
||||
*@{
|
||||
*/
|
||||
|
||||
/**
|
||||
* CAPWAP message types as defined in RFC 5416
|
||||
*/
|
||||
enum cw_message_types{
|
||||
|
||||
/**Discovery Request = 1*/
|
||||
CW_MSG_DISCOVERY_REQUEST = 1,
|
||||
/** Discovery Response = 2 */
|
||||
CW_MSG_DISCOVERY_RESPONSE = 2,
|
||||
/** Join Request = 3 */
|
||||
CW_MSG_JOIN_REQUEST = 3,
|
||||
/** Join Response = 4 */
|
||||
CW_MSG_JOIN_RESPONSE = 4,
|
||||
/** Config. Status Request = 5*/
|
||||
CW_MSG_CONFIGURATION_STATUS_REQUEST = 5,
|
||||
/** Config. Status Response = 6 */
|
||||
CW_MSG_CONFIGURATION_STATUS_RESPONSE = 6,
|
||||
|
||||
CW_MSG_CONFIGURATION_UPDATE_REQUEST = 7,
|
||||
CW_MSG_CONFIGURATION_UPDATE_RESPONSE = 8,
|
||||
|
||||
CW_MSG_WTP_EVENT_REQUEST = 9,
|
||||
CW_MSG_WTP_EVENT_RESPONSE = 10,
|
||||
|
||||
CW_MSG_CHANGE_STATE_EVENT_REQUEST = 11,
|
||||
CW_MSG_CHANGE_STATE_EVENT_RESPONSE = 12,
|
||||
|
||||
CW_MSG_ECHO_REQUEST = 13,
|
||||
CW_MSG_ECHO_RESPONSE = 14,
|
||||
|
||||
CW_MSG_IMAGE_DATA_REQUEST = 15,
|
||||
CW_MSG_IMAGE_DATA_RESPONSE = 16,
|
||||
|
||||
CW_MSG_RESET_REQUEST = 17,
|
||||
CW_MSG_RESET_RESPONSE = 18,
|
||||
|
||||
CW_MSG_PRIMARY_DISCOVERY_REQUEST = 19,
|
||||
CW_MSG_PRIMARY_DISCOVERY_RESPONSE = 20,
|
||||
|
||||
CW_MSG_DATA_TRANSFER_REQUEST = 21,
|
||||
CW_MSG_DATA_TRANSFER_RESPONSE = 22,
|
||||
|
||||
CW_MSG_CLEAR_CONFIGURATION_REQUEST = 23,
|
||||
CW_MSG_CLEAR_CONFIGURATION_RESPONSE = 24,
|
||||
|
||||
CW_STATION_CONFIGURATION_REQUEST = 25,
|
||||
CW_STATION_CONFIGURATION_RESPONSE = 26,
|
||||
|
||||
CW_MSG_MAXMSG = 26
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* CAPWAP message elements as defined in RFC 5415
|
||||
*/
|
||||
|
||||
|
||||
#define CW_ELEM_AC_DESCRIPTOR 1
|
||||
#define CW_ELEM_AC_IPV4_LIST 2
|
||||
#define CW_ELEM_AC_IPV6_LIST 3
|
||||
#define CW_ELEM_AC_NAME 4
|
||||
#define CW_ELEM_AC_NAME_WITH_PRIORITY 5
|
||||
#define CW_ELEM_AC_NAME_WITH_INDEX CW_ELEM_AC_NAME_WITH_PRIORITY /* Draft 7 naming */
|
||||
#define CW_ELEM_AC_TIMESTAMP 6
|
||||
#define CW_ELEM_ADD_MAC_ACL_ENTRY 7
|
||||
#define CW_ELEM_ADD_STATION 8
|
||||
#define CW_ELEM_RESERVED_9 9
|
||||
#define CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS 10
|
||||
#define CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS 11
|
||||
#define CW_ELEM_CAPWAP_LOCAL_IPV4_ADDRESS 30
|
||||
#define CW_ELEM_CAPWAP_LOCAL_IPV6_ADDRESS 50
|
||||
#define CW_ELEM_CAPWAP_TIMERS 12
|
||||
#define CW_ELEM_CAPWAP_TRANSPORT_PROTOCOL 51 /* not in draft 7 */
|
||||
#define CW_ELEM_DATA_TRANSFER_DATA 13
|
||||
#define CW_ELEM_DATA_TRANSFER_MODE 14
|
||||
#define CW_ELEM_DECRYPTION_ERROR_REPORT 15
|
||||
#define CW_ELEM_DECRYPTION_ERROR_REPORT_PERIOD 16
|
||||
#define CW_ELEM_DELETE_MAC_ACL_ENTRY 17
|
||||
#define CW_ELEM_DELETE_STATION 18
|
||||
#define CW_ELEM_RESERVED_19 19
|
||||
#define CW_ELEM_DISCOVERY_TYPE 20
|
||||
#define CW_ELEM_DUPLICATE_IPV4_ADDRESS 21
|
||||
#define CW_ELEM_DUPLICATE_IPV6_ADRESS 22
|
||||
#define CWMSGELEM_ECN_SUPPORT 53
|
||||
#define CW_ELEM_IDLE_TIMEOUT 23
|
||||
#define CW_ELEM_IMAGE_DATA 24
|
||||
#define CW_ELEM_IMAGE_IDENTIFIER 25
|
||||
#define CW_ELEM_IMAGE_INFORMATION 26
|
||||
#define CW_ELEM_INITIATE_DOWNLOAD 27
|
||||
#define CW_ELEM_LOCATION_DATA 28
|
||||
#define CW_ELEM_MAXIMUM_MESSAGE_LENGTH 29
|
||||
#define CWMSGELEM_MTU_DISCOVERY_PADDING 52
|
||||
#define CW_ELEM_RADIO_ADMINISTRATIVE_STATE 31
|
||||
#define CW_ELEM_RADIO_OPERATIONAL_STATE 32
|
||||
#define CW_ELEM_RESULT_CODE 33
|
||||
#define CW_ELEM_RETURNED_MESSAGE_ELEMENT 34
|
||||
#define CW_ELEM_SESSION_ID 35
|
||||
#define CW_ELEM_STATISTICS_TIMER 36
|
||||
#define CW_ELEM_VENDOR_SPECIFIC_PAYLOAD 37
|
||||
#define CW_ELEM_WTP_BOARD_DATA 38
|
||||
#define CW_ELEM_WTP_DESCRIPTOR 39
|
||||
#define CW_ELEM_WTP_FALLBACK 40
|
||||
#define CW_ELEM_WTP_FRAME_TUNNEL_MODE 41
|
||||
#define CW_ELEM_RESERVED_42 42
|
||||
#define CW_ELEM_RESERVED_43 43
|
||||
#define CW_ELEM_WTP_MAC_TYPE 44
|
||||
#define CW_ELEM_WTP_NAME 45
|
||||
#define CW_ELEM_RESERVED_46 46
|
||||
#define CW_ELEM_WTP_RADIO_STATISTICS 47
|
||||
#define CW_ELEM_WTP_REBOOT_STATISTICS 48
|
||||
#define CW_ELEM_WTP_STATIC_IP_ADDRESS_INFORMATION 49
|
||||
#define CW_ELEM_WTP_STATIC_IP_ADDR_INFO 49
|
||||
|
||||
|
||||
/* Cisco's CAPWAP definitions (CAPWAP draft 7) */
|
||||
#define CW_ELEM_WTP_IPV4_IP_ADDRESS 42
|
||||
#define CW_ELEM_WTP_IPV6_IP_ADDRESS 43
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -27,7 +27,7 @@ int capwap_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t
|
||||
|
||||
mbag_t mbag = conn->incomming;
|
||||
|
||||
int rc =cw_read_wtp_descriptor(mbag, conn, a, data, len);
|
||||
int rc =cw_read_wtp_descriptor(mbag, conn, a, data, len, NULL);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,8 @@ OBJS=\
|
||||
cisco_out_ap_timesync.o \
|
||||
cisco_in_wtp_descriptor.o \
|
||||
cisco_out_ac_descriptor.o \
|
||||
cisco_out_wtp_descriptor.o
|
||||
cisco_out_wtp_descriptor.o \
|
||||
cisco_in_ac_descriptor.o\
|
||||
|
||||
|
||||
NAME=libcisco.a
|
||||
|
@ -11,5 +11,7 @@ extern int cisco_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,ui
|
||||
extern int cisco_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, uint8_t * dst);
|
||||
|
||||
|
||||
extern int cisco_in_ac_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||
int len, struct sockaddr *from);
|
||||
|
||||
#endif
|
||||
|
@ -195,8 +195,28 @@ static cw_action_out_t actions_out[]={
|
||||
.out = cisco_out_ac_descriptor,
|
||||
.mand = 1
|
||||
}
|
||||
,
|
||||
|
||||
|
||||
/* AC Descriptor - Join Response */
|
||||
{
|
||||
.msg_id = CW_MSG_JOIN_RESPONSE,
|
||||
.item_id = CW_ITEM_AC_DESCRIPTOR,
|
||||
.elem_id = CW_ELEM_AC_DESCRIPTOR,
|
||||
.out = cisco_out_ac_descriptor,
|
||||
.mand = 1
|
||||
}
|
||||
,
|
||||
|
||||
|
||||
|
||||
/* ECN Support - Join Response */
|
||||
{
|
||||
.msg_id = CW_MSG_JOIN_RESPONSE,
|
||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
||||
.item_id = CW_ITEM_ECN_SUPPORT
|
||||
}
|
||||
|
||||
|
||||
|
||||
,
|
||||
|
@ -32,8 +32,22 @@
|
||||
|
||||
static cw_action_in_t actions_in[] = {
|
||||
|
||||
/* AC Descriptor - Discovery Response */
|
||||
{
|
||||
.capwap_state = CW_STATE_DISCOVERY,
|
||||
.msg_id = CW_MSG_DISCOVERY_RESPONSE,
|
||||
.elem_id = CW_ELEM_AC_DESCRIPTOR,
|
||||
.item_id = CW_ITEM_AC_DESCRIPTOR,
|
||||
.start = cisco_in_ac_descriptor,
|
||||
.min_len = 12,
|
||||
.max_len = 8192,
|
||||
.mand = 1
|
||||
}
|
||||
,
|
||||
|
||||
/* ECN Support - Join Request */
|
||||
|
||||
|
||||
/* ECN Support - Join Response */
|
||||
{
|
||||
.capwap_state = CW_STATE_JOIN,
|
||||
.msg_id = CW_MSG_JOIN_RESPONSE,
|
||||
@ -46,6 +60,19 @@ static cw_action_in_t actions_in[] = {
|
||||
}
|
||||
,
|
||||
|
||||
/* AC Descriptor - Join Response */
|
||||
{
|
||||
.capwap_state = CW_STATE_JOIN,
|
||||
.msg_id = CW_MSG_JOIN_RESPONSE,
|
||||
.elem_id = CW_ELEM_AC_DESCRIPTOR,
|
||||
.item_id = CW_ITEM_AC_DESCRIPTOR,
|
||||
.start = cisco_in_ac_descriptor,
|
||||
.min_len = 12,
|
||||
.max_len = 8192,
|
||||
.mand = 1
|
||||
}
|
||||
,
|
||||
|
||||
|
||||
|
||||
/* End of list */
|
||||
|
@ -18,16 +18,24 @@
|
||||
|
||||
|
||||
#include "cw/cw.h"
|
||||
#include "cw/vendors.h"
|
||||
#include "cw/capwap_items.h"
|
||||
|
||||
|
||||
int cisco_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||
int len, struct sockaddr *from)
|
||||
{
|
||||
|
||||
mbag_t mbag = conn->incomming;
|
||||
static struct cw_descriptor_subelem_def allowed[] = {
|
||||
{CW_VENDOR_ID_CISCO,CW_SUBELEM_WTP_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,0},
|
||||
{CW_VENDOR_ID_CISCO,CW_SUBELEM_WTP_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024.0},
|
||||
{CW_VENDOR_ID_CISCO,CW_SUBELEM_WTP_BOOTLOADER_VERSION, CW_ITEM_WTP_BOOTLOADER_VERSION, 1024.0},
|
||||
{CW_VENDOR_ID_CISCO,CW_SUBELEM_WTP_OTHERSOFTWARE_VERSION, "other", 1024.0},
|
||||
{0,0, NULL, 0,0}
|
||||
};
|
||||
|
||||
int rc =cw_read_wtp_descriptor_7(mbag, conn, a, data, len);
|
||||
return rc;
|
||||
|
||||
return cw_read_wtp_descriptor_7(conn->incomming, conn, a, data, len, allowed);
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,8 +21,12 @@ int cisco_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *
|
||||
d+=cw_put_ac_status(d ,(struct cw_ac_status*)(i->data));
|
||||
|
||||
|
||||
// i = mbag_get(conn->local,CW_ITEM_AC_SOFTWARE_VERSION);
|
||||
/* Send back the same software as the WTP has,
|
||||
otherwise the AP wants us to send an image */
|
||||
|
||||
i = mbag_get(conn->incomming,CW_ITEM_WTP_SOFTWARE_VERSION);
|
||||
|
||||
//i = mbag_get(conn->local,CW_ITEM_AC_SOFTWARE_VERSION);
|
||||
if ( i ) {
|
||||
d += cw_put_version(d,1,i->data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user