diff --git a/doc/capwap_cisco.txt b/doc/capwap_cisco.txt index 779c7b2b..0d869e68 100644 --- a/doc/capwap_cisco.txt +++ b/doc/capwap_cisco.txt @@ -149,7 +149,22 @@ AP = RAD = WTP LWAPP ===== -20. Ciscp AP Username Password +In this section Cisco vendor specific message elements used in LWAPP +are listed. + +Some of these elements are used by Cisco in CAPWAP where the +vendor specific LWAPP message element is encapsulated in a vendor +specific CAPWAP message element. So in CAPWAP we see headers like +this: + +Vendor spec CAPWAP | Vedor spec LWAPP | Vendor specific LWAPP data +00 40 96 00 00 68 | 00 40 96 00 00 86 | ... + + + + + +20. Cisco AP Username Password 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Username (32 bytes) ... @@ -185,5 +200,16 @@ LWAPP Type: 73 Length: >=4 +134. Cisco MWAR Hash Value + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Hash ... + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + Hash: ASCII string witch represents in hexadecimal notation + the SHA1 hash of the device certificate. + diff --git a/src/capwap/Makefile b/src/capwap/Makefile index a5436804..616dc66a 100644 --- a/src/capwap/Makefile +++ b/src/capwap/Makefile @@ -21,7 +21,7 @@ endif NAME=libcapwap.a SOCKOBJS=sock_create.o sock_copyaddr.o sock_strtoaddr.o sock_cmpaddr.o sock_addrlen.o \ - sock_receive.o sock_mwait.o sock_addrtostr.o \ + sock_mwait.o sock_addrtostr.o \ sock_setport.o \ sock_getport.o \ sock_getifaddr.o \ @@ -32,6 +32,7 @@ SOCKOBJS=sock_create.o sock_copyaddr.o sock_strtoaddr.o sock_cmpaddr.o sock_addr sock_addrinit.o \ sock_set_dontfrag.o \ sock_get_primary_if.o + #sock_receive.o LOGOBJS=cw_log.o \ cw_log_debug.o \ @@ -150,7 +151,10 @@ CAPWAPOBJS= \ cw_readelem_capwap_local_ip_addr.o \ cw_readelem_wtp_reboot_statistics.o\ cwmsg_addelem_vendor_cisco_mwar_addr.o \ - lw_readelem_wtp_board_data.o + lw_readelem_wtp_board_data.o \ + cw_readmsg_configuration_status_response.o \ + + # cwmsg_addelem_vendor_cisco_ap_timesync.o \ # cwmsg_addelem_vendor_specific_payload.o \ @@ -227,6 +231,8 @@ OBJS=$(CONNOBJS) $(FRAGOBJS) $(SOCKOBJS) $(CAPWAPOBJS) $(WTPINFOOBJS) \ $(LWAPPOBJS) \ $(LWAPPCISCOOBJS) +#include $(OBJS:.o=.d) + O:=$(OBJS); OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS)) @@ -249,7 +255,7 @@ $(ARCH)/%.o:%.c @mkdir -p $(ARCH) @echo " CC "$< @$(CC) -c $(CFLAGS) $< -o $@ - + @$(CC) -MM $(CFLAGS) $< > $*.d $(ARCH)/$(NAME) : $(OBJS) @echo " AR $(ARCH)/$(NAME)" diff --git a/src/capwap/conn_get_message.c b/src/capwap/conn_get_message.c index 145d4c5e..e8cb27ed 100644 --- a/src/capwap/conn_get_message.c +++ b/src/capwap/conn_get_message.c @@ -49,7 +49,7 @@ struct cwrmsg *conn_get_message(struct conn *conn) if (args.cwrmsg) { - cw_dbg(DBG_CW_MSG, + cw_dbg(DBG_MSG, "Received message from %s, type=%d - %s, seq=%d", sock_addr2str(&conn->addr), args.cwrmsg->type, cw_msgtostr(args.cwrmsg->type), diff --git a/src/capwap/conn_get_response.c b/src/capwap/conn_get_response.c index 1cfc9493..9c990fb5 100644 --- a/src/capwap/conn_get_response.c +++ b/src/capwap/conn_get_response.c @@ -23,7 +23,7 @@ struct cwrmsg * conn_get_response(struct conn * conn) while(!cw_timer_timeout(r_timer)){ cwrmsg = conn_get_message(conn); if (cwrmsg){ - cw_dbg(DBG_CW_MSG,"Received message from %s, type=%d - %s" + cw_dbg(DBG_MSG,"Received message from %s, type=%d - %s" ,sock_addr2str(&conn->addr),cwrmsg->type,cw_msgtostr(cwrmsg->type)); if (cwrmsg->type == type){ return cwrmsg; diff --git a/src/capwap/cw_log_debug.c b/src/capwap/cw_log_debug.c index e8a047c2..59271000 100644 --- a/src/capwap/cw_log_debug.c +++ b/src/capwap/cw_log_debug.c @@ -260,7 +260,7 @@ cw_log_debug0_, cw_log_debug1_, cw_log_debug2_}; void cw_dbg_msgelem_(int msg, int msgelem, const uint8_t * msgbuf, int len) { - if (!cw_dbg_is_level(DBG_CW_MSGELEM)) + if (!cw_dbg_is_level(DBG_ELEM)) return; const char *elemname; @@ -277,13 +277,13 @@ void cw_dbg_msgelem_(int msg, int msgelem, const uint8_t * msgbuf, int len) } - if (!cw_dbg_is_level(DBG_CW_MSGELEM_DMP)) - cw_dbg(DBG_CW_MSGELEM, + if (!cw_dbg_is_level(DBG_ELEM_DMP)) + cw_dbg(DBG_ELEM, "Reading %s msgelem, type=%d (%s), len=%d", cw_msgtostr(msg), msgelem, elemname, len); else - cw_dbg_dmp(DBG_CW_MSGELEM, msgbuf, len, + cw_dbg_dmp(DBG_ELEM, msgbuf, len, "Reading %s msgelem, type=%d (%s), len=%d\n\t Dump ...", cw_msgtostr(msg), msgelem, elemname, len); } diff --git a/src/capwap/cw_log_str2dbglevel.c b/src/capwap/cw_log_str2dbglevel.c index 73206edc..3318651c 100644 --- a/src/capwap/cw_log_str2dbglevel.c +++ b/src/capwap/cw_log_str2dbglevel.c @@ -25,9 +25,9 @@ struct cw_dbg_cfgstrs cw_dbg_cfgstrs[] = { {"info",DBG_CW_INFO}, - {"msg",DBG_CW_MSG}, - {"msgelem",DBG_CW_MSGELEM}, - {"msgelem_dmp",DBG_CW_MSGELEM_DMP}, + {"msg",DBG_MSG}, + {"msgelem",DBG_ELEM}, + {"msgelem_dmp",DBG_ELEM_DMP}, {"rfc",DBG_CW_RFC}, {"pkt_in",DBG_CW_PKT_IN}, {"pkt_out",DBG_CW_PKT_OUT}, diff --git a/src/capwap/cw_msgelemtostr.c b/src/capwap/cw_msgelemtostr.c index 7c7e55ea..1c02561e 100644 --- a/src/capwap/cw_msgelemtostr.c +++ b/src/capwap/cw_msgelemtostr.c @@ -25,13 +25,13 @@ const char * cw_msgelemtostr(int elem) { switch (elem){ case CW_ELEM_AC_DESCRIPTOR: - return "AC descriptor"; - -/* AC IPv4 List 2 - AC IPv6 List 3 -*/ + return "AC Descriptor"; + case CW_ELEM_AC_IPV4_LIST: + return "AC IPv4 List"; + case CW_ELEM_AC_IPV6_LIST: + return "AC IPv6 List"; case CW_ELEM_AC_NAME: - return "AC name"; + return "AC Name"; /* AC Name with Priority 5 AC Timestamp 6 @@ -48,11 +48,18 @@ const char * cw_msgelemtostr(int elem) return "CAPWAP local IPv4 addr"; case CWMSGELEM_CAPWAP_LOCAL_IPV6_ADDRESS: return "CAPWAP local IPv6 addr"; -/* CAPWAP Timers 12 - CAPWAP Transport Protocol 51 + + case CW_ELEM_CAPWAP_TIMERS: + return "CAWPAP Timers"; + /* CAPWAP Transport Protocol 51 Data Transfer Data 13 Data Transfer Mode 14 Decryption Error Report 15 +*/ + + case CW_ELEM_DECRYPTION_ERROR_REPORT_PERIOD: + return "Decryption Error Report Period"; +/* Decryption Error Report Period 16 Delete MAC ACL Entry 17 Delete Station 18 @@ -66,8 +73,10 @@ const char * cw_msgelemtostr(int elem) */ case CWMSGELEM_ECN_SUPPORT: return "ECN support"; - /* Idle Timeout 23 -*/ + + case CW_ELEM_IDLE_TIMEOUT: + return "Idle Timeout"; + case CWMSGELEM_IMAGE_DATA: return "image data"; @@ -90,17 +99,17 @@ const char * cw_msgelemtostr(int elem) return "radio administrative state"; case CWMSGELEM_RADIO_OPERATIONAL_STATE: - return "radio operational state"; + return "Radio Operational State"; /* Radio Operational State 32 */ case CWMSGELEM_RESULT_CODE: - return "result code"; + return "Result Code"; /* Returned Message Element 34 */ case CW_ELEM_SESSION_ID: - return "session id"; + return "Session ID"; case CWMSGELEM_STATISTICS_TIMER: return "Statistics Timer"; @@ -114,10 +123,11 @@ const char * cw_msgelemtostr(int elem) case CWMSGELEM_WTP_DESCRIPTOR: return "wtp descriptor"; -/* WTP Fallback 40 - */ + + case CW_ELEM_WTP_FALLBACK: + return "WTP Fallback"; case CWMSGELEM_WTP_FRAME_TUNNEL_MODE: - return "frame tunnel mode"; + return "Frame Tunnel Mode"; /* case CWMSGELEM_RESERVED_1: return "reserved (42)"; diff --git a/src/capwap/cw_readelem_ac_descriptor.c b/src/capwap/cw_readelem_ac_descriptor.c index 92ecb3d2..8872ff82 100644 --- a/src/capwap/cw_readelem_ac_descriptor.c +++ b/src/capwap/cw_readelem_ac_descriptor.c @@ -66,7 +66,7 @@ static int read_subelem(struct ac_info* acinfo,int subtype,uint8_t *elem, int le } /** - * Read message elment ac descriptor + * Read CAPWAP message elment: AC Descriptor * @param acinfo pointer to acinfo where the result is stored * @param type message element type * @param msgelem pointer to message element @@ -116,7 +116,7 @@ int cw_readelem_ac_descriptor(struct ac_info * acinfo,int type, uint8_t *msgelem sub+=8; int subtype = val>>16; - cw_dbg(DBG_CW_MSGELEM,"ac descriptor sub-element vendor: %d, type:%d, len: %d",vendor,subtype,sublen); + cw_dbg(DBG_ELEM,"AC Descriptor sub-element vendor: %d, type:%d, len: %d",vendor,subtype,sublen); switch (vendor) { case 0: read_subelem(acinfo,subtype,msgelem+sub,sublen); diff --git a/src/capwap/cw_send_image_data_response.c b/src/capwap/cw_send_image_data_response.c index 1832c845..e7483858 100644 --- a/src/capwap/cw_send_image_data_response.c +++ b/src/capwap/cw_send_image_data_response.c @@ -29,7 +29,7 @@ void cw_send_image_data_response(struct conn * conn,int seqnum, int rc) { - cw_dbg(DBG_CW_MSG,"Sending image data response to %s, seq = %d",sock_addr2str(&conn->addr),seqnum); + cw_dbg(DBG_MSG,"Sending image data response to %s, seq = %d",sock_addr2str(&conn->addr),seqnum); struct cwmsg * cwmsg = &conn->resp_msg; cwmsg_init(cwmsg,conn->resp_buffer,CWMSG_IMAGE_DATA_RESPONSE,seqnum,NULL); diff --git a/src/capwap/cwread_change_state_event_request.c b/src/capwap/cwread_change_state_event_request.c index fc326e9b..7a51f8cb 100644 --- a/src/capwap/cwread_change_state_event_request.c +++ b/src/capwap/cwread_change_state_event_request.c @@ -72,7 +72,7 @@ int cwread_change_state_event_request(struct wtpinfo * wtpinfo, uint8_t * msg, i eparm.wtpinfo = wtpinfo; eparm.mand=mand; - cw_dbg(DBG_CW_MSGELEM,"Reading change state event request, len=%d",len); + cw_dbg(DBG_ELEM,"Reading change state event request, len=%d",len); cw_foreach_msgelem(msg,len,readelem,&eparm); diff --git a/src/capwap/cwread_configuration_status_request.c b/src/capwap/cwread_configuration_status_request.c index 77b37004..1792fa90 100644 --- a/src/capwap/cwread_configuration_status_request.c +++ b/src/capwap/cwread_configuration_status_request.c @@ -83,7 +83,7 @@ void cwread_configuration_status_request(struct wtpinfo * wtpinfo, uint8_t * msg eparm.wtpinfo = wtpinfo; eparm.mand=mand; - cw_dbg(DBG_CW_MSGELEM,"Reading configuration status request, len=%d",len); + cw_dbg(DBG_ELEM,"Reading configuration status request, len=%d",len); cw_foreach_msgelem(msg,len,readelem,&eparm); if (cw_is_missing_mand_elems(mand)){ diff --git a/src/capwap/cwread_wtp_event_request.c b/src/capwap/cwread_wtp_event_request.c index 0b3db827..de3ec3aa 100644 --- a/src/capwap/cwread_wtp_event_request.c +++ b/src/capwap/cwread_wtp_event_request.c @@ -34,7 +34,7 @@ int cwread_wtp_event_request(struct wtpinfo * wtpinfo, uint8_t * msg, int len) eparm.wtpinfo = wtpinfo; eparm.mand=mand; - cw_dbg(DBG_CW_MSGELEM,"Reading wtp event request, len=%d",len); + cw_dbg(DBG_ELEM,"Reading wtp event request, len=%d",len); cw_foreach_msgelem(msg,len,readelem,&eparm); diff --git a/src/capwap/cwsend_change_state_event_response.c b/src/capwap/cwsend_change_state_event_response.c index 5b8266d0..d644cb59 100644 --- a/src/capwap/cwsend_change_state_event_response.c +++ b/src/capwap/cwsend_change_state_event_response.c @@ -17,7 +17,7 @@ void cwsend_change_state_event_response(struct conn * conn,int seqnum, struct radioinfo * radioinfo) { - cw_dbg(DBG_CW_MSG,"Sending change state response to %s, seq = %d",sock_addr2str(&conn->addr),seqnum); + cw_dbg(DBG_MSG,"Sending change state response to %s, seq = %d",sock_addr2str(&conn->addr),seqnum); struct cwmsg * cwmsg = &conn->resp_msg; cwmsg_init(cwmsg,conn->resp_buffer,CWMSG_CHANGE_STATE_EVENT_RESPONSE,seqnum,NULL); diff --git a/src/capwap/cwsend_conf_status_response.c b/src/capwap/cwsend_conf_status_response.c index c835c7e6..4748495a 100644 --- a/src/capwap/cwsend_conf_status_response.c +++ b/src/capwap/cwsend_conf_status_response.c @@ -8,7 +8,7 @@ void cwmsg_addelem_capwap_timers(struct cwmsg *msg,int discovery,int echo_reques uint8_t timers[2]; timers[0]=discovery; timers[1]=echo_request; - cwmsg_addelem(msg,CWMSGELEM_CAPWAP_TIMERS,timers,sizeof(timers)); + cwmsg_addelem(msg,CW_ELEM_CAPWAP_TIMERS,timers,sizeof(timers)); } void cwsend_conf_status_response(struct conn * conn,int seqnum, int rc, struct radioinfo * radioinfo, struct ac_info * acinfo, struct wtpinfo * wtpinfo) diff --git a/src/capwap/cwsend_discovery_response.c b/src/capwap/cwsend_discovery_response.c index cf0a15ed..8effdd8a 100644 --- a/src/capwap/cwsend_discovery_response.c +++ b/src/capwap/cwsend_discovery_response.c @@ -32,7 +32,7 @@ void cwsend_discovery_response(struct conn *conn, int seqnum, struct radioinfo *radioinfo, struct ac_info *acinfo, struct wtpinfo *wtpinfo) { - cw_dbg(DBG_CW_MSG, "Sending discovery response to %s, seq = %d", sock_addr2str(&conn->addr), + cw_dbg(DBG_MSG, "Sending discovery response to %s, seq = %d", sock_addr2str(&conn->addr), seqnum); struct cwmsg *cwmsg = &conn->resp_msg; diff --git a/src/capwap/lw_addelem.c b/src/capwap/lw_addelem.c index c260f9fe..724ab891 100644 --- a/src/capwap/lw_addelem.c +++ b/src/capwap/lw_addelem.c @@ -34,7 +34,7 @@ int lw_addelem_vendor_specific(uint8_t *dst,uint32_t vendor_id,uint16_t elem_id, int lw_addelem_cisco_padding(uint8_t *dst, int len) { lw_put_dword(dst+3,LW_VENDOR_CISCO); - lw_put_word(dst+7,LW_ELEM_CISCO_PATH_MTU); + lw_put_word(dst+7,LW_CISCO_PATH_MTU); lw_put_word(dst+9,len); memset(dst+11,0,len); return lw_put_elem_hdr(dst,LW_ELEM_VENDOR_SPECIFIC,11+len); diff --git a/src/capwap/process_conf_status_request.c b/src/capwap/process_conf_status_request.c index b8e63504..cdea8710 100644 --- a/src/capwap/process_conf_status_request.c +++ b/src/capwap/process_conf_status_request.c @@ -33,8 +33,9 @@ static int process_elem(void *w,int type,uint8_t* msgelem,int len) { struct wtpinfo * wtpinfo = (struct wtpinfo*)w; - cw_dbg(DBG_CW_MSGELEM,"Process conf status req msgelem, type=%d (%s), len=%d",type,cw_msgelemtostr(type),len); - cw_dbg_dmp(DBG_CW_MSGELEM_DMP,msgelem,len,"Dump for msgelem ..."); + cw_dbg(DBG_ELEM,"Process conf status req msgelem, type=%d (%s), len=%d",type,cw_msgelemtostr(type),len); + + cw_dbg_dmp(DBG_ELEM_DMP,msgelem,len,"Dump for msgelem ..."); if (wtpinfo_readelem_ac_name(wtpinfo,type,msgelem,len)) diff --git a/src/capwap/wtpinfo_readelem_wtp_board_data.c b/src/capwap/wtpinfo_readelem_wtp_board_data.c index 90bc7f9e..4eca6b61 100644 --- a/src/capwap/wtpinfo_readelem_wtp_board_data.c +++ b/src/capwap/wtpinfo_readelem_wtp_board_data.c @@ -22,11 +22,11 @@ static void wtpinfo_readsubelems_wtp_board_data(struct wtpinfo * wtpinfo,uint8_t int sublen = val&0xffff; i+=4; if (sublen+i>len){ - cw_dbg(DBG_CW_MSGELEM,"WTP Board data sub-element too long, type=%d,len=%d",subtype,sublen); + cw_dbg(DBG_ELEM,"WTP Board data sub-element too long, type=%d,len=%d",subtype,sublen); return; } - cw_dbg(DBG_CW_MSGELEM,"Reading WTP board data sub-element, type=%d, len=%d",subtype,sublen); + cw_dbg(DBG_ELEM,"Reading WTP board data sub-element, type=%d, len=%d",subtype,sublen); switch(subtype){ case CWBOARDDATA_MODELNO: @@ -61,7 +61,7 @@ int wtpinfo_readelem_wtp_board_data(struct wtpinfo *wtpinfo, int type, uint8_t * if (type!=CWMSGELEM_WTP_BOARD_DATA) return 0; if (len<4){ - cw_dbg(DBG_CW_MSGELEM,"Discarding WTP_BOARD_DATA msgelem, wrong size, type=%d, len=%d\n",type,len); + cw_dbg(DBG_ELEM,"Discarding WTP_BOARD_DATA msgelem, wrong size, type=%d, len=%d\n",type,len); return 1; } diff --git a/src/capwap/wtpinfo_readelem_wtp_descriptor.c b/src/capwap/wtpinfo_readelem_wtp_descriptor.c index 8023eb7a..32644b91 100644 --- a/src/capwap/wtpinfo_readelem_wtp_descriptor.c +++ b/src/capwap/wtpinfo_readelem_wtp_descriptor.c @@ -82,7 +82,7 @@ static int wtpinfo_readelem_wtp_descriptor_(struct wtpinfo * wtpinfo, int type, return -1; } - cw_dbg(DBG_CW_MSG,"Reading WTP descriptor subelement, type=%d,len=%d",subtype,sublen); + cw_dbg(DBG_MSG,"Reading WTP descriptor subelement, type=%d,len=%d",subtype,sublen); switch(subtype){ case CWMSGSUBELEM_WTP_DESCRIPTOR_HARDWARE_VERSION: diff --git a/src/wtp/configure.c b/src/wtp/configure.c index 6d5b6be7..5d7aa3c9 100644 --- a/src/wtp/configure.c +++ b/src/wtp/configure.c @@ -1,3 +1,5 @@ +#include //Tube + #include "capwap/capwap.h" #include "capwap/conn.h" #include "wtp_interface.h" @@ -10,7 +12,9 @@ int configure() struct radioinfo *rip = &(wtpinfo->radioinfo[0]); cw_prepare_configuration_status_request(conn,rip,wtpinfo); - conn_send_request(conn); + struct cwrmsg * cwrmsg = conn_send_request(conn); + + int rc = cw_readmsg_configuration_status_response(cwrmsg->msgelems,cwrmsg->msgelems_len); exit(0); } diff --git a/src/wtp/wtp_main.c b/src/wtp/wtp_main.c index 1b2706a3..d3bf2025 100644 --- a/src/wtp/wtp_main.c +++ b/src/wtp/wtp_main.c @@ -120,6 +120,7 @@ int wtp_main(const char *ad) wtpconf_init(); + cw_dbg_opt_detail=DBG_DETAIL_ASC_DMP;