als cisco join functions implemented
FossilOrigin-Name: b63ca45f023666ba12e838e0c313536bf2a41dd6170191e150723b4dfbad4ba7
This commit is contained in:
		@ -8,7 +8,12 @@ OBJS=\
 | 
			
		||||
	cisco_in_wtp_descriptor.o \
 | 
			
		||||
	cisco_out_wtp_descriptor.o \
 | 
			
		||||
	cisco_in_ac_descriptor.o\
 | 
			
		||||
	cisco_out_ac_descriptor.o\
 | 
			
		||||
	cisco_out_radio_generic.o\
 | 
			
		||||
	cisco_out_ap_timesync.o\
 | 
			
		||||
	cisco_in_spam_vendor_specific.o\
 | 
			
		||||
	cisco_out_lw_path_mtu.o\
 | 
			
		||||
	cisco_out_capwap_local_ip_address.o
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#	cisco80211.o \
 | 
			
		||||
 | 
			
		||||
@ -73,7 +73,7 @@
 | 
			
		||||
#define CW_CISCO_AC_NAME_WITH_INDEX		91
 | 
			
		||||
#define CW_CISCO_SPAM_DOMAIN_SECRET		96
 | 
			
		||||
 | 
			
		||||
#define CW_CISCO_SPAM_VENDOR_SPECIFIC		104
 | 
			
		||||
#define CISCO_ELEM_SPAM_VENDOR_SPECIFIC		104
 | 
			
		||||
 | 
			
		||||
#define CW_CISCO_AP_UPTIME			108
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -22,6 +22,8 @@
 | 
			
		||||
#include "cw/msgset.h"
 | 
			
		||||
#include "cw/ktv.h"
 | 
			
		||||
#include "cw/keys.h"
 | 
			
		||||
#include "cw/proto.h"
 | 
			
		||||
#include "lwapp_cisco.h"
 | 
			
		||||
 | 
			
		||||
#include "capwap_cisco.h"
 | 
			
		||||
#include "mod_cisco.h"
 | 
			
		||||
@ -49,6 +51,19 @@ static cw_KTVStruct_t ap_time_sync[] = {
 | 
			
		||||
	{NULL,NULL,0,0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static cw_KTVStruct_t mwar_addr[] = {
 | 
			
		||||
	{CW_TYPE_BYTE, "mwar-type", 1,-1},
 | 
			
		||||
	{CW_TYPE_IPADDRESS, "address", 4,-1},
 | 
			
		||||
	{CW_TYPE_WORD, "unknown", 2,-1},
 | 
			
		||||
	{NULL,NULL,0,0}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static cw_KTVStruct_t cisco_lw_path_mtu[] = {
 | 
			
		||||
	{CW_TYPE_WORD, "max", 2,-1},
 | 
			
		||||
	{CW_TYPE_WORD, "len", 2,-1},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
	{ 
 | 
			
		||||
		"WTP Descriptor (Draft 7)",	/* name */
 | 
			
		||||
@ -69,7 +84,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		NULL,				/* type */
 | 
			
		||||
		"ac-descriptor",		/* Key */
 | 
			
		||||
		cisco_in_ac_descriptor, 	/* get */
 | 
			
		||||
		NULL, /*cisco_out_ac_descriptor	*/	/* put */
 | 
			
		||||
		cisco_out_ac_descriptor		/* put */
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	{
 | 
			
		||||
@ -102,7 +117,7 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		ap_time_sync,			/* type */
 | 
			
		||||
		"cisco/ap-timesync",		/* Key */
 | 
			
		||||
		cw_in_generic_struct,		/* handler */
 | 
			
		||||
		NULL				/* put */
 | 
			
		||||
		cisco_out_ap_timesync		/* put */
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
 | 
			
		||||
@ -128,6 +143,86 @@ static struct cw_ElemHandler handlers[] = {
 | 
			
		||||
		cisco_out_radio_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	{ 
 | 
			
		||||
		"Session ID (Cisco min len = 4)",	/* name */
 | 
			
		||||
		CAPWAP_ELEM_SESSION_ID,			/* Element ID */
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		4,CAPWAP_SESSION_ID_LEN,		/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"session-id",				/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"AP Group Name",			/* name */
 | 
			
		||||
		CISCO_ELEM_AP_GROUP_NAME,		/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,0,			/* Vendor / Proto */
 | 
			
		||||
		1,512,					/* min/max length */
 | 
			
		||||
		CW_TYPE_BSTR16,				/* type */
 | 
			
		||||
		"cisco/ap-group-name",			/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cw_out_generic				/* put */
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"MWAR Addr",				/* name */
 | 
			
		||||
		CISCO_ELEM_MWAR_ADDR,			/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,0,			/* Vendor / Proto */
 | 
			
		||||
		7,7,					/* min/max length */
 | 
			
		||||
		mwar_addr,				/* type */
 | 
			
		||||
		"cisco/mwar-addr",			/* Key */
 | 
			
		||||
		cw_in_generic_struct,			/* get */
 | 
			
		||||
		cw_out_generic_struct			/* put */
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	{ 
 | 
			
		||||
		"WTP IPv4 Address (Draft 7)",		/* name */
 | 
			
		||||
		CAPWAP_ELEM_WTP_IPV4_IP_ADDRESS,	/* Element ID */
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		4,4,					/* min/max length */
 | 
			
		||||
		CW_TYPE_IPADDRESS,			/* type */
 | 
			
		||||
		"capwap-local-ip-address",		/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cisco_out_capwap_local_ip_address	/* put */
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
 | 
			
		||||
	{ 
 | 
			
		||||
		"WTP IPv6 Address (Draft 7)",		/* name */
 | 
			
		||||
		CAPWAP_ELEM_WTP_IPV6_IP_ADDRESS,	/* Element ID */
 | 
			
		||||
		0,0,					/* Vendor / Proto */
 | 
			
		||||
		16,16,					/* min/max length */
 | 
			
		||||
		CW_TYPE_IPADDRESS,			/* type */
 | 
			
		||||
		"capwap-local-ip-address",		/* Key */
 | 
			
		||||
		cw_in_generic,				/* get */
 | 
			
		||||
		cisco_out_capwap_local_ip_address	/* put */
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	{ 
 | 
			
		||||
		"SPAM Vendor Specific",			/* name */
 | 
			
		||||
		CISCO_ELEM_SPAM_VENDOR_SPECIFIC,	/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,0,			/* Vendor / Proto */
 | 
			
		||||
		0,0,					/* min/max length */
 | 
			
		||||
		NULL,					/* type */
 | 
			
		||||
		"cisco_spam_vendor_specific",		/* Key */
 | 
			
		||||
		cisco_in_spam_vendor_specific,		/* get */
 | 
			
		||||
		NULL		/* put */
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	{ 
 | 
			
		||||
		"Path MTU",				/* name */
 | 
			
		||||
		CISCO_LWELEM_PATH_MTU,			/* Element ID */
 | 
			
		||||
		CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP,	/* Vendor / Proto */
 | 
			
		||||
		0,0,					/* min/max length */
 | 
			
		||||
		cisco_lw_path_mtu,			/* type */
 | 
			
		||||
		"cisco/lw_path_mtu",			/* Key */
 | 
			
		||||
		cw_in_generic_struct,			/* get */
 | 
			
		||||
		cisco_out_lw_path_mtu			/* put */
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
	{0,0,0,0,0,0,0,0}
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
@ -152,6 +247,28 @@ static struct cw_ElemDef discovery_response_elements[] ={
 | 
			
		||||
	
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static int join_request_states[] = {CAPWAP_STATE_JOIN,0};
 | 
			
		||||
static struct cw_ElemDef join_request_elements[] ={
 | 
			
		||||
	{0,CW_VENDOR_ID_CISCO,	CW_CISCO_BOARD_DATA_OPTIONS,	1, 0},
 | 
			
		||||
	{0,CW_VENDOR_ID_CISCO,	CISCO_ELEM_AP_GROUP_NAME,	1, 0},
 | 
			
		||||
	{0,CW_VENDOR_ID_CISCO,	CISCO_ELEM_MWAR_ADDR,		1, 0},
 | 
			
		||||
	{0,CW_VENDOR_ID_CISCO,	CISCO_ELEM_SPAM_VENDOR_SPECIFIC,1, CW_IGNORE},
 | 
			
		||||
	{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO,	CISCO_LWELEM_PATH_MTU,	0, 0},
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	{0,0,			CAPWAP_ELEM_WTP_IPV4_IP_ADDRESS,1,0},
 | 
			
		||||
	{0,0,			CAPWAP_ELEM_WTP_IPV6_IP_ADDRESS,1,0},
 | 
			
		||||
 | 
			
		||||
	{0,0,CAPWAP_ELEM_CAPWAP_LOCAL_IPV4_ADDRESS,		0, CW_DELETE},
 | 
			
		||||
	{0,0,CAPWAP_ELEM_CAPWAP_LOCAL_IPV6_ADDRESS,		0, CW_DELETE},
 | 
			
		||||
	{0,0,			CAPWAP_ELEM_ECN_SUPPORT,	0, CW_DELETE},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	{0,0,0,00}
 | 
			
		||||
	
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static struct cw_MsgDef messages[] = {
 | 
			
		||||
	{
 | 
			
		||||
@ -168,6 +285,13 @@ static struct cw_MsgDef messages[] = {
 | 
			
		||||
		discovery_response_states,
 | 
			
		||||
		discovery_response_elements
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		NULL,				/* name */
 | 
			
		||||
		CAPWAP_MSG_JOIN_REQUEST,	/* type */
 | 
			
		||||
		CW_ROLE_AC,
 | 
			
		||||
		join_request_states,
 | 
			
		||||
		join_request_elements
 | 
			
		||||
	},
 | 
			
		||||
	{0,0,0,0}
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -129,7 +129,7 @@ static cw_action_in_t actions_in[] = {
 | 
			
		||||
		.capwap_state = CW_STATE_RUN,
 | 
			
		||||
		.vendor_id = CW_VENDOR_ID_CISCO,
 | 
			
		||||
		.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
 | 
			
		||||
		.elem_id  = CW_CISCO_AP_GROUP_NAME,
 | 
			
		||||
		.elem_id  = CISCO_ELEM_AP_GROUP_NAME,
 | 
			
		||||
		.item_id = CIPWAP_ITEM_WTP_GROUP_NAME, 
 | 
			
		||||
		.start  = cw_in_generic,
 | 
			
		||||
		.min_len = 0,
 | 
			
		||||
@ -222,7 +222,7 @@ static cw_action_in_t actions_in[] = {
 | 
			
		||||
		.capwap_state = CW_STATE_CONFIGURE, 
 | 
			
		||||
		.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
 | 
			
		||||
		.vendor_id = CW_VENDOR_ID_CISCO,
 | 
			
		||||
		.elem_id = CW_CISCO_SPAM_VENDOR_SPECIFIC,
 | 
			
		||||
		.elem_id = CISCO_ELEM_SPAM_VENDOR_SPECIFIC,
 | 
			
		||||
		.start = lw_in_vendor_specific,
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
@ -232,7 +232,7 @@ static cw_action_in_t actions_in[] = {
 | 
			
		||||
		.capwap_state = CW_STATE_RUN, 
 | 
			
		||||
		.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
 | 
			
		||||
		.vendor_id = CW_VENDOR_ID_CISCO,
 | 
			
		||||
		.elem_id = CW_CISCO_SPAM_VENDOR_SPECIFIC,
 | 
			
		||||
		.elem_id = CISCO_ELEM_SPAM_VENDOR_SPECIFIC,
 | 
			
		||||
		.start = lw_in_vendor_specific,
 | 
			
		||||
	}
 | 
			
		||||
	,
 | 
			
		||||
@ -317,7 +317,7 @@ static cw_action_out_t actions_out[]={
 | 
			
		||||
	{
 | 
			
		||||
		.msg_id = CAPWAP_MSG_JOIN_REQUEST, 
 | 
			
		||||
		.vendor_id = CW_VENDOR_ID_CISCO,
 | 
			
		||||
		.elem_id  = CW_CISCO_AP_GROUP_NAME,
 | 
			
		||||
		.elem_id  = CISCO_ELEM_AP_GROUP_NAME,
 | 
			
		||||
		.item_id = CIPWAP_ITEM_WTP_GROUP_NAME, 
 | 
			
		||||
		.out = cw_out_generic,
 | 
			
		||||
		/*.get = cw_out_get_config,*/
 | 
			
		||||
 | 
			
		||||
@ -1,13 +1,29 @@
 | 
			
		||||
 | 
			
		||||
#include "cw/action.h"
 | 
			
		||||
#include "cw/lw.h"
 | 
			
		||||
#include "cw/dbg.h"
 | 
			
		||||
#include "cw/proto.h"
 | 
			
		||||
 | 
			
		||||
int cisco_in_spam_vendor_specific(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
 | 
			
		||||
		  struct sockaddr *from)
 | 
			
		||||
int cisco_in_spam_vendor_specific(struct cw_ElemHandler *eh, 
 | 
			
		||||
			struct cw_ElemHandlerParams *params, 
 | 
			
		||||
			uint8_t * data, int len)
 | 
			
		||||
{
 | 
			
		||||
	struct cw_ElemHandler *vhandler;
 | 
			
		||||
	uint32_t vendor_id, elem_id;
 | 
			
		||||
	
 | 
			
		||||
	vendor_id = cw_get_dword(data);
 | 
			
		||||
	elem_id = cw_get_word(data + 4);
 | 
			
		||||
 | 
			
		||||
	return lw_in_vendor_specific(conn,a,data+6,len-6,from);
 | 
			
		||||
	cw_dbg(DBG_X,"Cwin vendor spam");
 | 
			
		||||
	return 0;
 | 
			
		||||
	vhandler = cw_msgset_get_elemhandler(params->conn->msgset,CW_PROTO_LWAPP,vendor_id,elem_id);
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	if (!vhandler) {
 | 
			
		||||
                cw_dbg(DBG_WARN,
 | 
			
		||||
                       "Can't handle Vendor Specific LWAPP Payload %s/%d, in msg %d (%s) in %s state.",
 | 
			
		||||
                       cw_strvendor(vendor_id), elem_id, params->msgdata->type,
 | 
			
		||||
                       params->msgdata->name, cw_strstate(params->conn->capwap_state));
 | 
			
		||||
                return 0;
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return cw_process_element(params,CW_PROTO_LWAPP,vendor_id,elem_id,data+6,len-6);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,73 +1,86 @@
 | 
			
		||||
/*
 | 
			
		||||
    This file is part of actube.
 | 
			
		||||
 | 
			
		||||
    actube 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.
 | 
			
		||||
 | 
			
		||||
    actube 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 "cw/log.h"
 | 
			
		||||
#include "cw/dbg.h"
 | 
			
		||||
#include "cw/conn.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "cw/capwap.h"
 | 
			
		||||
#include "cw/cw.h"
 | 
			
		||||
#include "cw/ktv.h"
 | 
			
		||||
#include "cw/keys.h"
 | 
			
		||||
 | 
			
		||||
extern mbag_t cisco_config;
 | 
			
		||||
 | 
			
		||||
int cisco_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *dst) 
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	uint8_t *d = dst+4;
 | 
			
		||||
	struct mbag_item * i;
 | 
			
		||||
	i = mbag_get(conn->local,CW_ITEM_AC_STATUS);
 | 
			
		||||
static int put_ac_status(mavl_t global, mavl_t local, uint8_t *dst, const char * parent_key){
 | 
			
		||||
 | 
			
		||||
	uint8_t *d = dst;
 | 
			
		||||
	uint8_t security;
 | 
			
		||||
	
 | 
			
		||||
	char key[CW_KTV_MAX_KEY_LEN];
 | 
			
		||||
	
 | 
			
		||||
	if (!i) {
 | 
			
		||||
		cw_log(LOG_ERR,"Can't send AC Descriptor, no AC Status Item found");
 | 
			
		||||
		return 0; 
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	d+=cw_put_ac_status(d ,(struct cw_ac_status*)(i->u2.data),conn);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	i = mbag_get(cisco_config,CW_ITEM_AC_SOFTWARE_VERSION);
 | 
			
		||||
 | 
			
		||||
	if (!i){
 | 
			
		||||
		/* Send back the same software version as the WTP has,
 | 
			
		||||
		otherwise the AP wants us to send an image */
 | 
			
		||||
		i = mbag_get(conn->incomming,CW_ITEM_WTP_SOFTWARE_VERSION);
 | 
			
		||||
	}
 | 
			
		||||
	d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/stations",0));
 | 
			
		||||
	d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/station-limit",0));
 | 
			
		||||
	d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/active-wtps",0));
 | 
			
		||||
	d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/max-wtps",0));
 | 
			
		||||
	
 | 
			
		||||
	d += cw_put_byte(d,cw_ktv_get_byte(global,"ac-descriptor/security",0));
 | 
			
		||||
/*	
 | 
			
		||||
	if ( i ) {	
 | 
			
		||||
	 	d += cw_put_version(d,1,i->u2.data);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		cw_log(LOG_ERR, "Can't set Cisco Software Version in AC descriptor, No value defined.");
 | 
			
		||||
	}
 | 
			
		||||
	security = 0;
 | 
			
		||||
	if (cw_ktv_get(local,"dtls-cert-file",CW_TYPE_BSTR16))
 | 
			
		||||
		security |= CAPWAP_FLAG_AC_SECURITY_X;
 | 
			
		||||
		
 | 
			
		||||
	if (cw_ktv_get(local,"dtls-psk",CW_TYPE_BSTR16))
 | 
			
		||||
		security |= CAPWAP_FLAG_AC_SECURITY_S;
 | 
			
		||||
 | 
			
		||||
	i = mbag_get(cisco_config, CW_ITEM_AC_HARDWARE_VERSION);
 | 
			
		||||
	if ( i ) {	
 | 
			
		||||
	 	d += cw_put_version(d,0,i->u2.data);
 | 
			
		||||
	if (security == 0){
 | 
			
		||||
		cw_log(LOG_WARNING,"No AC security selected");
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		cw_log(LOG_ERR, "Can't set Cisco Hardware Version in AC descriptor, No value defined.");
 | 
			
		||||
	}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
	int len = d-dst-4;
 | 
			
		||||
	d += cw_put_byte(dst,security);
 | 
			
		||||
*/	
 | 
			
		||||
	sprintf(key,"%s/%s",parent_key,"ac-descriptor/r-mac-field");
 | 
			
		||||
	d += cw_put_byte(d,cw_ktv_get_byte(global,"ac-descriptor/r-mac-field",0));
 | 
			
		||||
		/*d += cw_put_byte(d,3);*/
 | 
			
		||||
	
 | 
			
		||||
	return len + cw_put_elem_hdr(dst,a->elem_id,len);
 | 
			
		||||
	d += cw_put_byte(d,0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	sprintf(key,"%s/%s",parent_key,CW_SKEY_DTLS_POLICY);
 | 
			
		||||
	d += cw_put_byte(d,cw_ktv_get_byte(local,key,0));
 | 
			
		||||
 | 
			
		||||
	return d - dst;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int cisco_out_ac_descriptor(struct cw_ElemHandler * eh, 
 | 
			
		||||
		struct cw_ElemHandlerParams * params, uint8_t * dst)
 | 
			
		||||
{
 | 
			
		||||
	int len,l;
 | 
			
		||||
	uint8_t *d = dst+4;
 | 
			
		||||
	char key[CW_KTV_MAX_KEY_LEN];
 | 
			
		||||
 | 
			
		||||
	d+=put_ac_status(params->conn->local_cfg,
 | 
			
		||||
				params->conn->global_cfg,
 | 
			
		||||
				d, eh->key);
 | 
			
		||||
 | 
			
		||||
	/* it is important to send software version first, 
 | 
			
		||||
	 * because APs don't check the type */
 | 
			
		||||
	sprintf(key,"%s/%s",eh->key,CW_SKEY_SOFTWARE);
 | 
			
		||||
	d+=cw_write_descriptor_subelem (d, params->conn->local_cfg,
 | 
			
		||||
                                 1, key);
 | 
			
		||||
 | 
			
		||||
	sprintf(key,"%s/%s",eh->key,CW_SKEY_HARDWARE);
 | 
			
		||||
	d+=cw_write_descriptor_subelem (d, params->conn->local_cfg,
 | 
			
		||||
                                 0, key);
 | 
			
		||||
 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	len = d-dst-4;
 | 
			
		||||
 | 
			
		||||
	l = len + cw_put_elem_hdr(dst,eh->id,len);
 | 
			
		||||
	cw_dbg_elem(DBG_ELEM_OUT,params->conn,params->msgdata->type,eh,dst,l);
 | 
			
		||||
 | 
			
		||||
	return l;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,12 +1,20 @@
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <time.h>
 | 
			
		||||
#include "cisco.h"
 | 
			
		||||
 | 
			
		||||
#include "cw/capwap_cisco.h"
 | 
			
		||||
 | 
			
		||||
int cisco_out_ap_timesync(struct conn *conn,struct cw_action_out * a,uint8_t *dst)
 | 
			
		||||
#include "cw/msgset.h"
 | 
			
		||||
#include "cw/cw.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int cisco_out_ap_timesync(struct cw_ElemHandler * eh, 
 | 
			
		||||
		struct cw_ElemHandlerParams * params, uint8_t * dst)
 | 
			
		||||
{
 | 
			
		||||
	int l = cw_put_cisco_ap_timesync(dst+10,time(NULL),0);
 | 
			
		||||
	return l + cw_put_elem_vendor_hdr(dst, a->vendor_id, a->elem_id, l);
 | 
			
		||||
	cw_set_dword(dst+10 , time(NULL));
 | 
			
		||||
        cw_set_byte(dst+10 + 4, 0);
 | 
			
		||||
 | 
			
		||||
	return 5 + cw_put_elem_vendor_hdr(dst, eh->vendor , eh->id, 5);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,16 @@
 | 
			
		||||
#include "mod_cisco.h"
 | 
			
		||||
#include "cw/cw.h"
 | 
			
		||||
 | 
			
		||||
int cisco_out_capwap_local_ip_address(struct cw_ElemHandler * eh, 
 | 
			
		||||
		struct cw_ElemHandlerParams * params, uint8_t * dst)
 | 
			
		||||
{
 | 
			
		||||
	cw_KTV_t * ip;
 | 
			
		||||
	ip = cw_ktv_get(params->conn->local_cfg,eh->key,CW_TYPE_IPADDRESS);
 | 
			
		||||
	if (ip==NULL){
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	return cw_put_local_ip_address(dst,eh->id,
 | 
			
		||||
			CAPWAP_ELEM_WTP_IPV4_IP_ADDRESS,
 | 
			
		||||
			CAPWAP_ELEM_WTP_IPV6_IP_ADDRESS,
 | 
			
		||||
			ip->type->data(ip),ip->type->len(ip));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,31 @@
 | 
			
		||||
#include "cw/lw.h"
 | 
			
		||||
#include "cw/cw.h"
 | 
			
		||||
 | 
			
		||||
#include "capwap_cisco.h"
 | 
			
		||||
#include "mod_cisco.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int cisco_out_lw_path_mtu(struct cw_ElemHandler * eh, 
 | 
			
		||||
		struct cw_ElemHandlerParams * params, uint8_t * dst)
 | 
			
		||||
{
 | 
			
		||||
	char key[CW_KTV_MAX_KEY_LEN];
 | 
			
		||||
	int len,max;
 | 
			
		||||
		
 | 
			
		||||
	sprintf(key,"%s/%s",eh->key,"len");
 | 
			
		||||
	len = cw_ktv_get_word(params->conn->local_cfg,key,0);
 | 
			
		||||
	if (len == 0)
 | 
			
		||||
		return 0;
 | 
			
		||||
	sprintf(key,"%s/%s",eh->key,"max");
 | 
			
		||||
	max = cw_ktv_get_word(params->conn->local_cfg,key,0);
 | 
			
		||||
	
 | 
			
		||||
	lw_set_word(dst+16,max);
 | 
			
		||||
	lw_set_word(dst+16+2,len);
 | 
			
		||||
	memset(dst+16+4,0,len-4);
 | 
			
		||||
	
 | 
			
		||||
	/* put the lwap elem header */
 | 
			
		||||
	lw_set_dword(dst + 10, eh->vendor);
 | 
			
		||||
	lw_set_word(dst + 14, eh->id);
 | 
			
		||||
 | 
			
		||||
	return len + 6 + cw_put_elem_vendor_hdr(dst, eh->vendor, CISCO_ELEM_SPAM_VENDOR_SPECIFIC, len+6);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,7 @@ uint8_t arr1[] = {
 | 
			
		||||
 | 
			
		||||
	int l=sizeof(arr1);
 | 
			
		||||
	l = l + lw_put_vendor(dst+10, LW_VENDOR_ID_CISCO, LW_CISCO_DOT11R_WLC_MAC_AND_IP, l);
 | 
			
		||||
	return l+cw_put_elem_vendor_hdr(dst,CW_VENDOR_ID_CISCO,CW_CISCO_SPAM_VENDOR_SPECIFIC,l);
 | 
			
		||||
	return l+cw_put_elem_vendor_hdr(dst,CW_VENDOR_ID_CISCO,CISCO_ELEM_SPAM_VENDOR_SPECIFIC,l);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,6 @@ uint8_t arr1[] = {
 | 
			
		||||
	memcpy(d,&(((struct sockaddr_in *) &ss)->sin_addr),4);
 | 
			
		||||
	 l=4;
 | 
			
		||||
	l = l + lw_put_vendor(dst+10, LW_VENDOR_ID_CISCO, LW_CISCO_MANAGER_IP_ADDR, l);
 | 
			
		||||
	return l+cw_put_elem_vendor_hdr(dst,CW_VENDOR_ID_CISCO,CW_CISCO_SPAM_VENDOR_SPECIFIC,l);
 | 
			
		||||
	return l+cw_put_elem_vendor_hdr(dst,CW_VENDOR_ID_CISCO,CISCO_ELEM_SPAM_VENDOR_SPECIFIC,l);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -50,7 +50,7 @@ int cw_cisco_put_telnet_ssh(struct conn *conn,uint8_t type,const char * item_id,
 | 
			
		||||
	if (l==0)
 | 
			
		||||
		return 0;
 | 
			
		||||
	cw_dbg(DBG_X,"CISL = %d",l);
 | 
			
		||||
	return l + cw_put_elem_vendor_hdr(dst, CW_VENDOR_ID_CISCO, CW_CISCO_SPAM_VENDOR_SPECIFIC, l);
 | 
			
		||||
	return l + cw_put_elem_vendor_hdr(dst, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC, l);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,7 @@
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
#include "lwapp.h"
 | 
			
		||||
#include "cw/lwapp.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -42,7 +42,7 @@
 | 
			
		||||
 | 
			
		||||
#define LW_CISCO_PRIMED_DISCOVERY_TIMEOUT	50
 | 
			
		||||
#define LW_CISCO_DELETE_WLAN			52
 | 
			
		||||
#define LW_CISCO_PATH_MTU			73
 | 
			
		||||
#define CISCO_LWELEM_PATH_MTU			73
 | 
			
		||||
#define LW_CISCO_PRIMED_JOIN_TIMEOUT		85
 | 
			
		||||
#define LW_CISCO_AP_DTLS_DATA_CFG		74
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,8 @@
 | 
			
		||||
#ifndef __MOD_CISCO_H
 | 
			
		||||
#define __MOD_CISCO_H
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include "cw/msgset.h"
 | 
			
		||||
 | 
			
		||||
int cisco_in_wtp_descriptor(struct cw_ElemHandler *eh, struct cw_ElemHandlerParams * params, uint8_t * data,
 | 
			
		||||
                         int len);
 | 
			
		||||
@ -11,10 +13,32 @@ int cisco_out_wtp_descriptor(struct cw_ElemHandler * handler, struct cw_ElemHand
 | 
			
		||||
int cisco_in_ac_descriptor(struct cw_ElemHandler *eh, 
 | 
			
		||||
			struct cw_ElemHandlerParams *params, 
 | 
			
		||||
			uint8_t * data, int len);
 | 
			
		||||
			
 | 
			
		||||
int cisco_out_ac_descriptor(struct cw_ElemHandler * eh, 
 | 
			
		||||
		struct cw_ElemHandlerParams * params, uint8_t * dst);
 | 
			
		||||
 | 
			
		||||
int cisco_out_radio_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
 | 
			
		||||
			, uint8_t * dst);
 | 
			
		||||
 | 
			
		||||
int cisco_out_ap_timesync(struct cw_ElemHandler * eh, 
 | 
			
		||||
		struct cw_ElemHandlerParams * params, uint8_t * dst);
 | 
			
		||||
		
 | 
			
		||||
int cisco_in_spam_vendor_specific(struct cw_ElemHandler *eh, 
 | 
			
		||||
			struct cw_ElemHandlerParams *params, 
 | 
			
		||||
			uint8_t * data, int len);
 | 
			
		||||
 | 
			
		||||
int cisco_in_lw_path_mtu(struct cw_ElemHandler *eh, 
 | 
			
		||||
			struct cw_ElemHandlerParams *params, 
 | 
			
		||||
			uint8_t * data, int len);
 | 
			
		||||
 | 
			
		||||
int cisco_out_capwap_local_ip_address(struct cw_ElemHandler * eh, 
 | 
			
		||||
		struct cw_ElemHandlerParams * params, uint8_t * dst);
 | 
			
		||||
 | 
			
		||||
int cisco_out_lw_path_mtu(struct cw_ElemHandler * eh, 
 | 
			
		||||
		struct cw_ElemHandlerParams * params, uint8_t * dst);
 | 
			
		||||
		
 | 
			
		||||
struct cw_MsgSet * cisco_register_msg_set(struct cw_MsgSet * set, int mode);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -195,6 +195,7 @@ int static setup_cfg(struct conn  * conn)
 | 
			
		||||
{
 | 
			
		||||
	int security;
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	security = cw_setup_dtls(conn,conn->local_cfg,"cisco",CAPWAP_CIPHER);
 | 
			
		||||
	cw_ktv_set_byte(conn->local_cfg,"ac-descriptor/security",security);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user