From 63608bb0319ec133f54749f2f383092ae104cc1c Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Sat, 2 Apr 2016 16:44:56 +0000 Subject: [PATCH] cisco_in_wtp_radio_cofniguration mostly completed. FossilOrigin-Name: d6429b618eff398c654ae935a822fc37f5cb066247abb33415324aef972ccad6 --- src/ac/Makefile | 2 +- src/cw/capwap80211_items.c | 4 +++ src/cw/capwap80211_items.h | 8 ++++++ src/cw/mbag_type_data.c | 26 ++++++++++++++++++- src/mod/cipwap/cipwap_items.c | 2 ++ src/mod/cipwap/cipwap_items.h | 1 + src/mod/cisco/cisco.h | 2 ++ .../cisco80211_in_wtp_radio_configuration.c | 10 +++++++ src/mod/cisco/cisco_actions_wtp.c | 14 ++++++++++ src/mod/cisco/cisco_items.c | 6 ++++- src/mod/cisco/cisco_items.h | 2 ++ 11 files changed, 74 insertions(+), 3 deletions(-) diff --git a/src/ac/Makefile b/src/ac/Makefile index 5700e142..cbafdcf0 100644 --- a/src/ac/Makefile +++ b/src/ac/Makefile @@ -15,10 +15,10 @@ CFLAGS += -Wall -g -O0 -D_REENTRANT -DIPV6 -I/usr/local/include -I../ -DSYS_ARCH LIBS+=-lcapwap +LIBS+=-lcapwap80211 LIBS+=-lcipwap LIBS+=-lcisco LIBS+=-lfortinet -LIBS+=-lcapwap80211 LIBS+=-lcw LIBS+=-lrt LIBS+=-lpthread diff --git a/src/cw/capwap80211_items.c b/src/cw/capwap80211_items.c index c8791bda..dab08e1d 100644 --- a/src/cw/capwap80211_items.c +++ b/src/cw/capwap80211_items.c @@ -19,6 +19,8 @@ const char CW_RADIOITEM80211_RX_MSDU_LIFETIME[]="rx_msdu_lifetime"; /* Radio Config Items */ const char CW_RADIOITEM80211_SHORT_PREAMBLE[]="short_preamble"; const char CW_RADIOITEM80211_NUM_BSS_IDS[]="num_bss_ids"; +const char CW_RADIOITEM80211_DTIM_PERIOD[]="dtim_period"; +const char CW_RADIOITEM80211_BSSID[]="bssid"; const char CW_RADIOITEM80211_BEACON_PERIOD[]="beacon_period"; const char CW_RADIOITEM80211_COUNTRY_STRING[]="country_string"; @@ -51,6 +53,8 @@ struct cw_itemdef capwap80211_radioitemdefs[] = { /* Radio Config Items */ {CW_RADIOITEM80211_SHORT_PREAMBLE,CW_ITEM_NONE,MBAG_BYTE}, {CW_RADIOITEM80211_NUM_BSS_IDS,CW_ITEM_NONE,MBAG_BYTE}, + {CW_RADIOITEM80211_DTIM_PERIOD,CW_ITEM_NONE,MBAG_BYTE}, + {CW_RADIOITEM80211_BSSID,CW_ITEM_NONE,MBAG_BYTE}, {CW_RADIOITEM80211_BEACON_PERIOD,CW_ITEM_NONE,MBAG_WORD}, {CW_RADIOITEM80211_COUNTRY_STRING,CW_ITEM_NONE,MBAG_BSTR16}, diff --git a/src/cw/capwap80211_items.h b/src/cw/capwap80211_items.h index 7d64bd18..2fe931fe 100644 --- a/src/cw/capwap80211_items.h +++ b/src/cw/capwap80211_items.h @@ -19,6 +19,14 @@ extern const char CW_RADIOITEM80211_LONG_RETRY[]; extern const char CW_RADIOITEM80211_TX_MSDU_LIFETIME[]; extern const char CW_RADIOITEM80211_RX_MSDU_LIFETIME[]; +/* Radio Config Items */ +extern const char CW_RADIOITEM80211_SHORT_PREAMBLE[]; +extern const char CW_RADIOITEM80211_NUM_BSS_IDS[]; +extern const char CW_RADIOITEM80211_DTIM_PERIOD[]; +extern const char CW_RADIOITEM80211_BSSID[]; +extern const char CW_RADIOITEM80211_BEACON_PERIOD[]; +extern const char CW_RADIOITEM80211_COUNTRY_STRING[]; + #endif diff --git a/src/cw/mbag_type_data.c b/src/cw/mbag_type_data.c index ac8a4f77..305b4f72 100644 --- a/src/cw/mbag_type_data.c +++ b/src/cw/mbag_type_data.c @@ -36,8 +36,32 @@ static struct mbag_item * from_str(const char *src) } +static struct mbag_item * get(const uint8_t *src,int len) +{ + + mbag_item_t * item = mbag_item_new(MBAG_DATA); + if (!item) + return NULL; + + uint8_t *data = malloc(len+1); + if (!data){ + free (item); + return NULL; + } + *data=len; + memcpy(data+1,src,len); + item->data=data; + return item; +} + + const struct mbag_typedef mbag_type_data = { - "Data",free,to_str,from_str + .name = "Binary Data", + .del = free, + .from_str = from_str, + .to_str = to_str, + .get = get + }; diff --git a/src/mod/cipwap/cipwap_items.c b/src/mod/cipwap/cipwap_items.c index e6546472..4b61a600 100644 --- a/src/mod/cipwap/cipwap_items.c +++ b/src/mod/cipwap/cipwap_items.c @@ -23,11 +23,13 @@ struct cw_itemdef cipwap_itemdefs[] = { const char CIPWAP_RADIOITEM80211_OCCUPANCY_LIMIT[]="occupancy_limit"; const char CIPWAP_RADIOITEM80211_CFP_PERIOD[]="cfp_period"; +const char CIPWAP_RADIOITEM80211_CFP_MAXIMUM_DURATION[]="cfp_max_duration"; struct cw_itemdef cipwap_radioitemdefs[] = { {CIPWAP_RADIOITEM80211_OCCUPANCY_LIMIT,CW_ITEM_NONE,MBAG_WORD}, {CIPWAP_RADIOITEM80211_CFP_PERIOD,CW_ITEM_NONE,MBAG_BYTE}, + {CIPWAP_RADIOITEM80211_CFP_MAXIMUM_DURATION,CW_ITEM_NONE,MBAG_WORD}, {CW_ITEM_NONE} diff --git a/src/mod/cipwap/cipwap_items.h b/src/mod/cipwap/cipwap_items.h index 29a751f9..d78551b4 100644 --- a/src/mod/cipwap/cipwap_items.h +++ b/src/mod/cipwap/cipwap_items.h @@ -7,6 +7,7 @@ extern const char CIPWAP_ITEM_AP_HASH_VALUE[]; extern const char CIPWAP_RADIOITEM80211_OCCUPANCY_LIMIT[]; extern const char CIPWAP_RADIOITEM80211_CFP_PERIOD[]; +extern const char CIPWAP_RADIOITEM80211_CFP_MAXIMUM_DURATION[]; extern struct cw_itemdef cipwap_itemdefs[]; extern struct cw_itemdef cipwap_radioitemdefs[]; diff --git a/src/mod/cisco/cisco.h b/src/mod/cisco/cisco.h index fb6c52f5..56b2a737 100644 --- a/src/mod/cisco/cisco.h +++ b/src/mod/cisco/cisco.h @@ -36,5 +36,7 @@ int cisco_out_radio_administrative_states(struct conn *conn, struct cw_action_ou int cisco80211_in_mac_operation(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len, struct sockaddr *from); +int cisco80211_in_wtp_radio_configuration(struct conn *conn, struct cw_action_in *a, uint8_t * data, + int len, struct sockaddr *from); #endif diff --git a/src/mod/cisco/cisco80211_in_wtp_radio_configuration.c b/src/mod/cisco/cisco80211_in_wtp_radio_configuration.c index 12bc6b40..a173d043 100644 --- a/src/mod/cisco/cisco80211_in_wtp_radio_configuration.c +++ b/src/mod/cisco/cisco80211_in_wtp_radio_configuration.c @@ -5,6 +5,7 @@ #include "cw/dbg.h" #include "include/cipwap_items.h" +#include "cw/capwap80211_items.h" #include "cisco_items.h" @@ -21,7 +22,16 @@ int cisco80211_in_wtp_radio_configuration(struct conn *conn, struct cw_action_in mbag_set_byte(r,CISCO_RADIOITEM80211_CFG_TYPE,cw_get_byte(data+1)); mbag_set_word(r,CIPWAP_RADIOITEM80211_OCCUPANCY_LIMIT,cw_get_word(data+2)); mbag_set_byte(r,CIPWAP_RADIOITEM80211_CFP_PERIOD,cw_get_byte(data+4)); + mbag_set_word(r,CIPWAP_RADIOITEM80211_CFP_MAXIMUM_DURATION,cw_get_word(data+5)); + struct mbag_item * bssid = MBAG_DATA->get(data+7,6); + bssid->id=CW_RADIOITEM80211_BSSID; + mbag_set(r,bssid); + + mbag_set_word(r,CW_RADIOITEM80211_BEACON_PERIOD,cw_get_word(data+13)); + mbag_set_bstr16n(r,CW_RADIOITEM80211_COUNTRY_STRING,data+15,3); + mbag_set_bstr16n(r,CISCO_RADIOITEM80211_COUNTRY_STR1,data+15,3); + mbag_set_bstr16n(r,CISCO_RADIOITEM80211_COUNTRY_STR2,data+18,3); return 1; diff --git a/src/mod/cisco/cisco_actions_wtp.c b/src/mod/cisco/cisco_actions_wtp.c index 0f1e9f58..aab9d4aa 100644 --- a/src/mod/cisco/cisco_actions_wtp.c +++ b/src/mod/cisco/cisco_actions_wtp.c @@ -141,6 +141,20 @@ static cw_action_in_t actions_in[] = { */ + /* Element Cisco 802.11 Radio Conffig - Config Status Resp */ + { + .capwap_state = CW_STATE_CONFIGURE, + .msg_id = CW_MSG_CONFIGURATION_STATUS_RESPONSE, + .vendor_id = CW_VENDOR_ID_CISCO, + .elem_id = CW_CISCO_WTP_RADIO_CFG, + .start=cisco80211_in_wtp_radio_configuration, + .item_id = "cisco_radio_cfg", + } + , + + + + { /* Cisco's Vendor specific encapsulation * of LWAPP elements */ diff --git a/src/mod/cisco/cisco_items.c b/src/mod/cisco/cisco_items.c index da6049ca..fe71a8d4 100644 --- a/src/mod/cisco/cisco_items.c +++ b/src/mod/cisco/cisco_items.c @@ -13,10 +13,14 @@ struct cw_itemdef cisco_itemdefs[] = { const char CISCO_RADIOITEM80211_CFG_TYPE[]="cisco_radio_cfg_type"; +const char CISCO_RADIOITEM80211_COUNTRY_STR1[]="cisco_country_str1"; +const char CISCO_RADIOITEM80211_COUNTRY_STR2[]="cisco_country_str2"; -struct cw_itemdef cisco_iradioitemdefs[] = { +struct cw_itemdef cisco_radioitemdefs[] = { {CISCO_RADIOITEM80211_CFG_TYPE,CW_ITEM_NONE,MBAG_BYTE}, + {CISCO_RADIOITEM80211_COUNTRY_STR1,CW_ITEM_NONE,MBAG_BSTR}, + {CISCO_RADIOITEM80211_COUNTRY_STR2,CW_ITEM_NONE,MBAG_BSTR}, {CW_ITEM_NONE} }; diff --git a/src/mod/cisco/cisco_items.h b/src/mod/cisco/cisco_items.h index 80b652a3..cd05224c 100644 --- a/src/mod/cisco/cisco_items.h +++ b/src/mod/cisco/cisco_items.h @@ -6,6 +6,8 @@ extern const char CISCO_ITEM_AP_MODE_AND_TYPE[]; extern struct cw_itemdef cisco_itemdefs[]; extern const char CISCO_RADIOITEM80211_CFG_TYPE[]; +extern const char CISCO_RADIOITEM80211_COUNTRY_STR1[]; +extern const char CISCO_RADIOITEM80211_COUNTRY_STR2[]; extern struct cw_itemdef cisco_radioitemdefs[];