Not needed anymore.
FossilOrigin-Name: afa15700801e9515d0f87ec5dce5baa332db845c4835e567c58a1e1f90813e05
This commit is contained in:
parent
182e460add
commit
098fad2c60
@ -1,81 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "log.h"
|
|
||||||
#include "capwap.h"
|
|
||||||
#include "capwap_cisco.h"
|
|
||||||
#include "dbg.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int cw_format_vendor(char *dst, uint32_t vendor_id, int elem_id, const uint8_t * elem_data)
|
|
||||||
{
|
|
||||||
switch (vendor_id) {
|
|
||||||
case CW_VENDOR_ID_CISCO:
|
|
||||||
{
|
|
||||||
sprintf(dst, "%d - %s", elem_id,
|
|
||||||
cw_cisco_id_to_str(elem_id));
|
|
||||||
|
|
||||||
/* dive into LWAPP vendor specific decoding */
|
|
||||||
/*
|
|
||||||
if (elem_id == CW_CISCO_SPAM_VENDOR_SPECIFIC) {
|
|
||||||
uint32_t lw_elem_id = lw_get_word(elem_data + 4 + 6);
|
|
||||||
char b[256];
|
|
||||||
sprintf(b, "\n\t LWAPP Cisco Specific: %d - %s",
|
|
||||||
lw_elem_id, lw_cisco_id_to_str(lw_elem_id));
|
|
||||||
strcat(dst, b);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* print debug info for message elements
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
void cw_dbg_elem_(struct conn * conn, int msg, int msgelem, const uint8_t * msgbuf, int len)
|
|
||||||
{
|
|
||||||
if (!cw_dbg_is_level(DBG_ELEM))
|
|
||||||
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, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
@ -1,35 +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/>.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "capwap.h"
|
|
||||||
|
|
||||||
#include "cw_log.h"
|
|
||||||
|
|
||||||
int cw_readelem_result_code(uint32_t *result_code, int type, uint8_t * msgelem, int len)
|
|
||||||
{
|
|
||||||
if (type != CW_ELEM_RESULT_CODE)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (len!=4){
|
|
||||||
cw_dbg(DBG_CW_RFC,"Result code msg elem has wrong size, type=%d,len=%d",type,len);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
*result_code=ntohl(*((uint32_t*)msgelem));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
@ -1,101 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file
|
|
||||||
* @brief Implements cw_readelem_vendor_specific_payload
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
|
|
||||||
#include "capwap.h"
|
|
||||||
#include "lwapp.h"
|
|
||||||
|
|
||||||
#include "cw_log.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int cw_readelem_cisco_payload(void *data,int msgtype,int elem_id,uint8_t *msgelem, int len)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
switch (msgtype) {
|
|
||||||
case CW_MSG_CONFIGURATION_STATUS_REQUEST:
|
|
||||||
{
|
|
||||||
if (lw_readelem_wtp_board_data((struct wtpinfo*)data,elem_id,msgelem,len))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case CW_MSG_DISCOVERY_REQUEST:
|
|
||||||
{
|
|
||||||
struct wtpinfo * wtpinfo = (struct wtpinfo*)data;
|
|
||||||
if (lw_readelem_wtp_name(&wtpinfo->name,elem_id,msgelem,len))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
case CW_MSG_CONFIGURATION_STATUS_RESPONSE:
|
|
||||||
{
|
|
||||||
|
|
||||||
struct radioinfo ri;
|
|
||||||
//lw_read_elem_wtp_wlan_radio_
|
|
||||||
//cw_read
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read a CAPWAP Vendor Specific Payload message element.
|
|
||||||
* @param data pointer to data where the results can be stored
|
|
||||||
* @param msgtype type of message in which the element was found
|
|
||||||
* @param elemtype element type, must be CW_ELEM_VENDOR_PECIFIC_PAYLOAD
|
|
||||||
* @param msgelem pointer to message elemenet data
|
|
||||||
* @param len length of message element data
|
|
||||||
* @return 1 = successful read\n 0 = no vendor specific payload element
|
|
||||||
*/
|
|
||||||
|
|
||||||
int cw_readelem_vendor_specific_payload(void * data,int msgtype,int elemtype,uint8_t *msgelem, int len)
|
|
||||||
{
|
|
||||||
if (elemtype != CW_ELEM_VENDOR_SPECIFIC_PAYLOAD)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (len < 6){
|
|
||||||
cw_dbg(DBG_ERR,"Vendor specific payload msgelem too short, len < 6.");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t vendor_id = cw_get_dword(msgelem);
|
|
||||||
uint16_t elem_id = cw_get_word(msgelem+4);
|
|
||||||
int elem_len = len - 6;
|
|
||||||
|
|
||||||
switch (vendor_id) {
|
|
||||||
|
|
||||||
case CW_VENDOR_ID_CISCO:
|
|
||||||
return cw_readelem_cisco_payload(data,msgtype,elem_id,msgelem+6,elem_len);
|
|
||||||
default:
|
|
||||||
cw_dbg(DBG_ERR,"Can't read vendor specific payload. Vendor ID %d",vendor_id);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
@ -1,112 +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/>.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "capwap.h"
|
|
||||||
#include "wtpinfo.h"
|
|
||||||
|
|
||||||
#include "cw_util.h"
|
|
||||||
#include "cw_log.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int wtpinfo_readelem_wtp_descriptor_(struct wtpinfo * wtpinfo, int type, uint8_t *msgelem, int len, int cq)
|
|
||||||
{
|
|
||||||
if (type != CWMSGELEM_WTP_DESCRIPTOR)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (len<6)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
wtpinfo->max_radios=*msgelem;
|
|
||||||
wtpinfo->radios_in_use=*(msgelem+1);
|
|
||||||
|
|
||||||
int ncrypt = *(msgelem+2);
|
|
||||||
int i;
|
|
||||||
if (ncrypt == 0 ){
|
|
||||||
/* non-conform */
|
|
||||||
cw_dbg(DBG_CW_RFC,"Non-standard-conform WTP descriptor detected (See RFC 5415)");
|
|
||||||
if (!cq)
|
|
||||||
i=3;
|
|
||||||
else
|
|
||||||
i=4;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
i=ncrypt*3+3;
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
if (i+8>len)
|
|
||||||
{
|
|
||||||
cw_dbg(DBG_CW_MSG_ERR,"WTP descriptor subelement to long, length=%d>%d",i+8,len);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t vendor_id=ntohl(*((uint32_t*)(msgelem+i)));
|
|
||||||
|
|
||||||
uint32_t val = ntohl(*((uint32_t*)(msgelem+i+4)));
|
|
||||||
int subtype= (val>>16)&0xffff;
|
|
||||||
int sublen = val&0xffff;
|
|
||||||
i+=8;
|
|
||||||
|
|
||||||
if (sublen+i>len){
|
|
||||||
cw_dbg(DBG_CW_MSG_ERR,"WTP descriptor subelement too long, length = %d",sublen);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
cw_dbg(DBG_CW_MSG,"Reading WTP descriptor subelement, type=%d,len=%d",subtype,sublen);
|
|
||||||
|
|
||||||
switch(subtype){
|
|
||||||
case CWMSGSUBELEM_WTP_DESCRIPTOR_HARDWARE_VERSION:
|
|
||||||
wtpinfo->hardware_vendor_id=vendor_id;
|
|
||||||
cw_setstr(&wtpinfo->hardware_version,msgelem+i,sublen);
|
|
||||||
wtpinfo->hardware_version_len=sublen;
|
|
||||||
break;
|
|
||||||
case CWMSGSUBELEM_WTP_DESCRIPTOR_SOFTWARE_VERSION:
|
|
||||||
wtpinfo->software_vendor_id=vendor_id;
|
|
||||||
cw_setstr(&wtpinfo->software_version,msgelem+i,sublen);
|
|
||||||
wtpinfo->software_version_len=sublen;
|
|
||||||
break;
|
|
||||||
case CWMSGSUBELEM_WTP_DESCRIPTOR_BOOTLOADER_VERSION:
|
|
||||||
wtpinfo->bootloader_vendor_id=vendor_id;
|
|
||||||
cw_setstr(&wtpinfo->bootloader_version,msgelem+i,sublen);
|
|
||||||
wtpinfo->bootloader_version_len=sublen;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
cw_dbg(DBG_CW_MSG_ERR,"Unknown WTP descriptor subelement, type = %d",subtype);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
i+=sublen;
|
|
||||||
|
|
||||||
}while(i<len);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wtpinfo_readelem_wtp_descriptor(struct wtpinfo * wtpinfo, int type, uint8_t *msgelem, int len)
|
|
||||||
{
|
|
||||||
int rc =wtpinfo_readelem_wtp_descriptor_(wtpinfo, type, msgelem, len,0);
|
|
||||||
if (rc==-1){
|
|
||||||
cw_dbg(DBG_CW_RFC,"Bad wtp descriptor, trying cisco hack");
|
|
||||||
rc =wtpinfo_readelem_wtp_descriptor_(wtpinfo, type, msgelem, len,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
|
|
||||||
#include "wtpinfo.h"
|
|
||||||
#include "capwap.h"
|
|
||||||
|
|
||||||
#include "cw_util.h"
|
|
||||||
#include "cw_log.h"
|
|
||||||
|
|
||||||
|
|
||||||
int wtpinfo_readelem_location_data(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len)
|
|
||||||
{
|
|
||||||
if (type != CW_ELEM_LOCATION_DATA)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
cw_setstr(&wtpinfo->location,msgelem,len);
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "wtpinfo.h"
|
|
||||||
#include "capwap.h"
|
|
||||||
|
|
||||||
#include "cw_util.h"
|
|
||||||
#include "cw_log.h"
|
|
||||||
|
|
||||||
int wtpinfo_readelem_session_id(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len)
|
|
||||||
{
|
|
||||||
if (type != CW_ELEM_SESSION_ID)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
wtpinfo->session_id = bstr_create(msgelem,len);
|
|
||||||
|
|
||||||
// wtpinfo->session_id = realloc(wtpinfo->session_id,len);
|
|
||||||
// memcpy(wtpinfo->session_id,msgelem,len);
|
|
||||||
// wtpinfo->session_id_len=len;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
#include "wtpinfo.h"
|
|
||||||
#include "capwap.h"
|
|
||||||
|
|
||||||
#include "cw_log.h"
|
|
||||||
|
|
||||||
|
|
||||||
int wtpinfo_readelem_wtp_frame_tunnel_mode(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len)
|
|
||||||
{
|
|
||||||
if (type != CW_ELEM_WTP_FRAME_TUNNEL_MODE)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (len!=1){
|
|
||||||
cw_dbg(DBG_MSG_ERR,"Discarding WTP_DISCOVERY_TYPE msgelem, wrong size, type=%d,len=%d",type,len);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
wtpinfo->frame_tunnel_mode=*msgelem;
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
|||||||
|
|
||||||
#include "wtpinfo.h"
|
|
||||||
#include "capwap.h"
|
|
||||||
|
|
||||||
#include "cw_log.h"
|
|
||||||
|
|
||||||
int wtpinfo_readelem_wtp_mac_type(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len)
|
|
||||||
{
|
|
||||||
if (type != CW_ELEM_WTP_MAC_TYPE)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (len!=1){
|
|
||||||
cw_dbg(DBG_MSG_ERR,"Discarding WTP_MAC_TYPE msgelem, wrong size, type=%d,len=%d",type,len);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
wtpinfo->mac_type=*msgelem;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
|
|
||||||
#include "wtpinfo.h"
|
|
||||||
#include "capwap.h"
|
|
||||||
|
|
||||||
#include "cw_util.h"
|
|
||||||
#include "cw_log.h"
|
|
||||||
|
|
||||||
|
|
||||||
int wtpinfo_readelem_wtp_name(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len)
|
|
||||||
{
|
|
||||||
if (type != CW_ELEM_WTP_NAME)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (len>512){
|
|
||||||
cw_dbg(DBG_MSG_ERR,"Truncating WTP_NAME msgelem to 512, wrong size, type=%d,len=%d",type,len);
|
|
||||||
len=512;
|
|
||||||
}
|
|
||||||
|
|
||||||
cw_setstr(&wtpinfo->name,msgelem,len);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user