diff --git a/actube.workspace b/actube.workspace index e0162c79..c63c2d68 100644 --- a/actube.workspace +++ b/actube.workspace @@ -4,8 +4,8 @@ - - + + diff --git a/src/cw/cw_put_msg.c b/src/cw/cw_put_msg.c index 2ddd8c47..f817bba4 100644 --- a/src/cw/cw_put_msg.c +++ b/src/cw/cw_put_msg.c @@ -61,6 +61,9 @@ int cw_put_msg(struct conn *conn, uint8_t * rawout) return CAPWAP_RESULT_MSG_UNRECOGNIZED; } + if (msg->preprocess){ + msg->preprocess(conn); + } cw_dbg(DBG_MSG_ASSEMBLY,"*** Assenmbling message of type %d (%s) ***", msg->type, msg->name); diff --git a/src/cw/msgset.c b/src/cw/msgset.c index 8d6ec725..1942ecdf 100644 --- a/src/cw/msgset.c +++ b/src/cw/msgset.c @@ -280,6 +280,7 @@ int cw_msgset_add(struct cw_MsgSet *set, msg->mand_keys=NULL; msg->elements_list = mlist_create(cmp_elemdata,NULL,sizeof(struct cw_ElemData)); msg->postprocess=NULL; + msg->preprocess=NULL; } /* Overwrite the found message */ @@ -289,6 +290,8 @@ int cw_msgset_add(struct cw_MsgSet *set, msg->states = msgdef->states; if (msgdef->postprocess != NULL) msg->postprocess = msgdef->postprocess; + if (msgdef->preprocess != NULL) + msg->preprocess = msgdef->preprocess; msg->receiver = msgdef->receiver; diff --git a/src/cw/msgset.h b/src/cw/msgset.h index e1b71815..0de3472c 100644 --- a/src/cw/msgset.h +++ b/src/cw/msgset.h @@ -70,6 +70,7 @@ struct cw_MsgDef{ struct cw_ElemDef * elements; + int (*preprocess)(struct conn * conn); int (*postprocess)(struct conn * conn); }; @@ -83,6 +84,7 @@ struct cw_MsgData{ mlist_t elements_list; mlist_t mand_keys; /**< Keys of mandatory elements */ + int (*preprocess)(struct conn * conn); int (*postprocess)(struct conn * conn); }; diff --git a/src/mod/capwap/capwap_actions_ac.c b/src/mod/capwap/capwap_actions_ac.c index 12e1a9a1..83311063 100644 --- a/src/mod/capwap/capwap_actions_ac.c +++ b/src/mod/capwap/capwap_actions_ac.c @@ -40,20 +40,17 @@ static cw_KTVStruct_t wtp_reboot_statistics[] = { }; static cw_KTVStruct_t capwap_timers[] = { - {CW_TYPE_BYTE, "max-discovery-interval", 1,-1}, {CW_TYPE_BYTE, "echo-interval", 1,-1}, {NULL,NULL,0,0} }; static cw_KTVStruct_t radio_operational_state[] = { - {CW_TYPE_BYTE, "state", 1,-1}, {CW_TYPE_BYTE, "cause", 1,-1}, {NULL,NULL,0,0} }; - static struct cw_ElemHandler handlers[] = { { diff --git a/src/mod/cisco/cisco_actions_ac.c b/src/mod/cisco/cisco_actions_ac.c index a7604f70..7181188a 100644 --- a/src/mod/cisco/cisco_actions_ac.c +++ b/src/mod/cisco/cisco_actions_ac.c @@ -31,6 +31,7 @@ #include "cw/format.h" static int postprocess_discovery(); +static int preprocess_join_request(); @@ -295,7 +296,7 @@ static cw_KTVStruct_t cisco_ap_model[]={ {NULL,NULL,0,0} }; -static cw_KTVStruct_t cisco_wtp_radio_config[]={ +static cw_KTVStruct_t cisco_wtp_radio_config73[]={ {CW_TYPE_BYTE,"cfg-type",1,-1}, {CW_TYPE_WORD,"occupancy-limit",2,-1}, {CW_TYPE_BYTE,"cfg-period",1,-1}, @@ -310,6 +311,25 @@ static cw_KTVStruct_t cisco_wtp_radio_config[]={ {NULL,NULL,0,0} }; +static cw_KTVStruct_t cisco_wtp_radio_config75[]={ + {CW_TYPE_BYTE,"cfg-type",1,-1}, + {CW_TYPE_WORD,"occupancy-limit",2,-1}, + {CW_TYPE_BYTE,"cfg-period",1,-1}, + {CW_TYPE_WORD,"cfp-maximum-duration",2,-1}, + {CW_TYPE_BSTR16,"bss-id",6,-1}, + {CW_TYPE_WORD,"beacon-period",2,-1}, + {CW_TYPE_BSTR16,"country-str1",3,-1}, + {CW_TYPE_BSTR16,"country-str2",3,-1}, + {CW_TYPE_BYTE,"gpr-period",1,-1}, + {CW_TYPE_DWORD,"reg",4,-1}, + {CW_TYPE_BYTE,"max-stations",1,-1}, + {CW_TYPE_BYTE,"unknown75",1,-1}, + {NULL,NULL,0,0} +}; + + + + static cw_KTVStruct_t cisco_tx_power[]={ {CW_TYPE_BYTE,"reserved",1,-1}, {CW_TYPE_WORD,"current-tx-power",2,-1}, @@ -437,7 +457,7 @@ static cw_KTVStruct_t cisco_ssc_hash[]={ }; -static struct cw_ElemHandler handlers[] = { +static struct cw_ElemHandler handlers73[] = { { "AC Name -(zero-length allowed)", /* name */ @@ -839,7 +859,7 @@ static struct cw_ElemHandler handlers[] = { CISCO_ELEM_WTP_RADIO_CONFIGURATION, /* Element ID */ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ 27,27, /* min/max length */ - cisco_wtp_radio_config, /* type */ + cisco_wtp_radio_config73, /* type */ "cisco/wtp-radio-config", /* Key */ cw_in_radio_generic_struct, /* get */ cw_out_radio_generic_struct /* put */ @@ -1257,6 +1277,7 @@ static struct cw_MsgDef messages[] = { CW_ROLE_AC, /* role */ discovery_request_states, /* states */ discovery_request_elements, /* elements */ + NULL, /* preprocess fun */ postprocess_discovery /* postprocess fun */ }, { @@ -1273,6 +1294,7 @@ static struct cw_MsgDef messages[] = { CW_ROLE_AC, join_request_states, join_request_elements, + preprocess_join_request, /* preprocess fun */ postprocess_discovery /* postprocess */ }, { @@ -1342,11 +1364,30 @@ static struct cw_MsgDef messages[] = { }; +static struct cw_ElemHandler handlers75[] = { + { + "WTP Radio Configuration (Version >= 7.5)",/* name */ + CISCO_ELEM_WTP_RADIO_CONFIGURATION, /* Element ID */ + CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ + 28,28, /* min/max length */ + cisco_wtp_radio_config75, /* type */ + "cisco/wtp-radio-config", /* Key */ + cw_in_radio_generic_struct, /* get */ + cw_out_radio_generic_struct /* put */ + } + , + {0,0,0,0,0,0,0,0} +}; + +static struct cw_MsgDef messages75[] = { + {0,0,0,0} +}; + struct cw_MsgSet * cisco_register_msg_set(struct cw_MsgSet * set, int mode){ if (mode != CW_MOD_MODE_CAPWAP) return NULL; - cw_msgset_add(set,messages, handlers); + cw_msgset_add(set,messages, handlers73); return set; } @@ -1360,21 +1401,63 @@ static void set_ac_version(struct conn * conn) if (wtpver){ cw_format_version(verstr,wtpver->type->data(wtpver),wtpver->type->len(wtpver)); - cw_dbg(DBG_INFO, "Cisco - Setting AC software version to: %s", verstr); - + mavl_del(conn->local_cfg,&wtpver); cw_ktv_add(conn->local_cfg,"ac-descriptor/software/version",CW_TYPE_BSTR16, wtpver->type->data(wtpver),wtpver->type->len(wtpver)); - } + if(wtpver->type->len(wtpver)==4){ + uint32_t rv; + rv = cw_get_dword(wtpver->type->data(wtpver)); + if (rv >= 0x07056600){ + cw_msgset_add(conn->msgset,messages75, handlers75); + } + } + } } static int postprocess_discovery(struct conn *conn) { - if (conn->role != CW_ROLE_AC ) - return 0; - set_ac_version(conn); - cw_detect_nat(conn); + if (conn->role == CW_ROLE_AC ){ + set_ac_version(conn); + cw_detect_nat(conn); + } return 1; } + +static int preprocess_join_request(struct conn *conn) +{ + cw_KTV_t * ver; + int use_ac_version; + char verstr[512]; + + if (conn->role != CW_ROLE_WTP) + return 0; + + use_ac_version = cw_ktv_get_bool(conn->local_cfg,"cisco/wtp-use-ac-version",0); + + if (use_ac_version){ + ver = cw_ktv_get(conn->remote_cfg,"ac-descriptor/software/version", CW_TYPE_BSTR16); + cw_ktv_replace(conn->local_cfg,"wtp-descriptor/software/version",CW_TYPE_BSTR16, + ver->type->data(ver),ver->type->len(ver)); + + cw_format_version(verstr,ver->type->data(ver),ver->type->len(ver)); + cw_dbg(DBG_INFO, "Cisco WTP - Using AC's software version: %s", verstr); + + } + else{ + ver = cw_ktv_get(conn->local_cfg,"wtp-descriptor/software/version", CW_TYPE_BSTR16); + cw_format_version(verstr,ver->type->data(ver),ver->type->len(ver)); + cw_dbg(DBG_INFO, "Cisco - WTP Using own software version: %s", verstr); + } + + if(ver->type->len(ver)==4){ + uint32_t rv; + rv = cw_get_dword(ver->type->data(ver)); + if (rv >= 0x07056600){ + cw_msgset_add(conn->msgset,messages75, handlers75); + } + } + return 1; +} \ No newline at end of file diff --git a/src/wtp/cisco.ktv b/src/wtp/cisco.ktv index 27269450..f3841dc6 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: 1 +capwap-control-ip-address/wtps.0 :Word: 0 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 @@ -43,28 +43,28 @@ cisco/ap-power-injector-config/selection :Byte: 0 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/code0 :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/code0 :Byte: 0 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: 1524467346 +cisco/ap-timesync/timestamp :Dword: 1524480600 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: cisco/ap-username-and-password/802.1x-credentials/username :Str: -cisco/ap-username-and-password/login-credentials/enable-password :Str: $1$2Iyi$8m7Disb6SL0kuwPU5.6tN. -cisco/ap-username-and-password/login-credentials/option :Word: 513 -cisco/ap-username-and-password/login-credentials/password :Str: $1$N03U$Y1wEFRdFpNF/YjQf0e.Vc0 -cisco/ap-username-and-password/login-credentials/username :Str: Tobias +cisco/ap-username-and-password/login-credentials/enable-password :Str: $1$nPEe$k81RL0xZkiYryiUh.yM2J1 +cisco/ap-username-and-password/login-credentials/option :Word: 1025 +cisco/ap-username-and-password/login-credentials/password :Str: $1$R1hh$.3Jgrg.1DHuxmiQVDNqxB. +cisco/ap-username-and-password/login-credentials/username :Str: admin cisco/ap-venue-settings/group :Word: 2 cisco/ap-venue-settings/language :Str: en cisco/ap-venue-settings/name :Str: @@ -82,7 +82,7 @@ cisco/lw_path_mtu/max :Word: 1485 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-hash-value :Bstr16: 88ba29f4725fcbc8fd02843186b94692f107ecb0 cisco/mwar-type :Byte: 1 cisco/rouge-and-mss/enable :Bool: false cisco/rouge-and-mss/mss :Word: 666 @@ -106,6 +106,7 @@ cisco/wtp-board-data/options/flex-connect :Byte: 1 cisco/wtp-board-data/wtp-model-hi :Dword: 0 cisco/wtp-board-data/wtp-model-lo :Dword: 0 cisco/wtp-board-data/wtp-serial-number :Str: FCZ1406W232 +cisco/wtp-use-ac-version :Bool: true discovery-type :Byte: 0 idle-timeout :Dword: 300 location-data :Bstr16: "superposition\"tobias" @@ -136,11 +137,12 @@ 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 radio.0/cisco/wtp-radio-config/reg :Dword: 65536 +radio.0/cisco/wtp-radio-config/unknown75 :Byte: 0 radio.0/decryption-error-report-period :Word: 120 radio.0/operational-state/cause :Byte: 0 radio.0/operational-state/state :Byte: 2 @@ -177,17 +179,18 @@ radio.1/cisco/multi-domain-capability/number-of-channels :Word: 4 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: 999 +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/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 radio.1/cisco/wtp-radio-config/reg :Dword: 65536 +radio.1/cisco/wtp-radio-config/unknown75 :Byte: 1 radio.1/decryption-error-report-period :Word: 120 radio.1/operational-state/cause :Byte: 0 radio.1/operational-state/state :Byte: 2 @@ -237,7 +240,7 @@ wtp-descriptor/hardware/version :Bstr16: .x01000000 wtp-descriptor/max-radios :Byte: 2 wtp-descriptor/radios-in-use :Byte: 2 wtp-descriptor/software/vendor :Dword: 4232704 -wtp-descriptor/software/version :Bstr16: .x06036500 +wtp-descriptor/software/version :Bstr16: .x07056600 wtp-fallback :Byte: 1 wtp-frame-tunnel-mode :Byte: 4 wtp-mac-type :Byte: 1