From 7bedc7659b282b7e52da4cc7c2faee3ca5e66e7d Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Mon, 9 Apr 2018 07:27:38 +0000 Subject: [PATCH] handlers for header_len and write_headr in conn FossilOrigin-Name: 672de93a2c0d038b6d8c9104a8e0b4fdacbe7f181485ee2f185cb81626876391 --- libcw.project | 1 + src/ac/config.ktv | 10 +++--- src/cw/conn.h | 4 ++- src/cw/conn_create.c | 3 ++ src/cw/conn_init.c | 18 +++++++++- src/cw/cw_ktv_write_struct.c | 9 ++--- src/cw/cw_out_generic.c | 10 ++++-- src/cw/cw_out_generic_struct.c | 13 +++++--- src/cw/cw_read_ac_descriptor.c | 2 +- src/cw/cw_write_header.c | 12 +++++++ src/mod/capwap/capwap_actions_ac.c | 2 +- src/mod/cisco/capwap_cisco.h | 2 +- src/mod/cisco/cisco_actions_ac.c | 44 ++++++++++++++++++++++--- src/mod/cisco/cisco_out_ac_descriptor.c | 14 ++++---- src/mod/cisco/lwapp_cisco.h | 2 +- src/mod/cisco/mod_cisco_ac.c | 40 +++++++++++++++++++--- src/wtp/Makefile | 2 +- src/wtp/configure.c | 37 ++++++++------------- src/wtp/wtp_main.c | 6 +++- 19 files changed, 167 insertions(+), 64 deletions(-) create mode 100644 src/cw/cw_write_header.c diff --git a/libcw.project b/libcw.project index 2553b03d..c38ad210 100644 --- a/libcw.project +++ b/libcw.project @@ -283,6 +283,7 @@ + diff --git a/src/ac/config.ktv b/src/ac/config.ktv index b9214213..1105dbd8 100644 --- a/src/ac/config.ktv +++ b/src/ac/config.ktv @@ -17,10 +17,11 @@ capwap/ac-descriptor/hardware/vendor:Bstr16: 12346 #ac-descriptor/station-limit :Word: 1000 #ac-descriptor/stations :Word: 0 -ac-descriptor/dtls-policy :Byte: 0 +ac-descriptor/dtls-policy :Byte: 1 ac-descriptor/hardware/vendor :Dword: 4232704 ac-descriptor/hardware/version :Bstr16: .x01000001 ac-descriptor/max-wtps :Word: 200 +ac-descriptor/active-wtps: Word: 2 ac-descriptor/r-mac-field :Byte: 1 ac-descriptor/reserved1 :Byte: 0 ac-descriptor/security :Byte: 2 @@ -30,11 +31,7 @@ ac-descriptor/station-limit :Word: 1000 ac-descriptor/stations :Word: 0 ac-name :Bstr16: CiscoAC73 capwap-control-ip-address/address.0 :IPAddress: 192.168.0.14 -capwap-control-ip-address/address.1 :IPAddress: d96c:4c0a:da6c:4c0a:db6c:4c0a:dc6c:4c0a -capwap-control-ip-address/address.2 :IPAddress: 192.168.0.14 capwap-control-ip-address/wtps.0 :Word: 2 -capwap-control-ip-address/wtps.1 :Word: 10 -capwap-control-ip-address/wtps.2 :Word: 2 cisco/mwar-type :Byte: 0 maximum-message-length :Word: 4096 radio/0/wtp-radio-information :Dword: 7 @@ -54,7 +51,8 @@ capwap-control-ip-address/wtps.0:Word:0 cisco/ssl-keyfile:Str:"../../ssl/certs/ac-cisco.key" cisco/ssl-certfile:Str:"../../ssl/certs/ac-cisco.pem" -cisco/ssl-cipher:Str:+DHE-RSA:+AES-256-CBC:+AES-128-CBC:+SHA1:+PSK +cisco/ssl-cipher:Str:NORMAL +#+DHE-RSA:+AES-256-CBC:+AES-128-CBC:+SHA1:+PSK cisco/ssl-dhbits:Word:2048 capwap/ssl-cipher:Str:+DHE-RSA:+RSA:+AES-256-CBC:+AES-128-CBC:+SHA1:+PSK diff --git a/src/cw/conn.h b/src/cw/conn.h index 27904277..e423ed32 100644 --- a/src/cw/conn.h +++ b/src/cw/conn.h @@ -40,6 +40,7 @@ #include "intavltree.h" #include "bstr.h" +#include "msgset.h" #include "mod.h" @@ -75,7 +76,8 @@ struct conn { mavl_t local_cfg; mavl_t global_cfg; - + int (*write_header)(struct cw_ElemHandler * handler, uint8_t * dst, int len); + int (*header_len)(struct cw_ElemHandler *handler); /* mbag_t outgoing; mbag_t incomming; diff --git a/src/cw/conn_create.c b/src/cw/conn_create.c index 448aa2ad..64100f19 100644 --- a/src/cw/conn_create.c +++ b/src/cw/conn_create.c @@ -30,6 +30,9 @@ #include "conn.h" #include "sock.h" +#include "msgset.h" +#include "cw.h" + /** diff --git a/src/cw/conn_init.c b/src/cw/conn_init.c index a9fd12b9..7f6f12ac 100644 --- a/src/cw/conn_init.c +++ b/src/cw/conn_init.c @@ -27,6 +27,21 @@ #include "conn.h" #include "capwap.h" +#include "cw.h" + +static int write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len) +{ + if (handler->vendor) + return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len); + + return len + cw_put_elem_hdr(dst, handler->id, len); +} + +static int header_len(struct cw_ElemHandler * handler) +{ + return handler->vendor ? 10 : 4; +} + /** * Basic initialization of a conn object @@ -48,7 +63,8 @@ void conn_init(struct conn * conn) conn->process_packet=conn_process_packet; conn->process_message=process_message; - + conn->write_header = write_header; + conn->header_len = header_len; } diff --git a/src/cw/cw_ktv_write_struct.c b/src/cw/cw_ktv_write_struct.c index 27b56dad..17de460e 100644 --- a/src/cw/cw_ktv_write_struct.c +++ b/src/cw/cw_ktv_write_struct.c @@ -21,11 +21,12 @@ int cw_ktv_write_struct(mavl_t ktv, const cw_KTVStruct_t * stru, const char *pke result = cw_ktv_get(ktv,key,stru[i].type); if (result == NULL){ - cw_log(LOG_ERR,"Can't put %s, no value found",key); - continue; + cw_log(LOG_ERR,"Can't put %s, no value found, filling zero.",key); + memset(dst+pos,0,stru[i].len); + } + else{ + result->type->put(result,dst+pos); } - - result->type->put(result,dst+pos); pos+=stru[i].len; diff --git a/src/cw/cw_out_generic.c b/src/cw/cw_out_generic.c index fefbc992..8acf4764 100644 --- a/src/cw/cw_out_generic.c +++ b/src/cw/cw_out_generic.c @@ -44,17 +44,21 @@ int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams /* Size for msg elem header depends on vendor specific payload */ - start = handler->vendor ? 10 : 4; + /* start = handler->vendor ? 10 : 4; */ + start = params->conn->header_len(handler); + len = ((const cw_Type_t*)(handler->type))->put(elem,dst+start); /* ((const cw_Type_t*)(handler->type))->to_str(elem,detail,120); sprintf(params->debug_details, " Value = %s", detail); params->elem = elem;*/ - if (handler->vendor) +/* if (handler->vendor) return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len); - l = len + cw_put_elem_hdr(dst, handler->id, len); + l = len + cw_put_elem_hdr(dst, handler->id, len); */ + l = params->conn->write_header(handler,dst,len); + cw_dbg_elem(DBG_ELEM_OUT,params->conn,params->msgdata->type,handler,dst,l); return l; } diff --git a/src/cw/cw_out_generic_struct.c b/src/cw/cw_out_generic_struct.c index 42d1152f..3615e16d 100644 --- a/src/cw/cw_out_generic_struct.c +++ b/src/cw/cw_out_generic_struct.c @@ -10,20 +10,25 @@ int cw_out_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandler int start; int len,l; - start = handler->vendor ? 10 : 4; + if (!handler->type){ cw_log(LOG_ERR,"Can't handle element: %s, no type defined",handler->name); - return CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT; + return 0; } + + start = params->conn->header_len(handler); + len = cw_ktv_write_struct(params->conn->local_cfg,handler->type,handler->key,dst+start); - if (handler->vendor) + return params->conn->write_header(handler,dst,len); + +/* if (handler->vendor) return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len); l = len + cw_put_elem_hdr(dst, handler->id, len); - +*/ return l; diff --git a/src/cw/cw_read_ac_descriptor.c b/src/cw/cw_read_ac_descriptor.c index 7a746773..e8e85717 100644 --- a/src/cw/cw_read_ac_descriptor.c +++ b/src/cw/cw_read_ac_descriptor.c @@ -13,7 +13,7 @@ cw_KTVStruct_t acstatus [] = { /* type key len, pos */ {CW_TYPE_WORD, "stations", 2, -1}, {CW_TYPE_WORD, "station-limit", 2, -1}, - {CW_TYPE_WORD, "avtive-wtps", 2, -1}, + {CW_TYPE_WORD, "active-wtps", 2, -1}, {CW_TYPE_WORD, "max-wtps", 2, -1}, {CW_TYPE_BYTE, "security", 1, -1}, {CW_TYPE_BYTE, "r-mac-field", 1, -1}, diff --git a/src/cw/cw_write_header.c b/src/cw/cw_write_header.c new file mode 100644 index 00000000..e55cff8f --- /dev/null +++ b/src/cw/cw_write_header.c @@ -0,0 +1,12 @@ + +#include "msgset.h" +#include "cw.h" + +int cw_write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len) +{ + if (handler->vendor) + return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len); + + return len + cw_put_elem_hdr(dst, handler->id, len); +} + diff --git a/src/mod/capwap/capwap_actions_ac.c b/src/mod/capwap/capwap_actions_ac.c index acb389ef..9ee2018c 100644 --- a/src/mod/capwap/capwap_actions_ac.c +++ b/src/mod/capwap/capwap_actions_ac.c @@ -35,7 +35,7 @@ static cw_KTVStruct_t wtp_reboot_statistics[] = { {CW_TYPE_WORD, "hw-failure-count", 2,-1}, {CW_TYPE_WORD, "other-failure-count", 2,-1}, {CW_TYPE_WORD, "unknown-failure-count", 2,-1}, - {CW_TYPE_WORD, "last-failure-type", 2,-1}, + {CW_TYPE_BYTE, "last-failure-type", 1,-1}, {NULL,NULL,0,0} }; diff --git a/src/mod/cisco/capwap_cisco.h b/src/mod/cisco/capwap_cisco.h index 1ded8bfe..8da3434b 100644 --- a/src/mod/cisco/capwap_cisco.h +++ b/src/mod/cisco/capwap_cisco.h @@ -82,7 +82,7 @@ #define CW_CISCO_AP_MODEL 127 #define CW_CISCO_AP_RESET_BUTTON_STATE 128 -#define CW_CISCO_AP_REGULATORY_DOMAIN 126 +#define CISCO_ELEM_AP_REGULATORY_DOMAIN 126 #define CW_CISCO_LWAPP_CHANNEL_POWER 134 #define CW_CISCO_AP_CORE_DUMP 135 diff --git a/src/mod/cisco/cisco_actions_ac.c b/src/mod/cisco/cisco_actions_ac.c index 3f144e3e..7b7e6dfa 100644 --- a/src/mod/cisco/cisco_actions_ac.c +++ b/src/mod/cisco/cisco_actions_ac.c @@ -122,6 +122,14 @@ static cw_KTVStruct_t cisco_ap_static_ip_addr[]={ }; +static cw_KTVStruct_t cisco_ap_regulatory_domain[]={ + {CW_TYPE_BOOL,"set",1,-1}, + {CW_TYPE_BYTE,"slot",1,-1}, + {CW_TYPE_BYTE,"code0",1,-1}, + {CW_TYPE_BYTE,"code1",1,-1}, + {NULL,NULL,0,0} +}; + static struct cw_ElemHandler handlers[] = { { @@ -472,6 +480,30 @@ static struct cw_ElemHandler handlers[] = { cw_in_generic, /* get */ cw_out_generic /* put */ }, + + { + "AP Ethernet Port Type", /* name */ + CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE, /* Element ID */ + CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */ + 3,3, /* min/max length */ + CW_TYPE_BSTR16, /* type */ + "cisco/ap-ethernet-port-type", /* Key */ + cw_in_generic, /* get */ + cw_out_generic /* put */ + }, + + { /* it's wrong to store the reg domain in radio/xy/... + and has to be corected in the future */ + + "AP Regulatory Domain", /* name */ + CISCO_ELEM_AP_REGULATORY_DOMAIN, /* Element ID */ + CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ + 5,5, /* min/max length */ + cisco_ap_regulatory_domain, /* type */ + "cisco/regulatory-domain", /* Key */ + cw_in_radio_generic_struct, /* get */ + NULL /* put */ + }, {0,0,0,0,0,0,0,0} @@ -520,8 +552,10 @@ static struct cw_ElemDef join_request_elements[] ={ static int join_response_states[] = {CAPWAP_STATE_JOIN,0}; static struct cw_ElemDef join_response_elements[] ={ - {0,CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE}, + {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE}, + {CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_PATH_MTU, 0, 0}, + {0,0, CAPWAP_ELEM_ECN_SUPPORT, 0, CW_DELETE}, {0,0,0,00} @@ -545,11 +579,13 @@ static struct cw_ElemDef configuration_status_request_elements[] ={ {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_STATIC_IP_ADDR, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_MIN_IOS_VERSION, 0, 0}, {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_BACKUP_SOFTWARE_VERSION, 0, 0}, + {0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_REGULATORY_DOMAIN, 1, 0}, {CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_USERNAME_PASSWORD, 1, 0}, {CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_LOGHOST_CONFIG, 1, 0}, {CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_TELNET_SSH, 1, 0}, {CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_SUBMODE, 1, 0}, + {CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE, 1, 0}, {0,0,0,00} @@ -561,9 +597,9 @@ static struct cw_MsgDef messages[] = { NULL, /* name */ CAPWAP_MSG_DISCOVERY_REQUEST, /* type */ CW_ROLE_AC, /* role */ - discovery_request_states, - discovery_request_elements, - NULL + discovery_request_states, /* states */ + discovery_request_elements, /* elements */ + postprocess_discovery /* postprocess fun */ }, { NULL, /* name */ diff --git a/src/mod/cisco/cisco_out_ac_descriptor.c b/src/mod/cisco/cisco_out_ac_descriptor.c index ca6182a8..3cdb48d5 100644 --- a/src/mod/cisco/cisco_out_ac_descriptor.c +++ b/src/mod/cisco/cisco_out_ac_descriptor.c @@ -20,12 +20,12 @@ static int put_ac_status(mavl_t global, mavl_t local, uint8_t *dst, const char * char key[CW_KTV_MAX_KEY_LEN]; - 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_word(d,cw_ktv_get_word(local,"ac-descriptor/stations",0)); + d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/station-limit",0)); + d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/active-wtps",0)); + d += cw_put_word(d,cw_ktv_get_word(local,"ac-descriptor/max-wtps",0)); - d += cw_put_byte(d,cw_ktv_get_byte(global,"ac-descriptor/security",0)); + d += cw_put_byte(d,cw_ktv_get_byte(local,"ac-descriptor/security",0)); /* security = 0; if (cw_ktv_get(local,"dtls-cert-file",CW_TYPE_BSTR16)) @@ -40,14 +40,14 @@ static int put_ac_status(mavl_t global, mavl_t local, uint8_t *dst, const char * 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,cw_ktv_get_byte(local,"ac-descriptor/r-mac-field",0)); /*d += cw_put_byte(d,3);*/ 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)); + d += cw_put_byte(d,cw_ktv_get_byte(local,"ac-descriptor/dtls-policy",0)); return d - dst; } diff --git a/src/mod/cisco/lwapp_cisco.h b/src/mod/cisco/lwapp_cisco.h index 13e123fa..d81a26b7 100644 --- a/src/mod/cisco/lwapp_cisco.h +++ b/src/mod/cisco/lwapp_cisco.h @@ -32,7 +32,7 @@ #define LW_CISCO_MANAGER_IP_ADDR 19 #define LW_CISCO_RADIO_MODULE_INFO 21 #define LW_CISCO_AC_IP_ADDR_WITH_INDEX 32 -#define LW_CISCO_AP_ETHERNET_PORT_SUBTYPE 34 +#define CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE 34 #define CISCO_LWELEM_AP_LOGHOST_CONFIG 36 #define LW_CISCO_MCAST_MGID_INFO 39 diff --git a/src/mod/cisco/mod_cisco_ac.c b/src/mod/cisco/mod_cisco_ac.c index 292db821..0721bc3e 100644 --- a/src/mod/cisco/mod_cisco_ac.c +++ b/src/mod/cisco/mod_cisco_ac.c @@ -13,7 +13,7 @@ #include "cw/vendors.h" #include "mod_cisco.h" - +#include "capwap_cisco.h" /* extern int cisco_register_actions80211_ac(struct cw_actiondef *def); @@ -58,6 +58,7 @@ static struct cw_MsgSet * register_messages(struct cw_MsgSet *set, int mode) } +/* static void errfunc(cfg_t *cfg, const char *fmt, va_list ap){ if (cfg && cfg->filename && cfg->line) @@ -66,21 +67,22 @@ static void errfunc(cfg_t *cfg, const char *fmt, va_list ap){ else if (cfg && cfg->filename) cw_log(LOG_ERR, "MOD Cisco cfg file in %s:", cfg->filename); } +*/ static int init(struct cw_Mod *mod, mavl_t global_cfg, int role) { - uint8_t * str; +/* uint8_t * str;*/ static char * hardware_version; /*strdup(".x01000001");*/ static char * software_version; /* = NULL; */ - cfg_t *cfg; +/* cfg_t *cfg;*/ int rc = 1; - cfg_opt_t opts[] = { +/* cfg_opt_t opts[] = { CFG_SIMPLE_STR("hardware_version", &hardware_version), CFG_SIMPLE_STR("software_version",&software_version), CFG_END() }; - +*/ cw_dbg(DBG_INFO, "CISCO: Initialiazing mod_cisco ..."); cw_dbg(DBG_MOD, "CISCO: Loading base module: capwap"); @@ -191,10 +193,38 @@ static struct cw_Mod capwap_ac = { }; */ +static int write_header(struct cw_ElemHandler * handler, uint8_t * dst, int len) +{ + if (handler->proto == 0){ + if (handler->vendor) + return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len); + + return len + cw_put_elem_hdr(dst, handler->id, len); + } + /* put the lwap elem header */ + lw_set_dword(dst + 10, handler->vendor); + lw_set_word(dst + 14, handler->id); + return len + 6 + cw_put_elem_vendor_hdr(dst, handler->vendor, + CISCO_ELEM_SPAM_VENDOR_SPECIFIC, len+6); + +} + +static int header_len(struct cw_ElemHandler * handler) +{ + if (handler->proto==0) + return handler->vendor ? 10 : 4; + + return 16; +} + + + int static setup_cfg(struct conn * conn) { int security; + conn->write_header=write_header; + conn->header_len=header_len; security = cw_setup_dtls(conn,conn->local_cfg,"cisco",CAPWAP_CIPHER); cw_ktv_set_byte(conn->local_cfg,"ac-descriptor/security",security); diff --git a/src/wtp/Makefile b/src/wtp/Makefile index 0fa1dd65..6425e067 100644 --- a/src/wtp/Makefile +++ b/src/wtp/Makefile @@ -32,7 +32,7 @@ endif #SRC=$(wildcard *.c) -SRC=wtp_main.c discovery.c join.c +SRC=wtp_main.c discovery.c join.c configure.c OBJS=$(patsubst %.c,%.o,$(SRC)) OBJS:=$(patsubst %.o,$(OBJDIR)/%.o,$(OBJS)) diff --git a/src/wtp/configure.c b/src/wtp/configure.c index 3a455e63..c250240d 100644 --- a/src/wtp/configure.c +++ b/src/wtp/configure.c @@ -1,46 +1,37 @@ + + #include "cw/capwap.h" #include "cw/conn.h" #include "cw/log.h" -#include "cw/mbag.h" -#include "cw/capwap_items.h" +#include "cw/dbg.h" #include "wtp_interface.h" #include "cfg.h" -int configure() + +int configure(struct conn * conn) { - - struct conn *conn = get_conn(); - -// mbag_del_all(conn->incomming); - conn->incomming=conn->config; - mbag_del(conn->incomming,CW_ITEM_RESULT_CODE); - - mbag_set_str(conn->local,CW_ITEM_AC_NAME,"abc"); -// mbag_set_byte(conn->config,CW_ITEM_WTP_MAC_TYPE,WTP_MAC_TYPE_BOTH); -// mbag_set_byte(conn->config,CW_ITEM_WTP_MAC_TYPE,CAPWAP_WTP_MAC_TYPE_SPLIT); - - /* for config status request send the whole config */ - mbag_t radios_upd = conn->radios_upd; - conn->radios_upd=conn->radios; - - int rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST); - conn->radios_upd=radios_upd; + char sockbuff[SOCK_ADDR_BUFSIZE]; + + cw_dbg_ktv_dump(conn->local_cfg,DBG_INFO,"KTV DUMP ----------------","LOCAL:", "DUMP done -------"); + + int rc; + rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST); if (!cw_result_is_ok(rc)) { if (rc > 0) { cw_log(LOG_ERR, "Error sending Configuration Status Request to AC at %s, AC said: %d - %s.", - sock_addr2str(&conn->addr), rc, cw_strerror(rc)); + sock_addr2str(&conn->addr,sockbuff), rc, cw_strerror(rc)); } else { cw_log(LOG_ERR, "Error sending Configuration Status Request to AC at %s: %d - %s.", - sock_addr2str(&conn->addr), errno, cw_strerror(rc)); + sock_addr2str(&conn->addr,sockbuff), errno, cw_strerror(rc)); } - cfg_to_json(); + /*cfg_to_json();*/ return 0; } diff --git a/src/wtp/wtp_main.c b/src/wtp/wtp_main.c index b9550ef2..43decbb3 100644 --- a/src/wtp/wtp_main.c +++ b/src/wtp/wtp_main.c @@ -208,7 +208,11 @@ int main (int argc, char **argv) } */ join(conn,&dis); - + mavl_merge(conn->local_cfg,conn->remote_cfg); + + + configure(conn); + cw_discovery_free_results(&dis); return (EXIT_SUCCESS);