diff --git a/actube.workspace b/actube.workspace index c63c2d68..07586c53 100644 --- a/actube.workspace +++ b/actube.workspace @@ -1,10 +1,10 @@ - + - + diff --git a/libcw.project b/libcw.project index 859fa015..bf6d41d6 100644 --- a/libcw.project +++ b/libcw.project @@ -294,6 +294,7 @@ + diff --git a/src/cw/Makefile b/src/cw/Makefile index c6b70d86..0654be11 100644 --- a/src/cw/Makefile +++ b/src/cw/Makefile @@ -136,6 +136,7 @@ KTVSRC=\ cw_ktv_std_types.c\ cw_ktv_base_exists.c\ cw_ktv_save.c\ + cw_ktv_del_sub.c\ LWSRC=\ diff --git a/src/cw/cw_ktv_del_sub.c b/src/cw/cw_ktv_del_sub.c new file mode 100644 index 00000000..b7db0586 --- /dev/null +++ b/src/cw/cw_ktv_del_sub.c @@ -0,0 +1,22 @@ + + +#include "ktv.h" + +void cw_ktv_del_sub(mavl_t ktvstore, const char *basekey) +{ + cw_KTV_t * result, search; + + + while (1){ + search.key=(char*)basekey; + result = mavl_get_first(ktvstore,&search); + + if (result == NULL) + return; + + if (strncmp(result->key,basekey,strlen(basekey))!=0) + break; + search.key = result->key; + mavl_del(ktvstore,&search); + } +} diff --git a/src/cw/cw_ktv_read_struct.c b/src/cw/cw_ktv_read_struct.c index 7aaf5b9d..fffaaa87 100644 --- a/src/cw/cw_ktv_read_struct.c +++ b/src/cw/cw_ktv_read_struct.c @@ -16,10 +16,27 @@ int cw_ktv_read_struct(mavl_t ktv,const cw_KTVStruct_t * stru, const char *pkey, pos=stru[i].position; sprintf(key,"%s/%s",pkey,stru[i].key); - if (stru[i].len==-1) - l = len-pos; - else - l = stru[i].len; + + switch (stru[i].len){ + case CW_KTVSTRUCT_L8: + l = cw_get_byte(data+pos); + pos ++; + break; + case CW_KTVSTRUCT_L16: + l = cw_get_word(data+pos); + pos ++; + break; + case -1: + l = len-pos; + break; + default: + l = stru[i].len; + if (pos+l > l){ + l = len-pos; + } + + } + result = cw_ktv_add(ktv,key,stru[i].type,data+pos,l); stru[i].type->to_str(result,dbstr,100); diff --git a/src/cw/ktv.h b/src/cw/ktv.h index 3c327c20..f395cad0 100644 --- a/src/cw/ktv.h +++ b/src/cw/ktv.h @@ -95,6 +95,9 @@ struct cw_KTVStruct { typedef struct cw_KTVStruct cw_KTVStruct_t; +#define CW_KTVSTRUCT_L16 -2 +#define CW_KTVSTRUCT_L8 -3 + struct cw_KTVEnum{ int value; const char * name; @@ -141,6 +144,8 @@ void cw_kvstore_mavl_delete(const void *data); cw_KTV_t *cw_ktv_add(mavl_t kvstore, const char *key, const struct cw_Type *type, const uint8_t * data, int len); +void cw_ktv_del_sub(mavl_t ktvstore, const char *basekey); + cw_KTV_t * cw_ktv_replace(mavl_t kvtstore, const char *key, const struct cw_Type *type, const uint8_t * data, int len); diff --git a/src/mod/cisco/cisco_actions_ac.c b/src/mod/cisco/cisco_actions_ac.c index 7181188a..0b70f9c7 100644 --- a/src/mod/cisco/cisco_actions_ac.c +++ b/src/mod/cisco/cisco_actions_ac.c @@ -383,7 +383,7 @@ static cw_KTVStruct_t cisco_ap_qos[]={ static cw_KTVStruct_t cisco_ap_core_dump[]={ {CW_TYPE_IPADDRESS,"tftp-server",4,-1}, - {CW_TYPE_BOOL,"enable",1,16}, + {CW_TYPE_BOOL,"compression",1,16}, {CW_TYPE_STR,"filename",199,17}, {NULL,NULL,0,0} }; @@ -440,6 +440,24 @@ static cw_KTVStruct_t cisco_add_wlan[]={ {NULL,NULL,0,0} }; + +static int cisco_in_lw_del_wlan(struct cw_ElemHandler *eh, + struct cw_ElemHandlerParams *params, + uint8_t * data, int len) +{ + int wlan_id, radio_id; + char key[CW_KTV_MAX_KEY_LEN]; + + radio_id=cw_get_byte(data); + wlan_id=cw_get_word(data+1); + sprintf(key,"radio.%d/wlan.%d",radio_id,wlan_id); + cw_ktv_del_sub(params->conn->local_cfg,key); + cw_dbg(DBG_INFO,"Del WLAN rid=%d, id=%d",wlan_id); + return 0; +} + + + static int cisoc_add_wlan_mkkey(const char *pkey, uint8_t*data, int len, char *dst) { int wlan_id,radio_id; @@ -450,6 +468,25 @@ static int cisoc_add_wlan_mkkey(const char *pkey, uint8_t*data, int len, char *d return 1; } +static cw_KTVStruct_t cisco_add_lwwlan[]={ + {CW_TYPE_STR, "ssid",-1,10}, + {NULL,NULL,0,0} +}; + +static int cisoc_add_lwwlan_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+1); + 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}, @@ -1053,6 +1090,20 @@ static struct cw_ElemHandler handlers73[] = { cisoc_add_wlan_mkkey } , + + { + "Add Cisco WLAN (LWAPP)", /* name */ + CISCO_LWELEM_ADD_WLAN, /* Element ID */ + CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */ + 7,1117, /* min/max length */ + cisco_add_lwwlan, /* type */ + "radio/wlan", /* Key */ + cw_in_generic_struct, /* get */ + cw_out_generic_struct, /* put */ + cisoc_add_lwwlan_mkkey + } + , + { "SSC Hash Validation", /* name */ @@ -1077,6 +1128,18 @@ static struct cw_ElemHandler handlers73[] = { cw_out_generic_struct /* put */ } , + { + "Delete WLAN (Cisco LWAPP)", /* name */ + CISCO_LWELEM_DELETE_WLAN, /* Element ID */ + CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */ + 4,4, /* min/max length */ + NULL, /* type */ + "cisco-del-wlan", /* Key */ + cisco_in_lw_del_wlan, /* get */ + NULL, /* put */ + NULL + } + , {0,0,0,0,0,0,0,0} @@ -1241,6 +1304,9 @@ static struct cw_ElemDef configuration_update_request_elements[] ={ {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_ADD_WLAN, 0, 0}, + {CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_DELETE_WLAN, 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}, diff --git a/src/mod/cisco/cisco_actions_wtp.c b/src/mod/cisco/cisco_actions_wtp.c index 080206e8..cac45354 100644 --- a/src/mod/cisco/cisco_actions_wtp.c +++ b/src/mod/cisco/cisco_actions_wtp.c @@ -470,7 +470,7 @@ static cw_action_in_t actions80211_in[] = { .capwap_state = CW_STATE_RUN, .msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST, .vendor_id = LW_VENDOR_ID_CISCO, - .elem_id = LW_CISCO_ADD_WLAN, + .elem_id = CISCO_LWELEM_ADD_WLAN, // .item_id = CIPWAP_ITEM_AC_HASH_VALUE, // .start = cw_in_generic, //cisco_in_telnet_ssh .start = cisco_in_add_wlan diff --git a/src/mod/cisco/lwapp_cisco.h b/src/mod/cisco/lwapp_cisco.h index 2b1ccbca..4b7476f1 100644 --- a/src/mod/cisco/lwapp_cisco.h +++ b/src/mod/cisco/lwapp_cisco.h @@ -42,7 +42,7 @@ #define LW_CISCO_AP_HEARTBEAT_TIMEOUT 68 #define LW_CISCO_PRIMED_DISCOVERY_TIMEOUT 50 -#define LW_CISCO_DELETE_WLAN 52 +#define CISCO_LWELEM_DELETE_WLAN 52 #define CISCO_LWELEM_AP_FAILOVER_PRIORITY 53 #define CISCO_LWELEM_ROUGE_DETECTION 72 @@ -52,7 +52,7 @@ #define LW_CISCO_AP_DTLS_DATA_CFG 74 #define LW_CISCO_RAD_EXTENDED_CONFIG 111 -#define LW_CISCO_ADD_WLAN 128 +#define CISCO_LWELEM_ADD_WLAN 128 #define CISCO_LWELEM_VLAN 123 #define CISCO_LWELEM_SSC_HASH_VALIDATION 133 diff --git a/src/wtp/cisco.ktv b/src/wtp/cisco.ktv index f3841dc6..1936b1cd 100644 --- a/src/wtp/cisco.ktv +++ b/src/wtp/cisco.ktv @@ -18,7 +18,7 @@ ac-name-with-priority/ac2 :Byte: 5 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: 0 +capwap-control-ip-address/wtps.0 :Word: 1 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 @@ -29,8 +29,8 @@ cisco/ac-ip-addr-with-index.0 :IPAddress: 1.1.1.1 cisco/ac-ip-addr-with-index.1 :IPAddress: 9.9.9.9 cisco/ac-ip-addr-with-index.2 :IPAddress: 3.3.3.3 cisco/ap-core-dump/enable :Bool: false -cisco/ap-core-dump/filename :Str: -cisco/ap-core-dump/tftp-server :IPAddress: 0.0.0.0 +cisco/ap-core-dump/filename :Str: 7.7.7.7 +cisco/ap-core-dump/tftp-server :IPAddress: 7.7.7.7 cisco/ap-failover-priority :Byte: 3 cisco/ap-group-name :Bstr16: default-group cisco/ap-led-state-config/led-state :Byte: 1 @@ -56,7 +56,7 @@ 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: 1524480600 +cisco/ap-timesync/timestamp :Dword: 1524549734 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: @@ -97,7 +97,7 @@ cisco/vlan/id :Word: 0 cisco/vlan/tagging :Bool: false cisco/wtp-board-data/card-id :Word: 0 cisco/wtp-board-data/card-revision :Word: 0 -cisco/wtp-board-data/ethernet-mac-address :Bstr16: .xc47d4f3af8a6 +cisco/wtp-board-data/ethernet-mac-address :Bstr16: .xe47d4f3af8a6 cisco/wtp-board-data/failover-priority :Bstr16: .x01010003 cisco/wtp-board-data/options/ant-type :Byte: 1 cisco/wtp-board-data/options/ap-type :Byte: 0 @@ -132,12 +132,12 @@ radio.0/cisco/multi-domain-capability/reserved :Byte: 1 radio.0/cisco/tx-power/current-tx-power :Word: 0 radio.0/cisco/tx-power/reserved :Byte: 1 radio.0/cisco/wtp-radio-config/beacon-period :Word: 100 -radio.0/cisco/wtp-radio-config/bss-id :Bstr16: .x04fe7f499b90 +radio.0/cisco/wtp-radio-config/bss-id :Bstr16: .x04fe7f499b9000644445004445200a00010000c800 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-str1 :Bstr16: .x4445004445200a00010000c800 +radio.0/cisco/wtp-radio-config/country-str2 :Bstr16: .x4445200a00010000c800 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 @@ -180,12 +180,12 @@ radio.1/cisco/multi-domain-capability/reserved :Byte: 1 radio.1/cisco/tx-power/current-tx-power :Word: 0 radio.1/cisco/tx-power/reserved :Byte: 1 radio.1/cisco/wtp-radio-config/beacon-period :Word: 100 -radio.1/cisco/wtp-radio-config/bss-id :Bstr16: .x04fe7f499b90 +radio.1/cisco/wtp-radio-config/bss-id :Bstr16: .x04fe7f499b9000644445004445200a00010000c801 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-str1 :Bstr16: .x4445004445200a00010000c801 +radio.1/cisco/wtp-radio-config/country-str2 :Bstr16: .x4445200a00010000c801 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 @@ -203,6 +203,7 @@ 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 :Str: Schlosspark radio.1/wlan.0/ssid-a :Str: Schlosspark radio.1/wlan.0/wep-key :Bstr16: .xaa0c0a02000000000000000000 radio.1/wlan.0/wlan-capability :Word: 1