Working on differences from 7.3 to 7.5 version

FossilOrigin-Name: 02bf967f2dfcb1349d8c843daab6b16ac998a5b857ffb4ee71d7e84f44313ef8
This commit is contained in:
7u83@mail.ru 2018-04-23 05:51:56 +00:00
parent 34e2d016fe
commit 0607147daa
11 changed files with 193 additions and 45 deletions

View File

@ -7,19 +7,27 @@
int cw_in_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
uint8_t * elem_data, int elem_len)
{
/*cw_KTV_t * result;*/
const char * key;
char tmpkey[CW_KTV_MAX_KEY_LEN];
if (handler->mkkey != NULL){
handler->mkkey(key,elem_data,elem_len, tmpkey);
key = tmpkey;
}
else{
key = handler->key;
}
/* int (*mkkey)(struct cw_ElemHandler * handler, char *dst, struct cw_ElemHandlerParams * params,
uint8_t*data, int len);
*/
if (!handler->type){
cw_log(LOG_ERR,"Can't handle element: %s, no type defined",handler->name);
return CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
}
/* result = cw_ktv_add(params->conn->remote_cfg, handler->key,
handler->type, elem_data,elem_len);
*/
cw_ktv_read_struct(params->conn->remote_cfg,handler->type,handler->key,elem_data,elem_len);
/*params->elem=result;*/
cw_ktv_read_struct(params->conn->remote_cfg,handler->type,key,elem_data,elem_len);
return CAPWAP_RESULT_SUCCESS;
}

View File

@ -166,7 +166,7 @@
/* LWAPP IEEE 802.11 bindings */
#define LW_ELEM_80211_ADD_WLAN LW_ELEM_ADD_WLAN
#define LW_ELEM_80211_ADD_WLAN LWAPP_ELEM_ADD_WLAN
#define LW_ELEM_80211_WTP_WLAN_RADIO_CONFIGURATION 8
#define LW_ELEM_80211_MULTI_DOMAIN_CAPABILITY 10
#define LW_ELEM_80211_MAC_OPERATION 11

View File

@ -57,9 +57,9 @@ struct cw_ElemHandler {
int (*put)(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params, uint8_t * dst);
/*
int (*end_in)(struct conn *conn,struct cw_action_in *a,uint8_t*elem,int len,struct sockaddr *from);
*/
int (*mkkey)(const char *pkey, uint8_t*data, int len, char *dst);
};
struct cw_MsgDef{

View File

@ -535,6 +535,7 @@ static struct cw_ElemDef echo_request_elements[] ={
static int echo_response_states[] = {CAPWAP_STATE_RUN,0};
static struct cw_ElemDef echo_response_elements[] ={
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
{0,0,0,0,0}
};

View File

@ -36,7 +36,7 @@
#define CW_CISCO_RAD_SLOT 4
#define CISCO_ELEM_RAD_NAME LWAPP_ELEM_WTP_NAME /* 5 */
#define CW_CISCO_MWAR LW_ELEM_AC_DESCRIPTOR /* 6 */
#define CW_CISCO_ADD_WLAN LW_ELEM_80211_ADD_WLAN /* 7 */
#define CISCO_ELEM_ADD_WLAN LW_ELEM_80211_ADD_WLAN /* 7 */
#define CISCO_ELEM_WTP_RADIO_CONFIGURATION 8
#define CISCO_ELEM_MULTI_DOMAIN_CAPABILITY LW_ELEM_80211_MULTI_DOMAIN_CAPABILITY /* 10 */

View File

@ -237,6 +237,24 @@ int cisco_out_ap_regulatory_domain(struct cw_ElemHandler * eh,
idx = 0;
ob = dst;
type = NULL;
result = cw_ktv_get(params->conn->local_cfg,"ac-descriptor/software/version",CW_TYPE_BSTR16);
if (result!=NULL){
if(result->type->len(result)==4){
uint32_t rv;
rv = cw_get_dword(result->type->data(result));
if (rv >= 0x07056600){
type = cisco_ap_regulatory_domain5;
}
else{
type = cisco_ap_regulatory_domain4;
}
}
}
do {
sprintf(key,"%s.%d",eh->key,idx);
@ -247,13 +265,15 @@ int cisco_out_ap_regulatory_domain(struct cw_ElemHandler * eh,
if (strncmp(result->key,key,strlen(key))!=0)
break;
sprintf(testkey,"%s/%s",key,"band-id");
result = cw_ktv_get(params->conn->local_cfg,key,CW_TYPE_BYTE);
if (result==NULL){
type = cisco_ap_regulatory_domain4;
}
else{
type = cisco_ap_regulatory_domain5;
if(type == NULL){
sprintf(testkey,"%s/%s",key,"band-id");
result = cw_ktv_get(params->conn->local_cfg,key,CW_TYPE_BYTE);
if (result==NULL){
type = cisco_ap_regulatory_domain4;
}
else{
type = cisco_ap_regulatory_domain5;
}
}
start = params->conn->header_len(eh);
@ -266,12 +286,6 @@ int cisco_out_ap_regulatory_domain(struct cw_ElemHandler * eh,
sprintf(key,"%s.%d",eh->key,idx+1);
/* if(len==4)
type = cisco_ap_regulatory_domain4;
if(len==5)
type = cisco_ap_regulatory_domain5;
cw_ktv_read_struct(params->conn->remote_cfg,type,key,data,len);
*/
return ob-dst;
}
@ -387,7 +401,40 @@ static cw_KTVStruct_t cisco_ap_mode_and_type[]={
{NULL,NULL,0,0}
};
static cw_KTVStruct_t cisco_add_wlan[]={
{CW_TYPE_BYTE,"radio-id",1,-1},
{CW_TYPE_WORD,"wlan-capability",2,-1},
{CW_TYPE_BYTE,"wlan-id",1,-1},
{CW_TYPE_DWORD,"encryption-policy",4,-1},
{CW_TYPE_BSTR16,"wep-key",13,9},
{CW_TYPE_BYTE,"encryption",1,42},
{CW_TYPE_BOOL,"broadcast-ssid",1,426},
{CW_TYPE_WORD,"session-timout",2,475},
{CW_TYPE_BYTE, "dtim-period",1,541},
{CW_TYPE_STR, "ssid-a",30,545},
{CW_TYPE_BYTE, "allow-aaa-override",1,578},
{CW_TYPE_BYTE, "max-stations",1,580},
{NULL,NULL,0,0}
};
static int cisoc_add_wlan_mkkey(const char *pkey, uint8_t*data, int len, char *dst)
{
int wlan_id,radio_id;
radio_id = cw_get_byte(data);
wlan_id = cw_get_byte(data+3);
sprintf(dst,"radio.%d/wlan.%d",radio_id,wlan_id);
return 1;
}
static cw_KTVStruct_t cisco_ssc_hash[]={
{CW_TYPE_BOOL,"validate",1,-1},
{CW_TYPE_BSTR16,"hash",-1,-1},
{NULL,NULL,0,0}
};
static struct cw_ElemHandler handlers[] = {
@ -974,6 +1021,42 @@ static struct cw_ElemHandler handlers[] = {
}
,
{
"Add Cisco WLAN", /* name */
CISCO_ELEM_ADD_WLAN, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
7,1117, /* min/max length */
cisco_add_wlan, /* type */
"radio/wlan", /* Key */
cw_in_generic_struct, /* get */
cw_out_generic_struct, /* put */
cisoc_add_wlan_mkkey
}
,
{
"SSC Hash Validation", /* name */
CISCO_LWELEM_SSC_HASH_VALIDATION, /* Element ID */
CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
1,1, /* min/max length */
CW_TYPE_BOOL, /* type */
"cisco/ssh-hash-validation", /* Key */
cw_in_generic, /* get */
cw_out_generic /* put */
}
,
{
"SSC Hash", /* name */
CISCO_LWELEM_SSC_HASH, /* Element ID */
CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
1,331, /* min/max length */
cisco_ssc_hash, /* type */
"cisco/hash", /* Key */
cw_in_generic_struct, /* get */
cw_out_generic_struct /* put */
}
,
{0,0,0,0,0,0,0,0}
@ -1125,6 +1208,8 @@ static struct cw_ElemDef configuration_update_request_elements[] ={
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AC_NAME_WITH_INDEX, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_VENUE_SETTINGS, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_ADD_WLAN, 0, CW_IGNORE},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_USERNAME_PASSWORD, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_LOGHOST_CONFIG, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_TELNET_SSH, 0, 0},
@ -1133,6 +1218,9 @@ static struct cw_ElemDef configuration_update_request_elements[] ={
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AC_IP_ADDR_WITH_INDEX, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_FAILOVER_PRIORITY, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_VLAN, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_SSC_HASH_VALIDATION, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_SSC_HASH, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_TCP_ADJUST_MSS, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_ROUGE_DETECTION, 0, 0},
@ -1155,6 +1243,13 @@ static struct cw_ElemDef wtp_event_response_elements[] ={
{0,0,0,0,0}
};
static int wtp_echo_response_states[] = {CAPWAP_STATE_RUN,0};
static struct cw_ElemDef wtp_echo_response_elements[] ={
{0,CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_TIMESYNC, 1, 0},
{0,0,0,0,0}
};
static struct cw_MsgDef messages[] = {
{
NULL, /* name */
@ -1234,6 +1329,14 @@ static struct cw_MsgDef messages[] = {
},
{
NULL, /* name */
CAPWAP_MSG_ECHO_RESPONSE, /* msg type */
CW_ROLE_WTP, /* role */
wtp_echo_response_states, /* allowed states */
wtp_echo_response_elements /* msg elements */
},
{0,0,0,0}
};

View File

@ -55,8 +55,9 @@
#define LW_CISCO_ADD_WLAN 128
#define CISCO_LWELEM_VLAN 123
#define LW_CISCO_SSC_HASH_VALIDATION 133
#define LW_CISCO_MWAR_HASH_VALUE_1 132
#define CISCO_LWELEM_SSC_HASH_VALIDATION 133
#define CISCO_LWELEM_SSC_HASH 132
#define CISCO_LWELEM_MWAR_HASH_VALUE 134
#define LW_CISCO_DOT11R_WLC_MAC_AND_IP 135

View File

@ -32,7 +32,7 @@ endif
#SRC=$(wildcard *.c)
SRC=wtp_main.c discovery.c join.c configure.c run.c
SRC=wtp_main.c discovery.c join.c configure.c run.c changestate.c
OBJS=$(patsubst %.c,%.o,$(SRC))
OBJS:=$(patsubst %.o,$(OBJDIR)/%.o,$(OBJS))

View File

@ -1,22 +1,21 @@
#include "cw/capwap.h"
#include "cw/capwap_items.h"
#include "cw/conn.h"
#include "cw/radio.h"
#include "wtp_interface.h"
int changestate()
int changestate(struct conn * conn)
{
struct conn * conn = get_conn();
/* Update operational states, so they will be included
in the change Change State Event Request message. */
// cw_radio_update_oper_states(conn->radios,0);
mbag_set_dword(conn->outgoing,CW_ITEM_RESULT_CODE,0);
/*// cw_radio_update_oper_states(conn->radios,0);*/
/*// mbag_set_dword(conn->outgoing,CW_ITEM_RESULT_CODE,0);*/
/* Change State ... */

View File

@ -6,20 +6,20 @@ ac-descriptor/r-mac-field :Byte: 1
ac-descriptor/reserved1 :Byte: 0
ac-descriptor/security :Byte: 2
ac-descriptor/software/vendor :Dword: 4232704
ac-descriptor/software/version :Bstr16: .x07036500
ac-descriptor/software/version :Bstr16: .x07056600
ac-descriptor/station-limit :Word: 1000
ac-descriptor/stations :Word: 0
ac-name :Bstr16: CiscoAC73
ac-name :Bstr16: CisAC175
ac-name-with-index.0 :Bstr16: tabbe88
ac-name-with-index.1 :Bstr16: nudelnudel
ac-name-with-index.2 :Bstr16: nadelnalde
ac-name-with-priority/X1 :Byte: 3
ac-name-with-priority/ac2 :Byte: 5
capwap-control-ip-address/address.0 :IPAddress: 192.168.0.173
capwap-control-ip-address/address.1 :IPAddress: d96c:4c0a:da6c:4c0a:db6c:4c0a:dc6c:4c0a
capwap-control-ip-address/address.0 :IPAddress: 192.168.0.175
capwap-control-ip-address/address.1 :IPAddress: 192.168.0.175
capwap-control-ip-address/address.2 :IPAddress: 192.168.0.173
capwap-control-ip-address/wtps.0 :Word: 1
capwap-control-ip-address/wtps.1 :Word: 10
capwap-control-ip-address/wtps.1 :Word: 2
capwap-control-ip-address/wtps.2 :Word: 2
capwap-local-ip-address :IPAddress: 172.16.66.50
capwap-timers/echo-interval :Byte: 30
@ -44,17 +44,19 @@ cisco/ap-power-injector-config/sitch-mac-address :Bstr16: .x000000000000
cisco/ap-power-injector-config/state :Byte: 17
cisco/ap-pre-std-switch-config :Byte: 0
cisco/ap-regulatory-domain.0/code0 :Byte: 0
cisco/ap-regulatory-domain.0/band-id :Byte: 0
cisco/ap-regulatory-domain.0/code1 :Byte: 1
cisco/ap-regulatory-domain.0/set :Bool: true
cisco/ap-regulatory-domain.0/slot :Byte: 0
cisco/ap-regulatory-domain.1/code0 :Byte: 0
cisco/ap-regulatory-domain.1/band-id :Byte: 1
cisco/ap-regulatory-domain.1/code1 :Byte: 1
cisco/ap-regulatory-domain.1/set :Bool: true
cisco/ap-regulatory-domain.1/slot :Byte: 1
cisco/ap-sub-mode :Byte: 0
cisco/ap-telnet-ssh/ssh :Bool: false
cisco/ap-telnet-ssh/telnet :Bool: false
cisco/ap-timesync/timestamp :Dword: 1524392152
cisco/ap-timesync/timestamp :Dword: 1524467346
cisco/ap-timesync/type :Byte: 0
cisco/ap-username-and-password/802.1x-credentials/option :Word: 2
cisco/ap-username-and-password/802.1x-credentials/password :Str:
@ -68,6 +70,8 @@ cisco/ap-venue-settings/language :Str: en
cisco/ap-venue-settings/name :Str:
cisco/ap-venue-settings/type :Byte: 1
cisco/board-data-options :Dword: 16777217
cisco/hash/hash :Bstr16: 88ba29f4725fcbc8fd02843186b94692f107ecb0
cisco/hash/validate :Bool: true
cisco/loghost-config/last-joined-ap :Str:
cisco/loghost-config/loghost.0 :IPAddress: 7.7.1.3
cisco/loghost-config/loghost.1 :IPAddress: 0.0.0.0
@ -79,7 +83,7 @@ cisco/mwar-addr/address :IPAddress: 192.168.0.180
cisco/mwar-addr/mwar-type :Byte: 1
cisco/mwar-addr/unknown :Word: 0
cisco/mwar-hash-value :Bstr16: 25f312452fcb0a908007304aa201d175d0516d7a
cisco/mwar-type :Byte: 0
cisco/mwar-type :Byte: 1
cisco/rouge-and-mss/enable :Bool: false
cisco/rouge-and-mss/mss :Word: 666
cisco/rouge-and-mss/roge-detection :Bool: true
@ -132,7 +136,7 @@ radio.0/cisco/wtp-radio-config/cfg-period :Byte: 4
radio.0/cisco/wtp-radio-config/cfg-type :Byte: 1
radio.0/cisco/wtp-radio-config/cfp-maximum-duration :Word: 60
radio.0/cisco/wtp-radio-config/country-str1 :Bstr16: .x444500
radio.0/cisco/wtp-radio-config/country-str2 :Bstr16: DE
radio.0/cisco/wtp-radio-config/country-str2 :Bstr16: DE
radio.0/cisco/wtp-radio-config/gpr-period :Byte: 10
radio.0/cisco/wtp-radio-config/max-stations :Byte: 200
radio.0/cisco/wtp-radio-config/occupancy-limit :Word: 100
@ -141,6 +145,18 @@ radio.0/decryption-error-report-period :Word: 120
radio.0/operational-state/cause :Byte: 0
radio.0/operational-state/state :Byte: 2
radio.0/rate_set :Bstr16: .x82848b960c1218243048606c
radio.0/wlan.0/allow-aaa-override :Byte: 1
radio.0/wlan.0/broadcast-ssid :Bool: true
radio.0/wlan.0/dtim-period :Byte: 99
radio.0/wlan.0/encryption :Byte: 0
radio.0/wlan.0/encryption-policy :Dword: 16777216
radio.0/wlan.0/max-stations :Byte: 155
radio.0/wlan.0/radio-id :Byte: 0
radio.0/wlan.0/session-timout :Word: 0
radio.0/wlan.0/ssid-a :Str: Schlosspark
radio.0/wlan.0/wep-key :Bstr16: .xaa0c0a02000000000000000000
radio.0/wlan.0/wlan-capability :Word: 1057
radio.0/wlan.0/wlan-id :Byte: 0
radio.0/wtp-radio-information :Dword: 1
radio.1/admin-state :Byte: 1
radio.1/cisco-multi-domain-capability/first-channel :Word: 36
@ -167,7 +183,7 @@ radio.1/cisco/wtp-radio-config/cfg-period :Byte: 4
radio.1/cisco/wtp-radio-config/cfg-type :Byte: 1
radio.1/cisco/wtp-radio-config/cfp-maximum-duration :Word: 60
radio.1/cisco/wtp-radio-config/country-str1 :Bstr16: .x444500
radio.1/cisco/wtp-radio-config/country-str2 :Bstr16: DE
radio.1/cisco/wtp-radio-config/country-str2 :Bstr16: DE
radio.1/cisco/wtp-radio-config/gpr-period :Byte: 10
radio.1/cisco/wtp-radio-config/max-stations :Byte: 200
radio.1/cisco/wtp-radio-config/occupancy-limit :Word: 100
@ -176,6 +192,18 @@ radio.1/decryption-error-report-period :Word: 120
radio.1/operational-state/cause :Byte: 0
radio.1/operational-state/state :Byte: 2
radio.1/rate_set :Bstr16: .x8c129824b048606c
radio.1/wlan.0/allow-aaa-override :Byte: 1
radio.1/wlan.0/broadcast-ssid :Bool: true
radio.1/wlan.0/dtim-period :Byte: 99
radio.1/wlan.0/encryption :Byte: 0
radio.1/wlan.0/encryption-policy :Dword: 16777216
radio.1/wlan.0/max-stations :Byte: 155
radio.1/wlan.0/radio-id :Byte: 1
radio.1/wlan.0/session-timout :Word: 0
radio.1/wlan.0/ssid-a :Str: Schlosspark
radio.1/wlan.0/wep-key :Bstr16: .xaa0c0a02000000000000000000
radio.1/wlan.0/wlan-capability :Word: 1
radio.1/wlan.0/wlan-id :Byte: 0
radio.1/wtp-radio-information :Dword: 2
radio.255/admin-state :Byte: 1
radio.255/operational-state/cause :Byte: 0
@ -186,6 +214,10 @@ radio/0/cisco/regulatory-domain/set :Bool: true
radio/0/cisco/regulatory-domain/slot :Byte: 0
radio/0/wtp-radio-information :Dword: 1
radio/1/wtp-radio-information :Dword: 2
radio/wlan/encryption-policy :Dword: 16777216
radio/wlan/radio-od :Byte: 1
radio/wlan/wlan-capability :Word: 17
radio/wlan/wlan-id :Byte: 0
result-code :Dword: 0
session-id :Bstr16: .x00006215
statistics-timer :Word: 60

View File

@ -231,6 +231,10 @@ exit(0);
clean_cfg(conn->remote_cfg);
mavl_merge(conn->local_cfg,conn->remote_cfg);
changestate(conn);
run(conn);
cw_discovery_free_results(&dis);