diff --git a/src/ac/conf.c b/src/ac/conf.c index f878678b..d538c3cc 100644 --- a/src/ac/conf.c +++ b/src/ac/conf.c @@ -620,7 +620,7 @@ int conf_parse_listen_addr(const char *addrstr, char *saddr, char *port, int *pr char *ctrlport; switch (*proto) { case AC_PROTO_CAPWAP: - ctrlport = CAPWAP_CONTROL_PORT_STR; + ctrlport = CW_CONTROL_PORT_STR; break; case AC_PROTO_LWAPP: ctrlport = LWAPP_CONTROL_PORT_STR; diff --git a/src/ac/conf.h b/src/ac/conf.h index 54e4bd85..5d7c9ecb 100644 --- a/src/ac/conf.h +++ b/src/ac/conf.h @@ -69,7 +69,7 @@ extern struct mod_ac ** conf_mods; #ifndef CONF_DEFAULT_CONTROL_PORT -#define CONF_DEFAULT_CONTROL_PORT CAPWAP_CONTROL_PORT +#define CONF_DEFAULT_CONTROL_PORT CW_CONTROL_PORT #endif #ifndef CONF_DEFAULT_LW_CONTROL_PORT diff --git a/src/ac/wtpman.c b/src/ac/wtpman.c index 2db61c3a..448885ea 100644 --- a/src/ac/wtpman.c +++ b/src/ac/wtpman.c @@ -46,7 +46,7 @@ static void reset_echointerval_timer(struct wtpman *wtpman) { uint16_t ct = mbag_get_word(wtpman->conn->local, CW_ITEM_CAPWAP_TIMERS, - CAPWAP_MAX_DISCOVERY_INTERVAL << 8 | + CW_MAX_DISCOVERY_INTERVAL << 8 | CAPWAP_ECHO_INTERVAL); /* start echinterval timer and put 2 seconds for "safety" on it */ diff --git a/src/cw/capwap.h b/src/cw/capwap.h index cb6b1cf5..79462e3e 100644 --- a/src/cw/capwap.h +++ b/src/cw/capwap.h @@ -18,7 +18,7 @@ /** * @file - * @brief CAPWAP desfinitions + * @brief CAPWAP definitions */ @@ -49,14 +49,14 @@ */ /** CAPWAP Version */ -#define CAPWAP_VERSION (0) +#define CW_VERSION (0) -#define CWIANA_ENTERPRISE_NUMBER 0 +#define CW_IANA_ENTERPRISE_NUMBER 0 /** CAPWAP Control Port*/ -#define CAPWAP_CONTROL_PORT 5246 +#define CW_CONTROL_PORT 5246 /** CAPWAP Control Port as String */ -#define CAPWAP_CONTROL_PORT_STR "5246" +#define CW_CONTROL_PORT_STR "5246" /** CAPWAP Data Port */ #define CAPWAP_DATA_PPORT 5247 @@ -92,8 +92,8 @@ #define CW_WBID_EPCGLOBAL 3 -#define CAPWAP_PACKET_PREAMBLE (CAPWAP_VERSION<<4) -#define CAPWAP_DTLS_PACKET_PREAMBLE (CAPWAP_VERSION<<4|1) +#define CAPWAP_PACKET_PREAMBLE (CW_VERSION<<4) +#define CAPWAP_DTLS_PACKET_PREAMBLE (CW_VERSION<<4|1) /* * control header stuff @@ -307,9 +307,8 @@ CW_MSG_MAXMSG = 26 #define CW_WTP_FRAME_TUNNEL_MODE_E 4 /* 802.3 mode */ #define CW_WTP_FRAME_TUNNEL_MODE_N 8 /* native mode */ -#include "radioinfo.h" - +/* Discovery Types */ #define CW_DISCOVERY_TYPE_UNKNOWN 0 #define CW_DISCOVERY_TYPE_STATIC 1 #define CW_DISCOVERY_TYPE_DHCP 2 @@ -317,26 +316,23 @@ CW_MSG_MAXMSG = 26 #define CW_DISCOVERY_TYPE_AC_REFERRAL 4 - - -/* wtp mac types */ +/* WTP mac types */ #define CW_WTP_MAC_TYPE_LOCAL 0 #define CW_WTP_MAC_TYPE_SPLIT 1 #define CW_WTP_MAC_TYPE_BOTH 2 - //#define CWMSG_MAX_SIZE 65536 -#define CWMSG_MAX_SIZE 2048 +//#define CWMSG_MAX_SIZE 2048 #define CW_SESSION_ID_LEN 16 /* capwap timer default values */ -#define CAPWAP_DISCOVERY_INTERVAL 5 -#define CAPWAP_MAX_DISCOVERY_INTERVAL 20 +#define CW_DISCOVERY_INTERVAL 5 +#define CW_MAX_DISCOVERY_INTERVAL 20 #define CAPWAP_RETRANSMIT_INTERVAL 3 #define CAPWAP_MAX_DISCOVERIES 10 #define CAPWAP_MAX_RETRANSMIT 5 @@ -351,7 +347,7 @@ CW_MSG_MAXMSG = 26 #define CAPWAP_STATISTICS_TIMER 120 -#define CAPWAP_TIMERS ((CAPWAP_DISCOVERY_INTERVAL << 8) | CAPWAP_ECHO_INTERVAL) +#define CAPWAP_TIMERS ((CW_DISCOVERY_INTERVAL << 8) | CAPWAP_ECHO_INTERVAL) //#define CAPWAP_CIPHER "PSK-AES128-CBC-SHA:" diff --git a/src/cw/conn_process_packet.c b/src/cw/conn_process_packet.c index ffea24a8..aa6270f6 100644 --- a/src/cw/conn_process_packet.c +++ b/src/cw/conn_process_packet.c @@ -75,7 +75,7 @@ void cw_init_request(struct conn *conn, int msg_id) cw_put_dword(buffer + 4, 0); /* unencrypted */ - cw_set_hdr_preamble(buffer, CAPWAP_VERSION << 4 | 0); + cw_set_hdr_preamble(buffer, CW_VERSION << 4 | 0); cw_set_hdr_rmac(buffer, conn->base_rmac); //cw_set_hdr_hlen(buffer, 2); @@ -99,7 +99,7 @@ void cw_init_data_msg(struct conn *conn) cw_put_dword(buffer + 4, 0); /* unencrypted */ - cw_set_hdr_preamble(buffer, CAPWAP_VERSION << 4 | 0); + cw_set_hdr_preamble(buffer, CW_VERSION << 4 | 0); @@ -579,12 +579,12 @@ int conn_process_packet2(struct conn *conn, uint8_t * packet, int len, int preamble = cw_get_hdr_preamble(packet); - if ((preamble & 0xf0) != (CAPWAP_VERSION << 4)) { + if ((preamble & 0xf0) != (CW_VERSION << 4)) { /* wrong version */ cw_dbg(DBG_PKT_ERR, "Discarding packet from %s, wrong version, version=%d, version %d expected.", sock_addr2str(&conn->addr), (preamble & 0xf0) >> 4, - CAPWAP_VERSION); + CW_VERSION); errno = EAGAIN; return -1; } diff --git a/src/cw/cw_in_capwap_control_ip_address.c b/src/cw/cw_in_capwap_control_ip_address.c index ed03ba6a..c20c08f2 100644 --- a/src/cw/cw_in_capwap_control_ip_address.c +++ b/src/cw/cw_in_capwap_control_ip_address.c @@ -62,7 +62,7 @@ int cw_in_capwap_control_ip_address(struct conn *conn, struct cw_action_in *a, struct sockaddr_in addr; memcpy(&addr.sin_addr,data,4); addr.sin_family=AF_INET; - sock_setport((struct sockaddr*)&addr,CAPWAP_CONTROL_PORT); + sock_setport((struct sockaddr*)&addr,CW_CONTROL_PORT); memcpy(&acip->ip,&addr,sizeof(addr)); acip->index = cw_get_word(data+4); } @@ -72,7 +72,7 @@ int cw_in_capwap_control_ip_address(struct conn *conn, struct cw_action_in *a, memset (&addr,0,sizeof(addr)); memcpy(&addr.sin6_addr,data,16); addr.sin6_family=AF_INET6; - sock_setport((struct sockaddr*)&addr,CAPWAP_CONTROL_PORT); + sock_setport((struct sockaddr*)&addr,CW_CONTROL_PORT); memcpy(&acip->ip,&addr,sizeof(addr)); acip->index = cw_get_word(data+16); } diff --git a/src/cw/netconn.c b/src/cw/netconn.c index b249682f..424f12f1 100644 --- a/src/cw/netconn.c +++ b/src/cw/netconn.c @@ -248,12 +248,12 @@ int netconn_process_packet(struct netconn *nc, uint8_t * packet, int len, int preamble = cw_get_hdr_preamble(packet); - if ((preamble & 0xf0) != (CAPWAP_VERSION << 4)) { + if ((preamble & 0xf0) != (CW_VERSION << 4)) { /* wrong version */ cw_dbg(DBG_PKT_ERR, "Discarding packet from %s, wrong version, version=%d, version %d expected.", sock_addr2str(&nc->addr), (preamble & 0xf0) >> 4, - CAPWAP_VERSION); + CW_VERSION); errno = EAGAIN; return -1; } diff --git a/src/mod/capwap/capwap_out_get_idle_timeout.c b/src/mod/capwap/capwap_out_get_idle_timeout.c index 0c2d248e..1981f264 100644 --- a/src/mod/capwap/capwap_out_get_idle_timeout.c +++ b/src/mod/capwap/capwap_out_get_idle_timeout.c @@ -21,5 +21,5 @@ struct mbag_item * capwap_out_get_capwap_timers(struct conn *conn,struct cw_acti if (m) return m; - return mbag_set_word(conn->local,CW_ITEM_CAPWAP_TIMERS,CAPWAP_MAX_DISCOVERY_INTERVAL<<8 | CAPWAP_ECHO_INTERVAL); + return mbag_set_word(conn->local,CW_ITEM_CAPWAP_TIMERS,CW_MAX_DISCOVERY_INTERVAL<<8 | CAPWAP_ECHO_INTERVAL); } diff --git a/src/mod/cisco/cisco_in_add_wlan.c b/src/mod/cisco/cisco_in_add_wlan.c index 8ee31b65..bd234956 100644 --- a/src/mod/cisco/cisco_in_add_wlan.c +++ b/src/mod/cisco/cisco_in_add_wlan.c @@ -111,13 +111,21 @@ int cw_cisco_get_wlan_(mbag_t wlan, uint8_t *data, int len) int cisco_in_add_wlan(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len, struct sockaddr *from) { + int pos=0; + cw_dbg (DBG_X,"Add WLAN"); int rid = cw_get_byte(data); - cw_dbg (DBG_X, "RID = %d",rid); + cw_dbg (DBG_X, "Radio ID = %d",rid); bstr_t mac = bstr_create(data+1,6); cw_dbg (DBG_X, "MAC: %s",sock_hwaddr2str(bstr_data(mac),bstr_len(mac))); + + int wid = cw_get_word(data+1+6); + cw_dbg (DBG_X, "WLAN ID = %d",wid); + + char * ssid=cw_get_str(data+1+6+2+1,16); + cw_dbg (DBG_X, "SSID = %s",ssid); return 0; diff --git a/src/mod/cisco/cisco_out_radio_operational_state.c b/src/mod/cisco/cisco_out_radio_operational_state.c index e121c8a7..3ff74d4c 100644 --- a/src/mod/cisco/cisco_out_radio_operational_state.c +++ b/src/mod/cisco/cisco_out_radio_operational_state.c @@ -5,6 +5,8 @@ int cisco_out_radio_operational_state(struct conn *conn, struct cw_action_out *a, uint8_t * dst) { + cw_dbg(DBG_X,"Try send oper state"); + int l=0; MAVLITER_DEFINE(it,conn->radios_upd); @@ -27,7 +29,8 @@ int cisco_out_radio_operational_state(struct conn *conn, struct cw_action_out *a cw_dbg(DBG_X,"Translated oper state for output from %d to %d",oper_state, oper_state_t); l+=cw_put_elem_radio_operational_state(dst+l,i->iid,oper_state_t, oper_cause); - + + // cw_dbg_elem_(conn,1,1,dst+l,l); } return l; diff --git a/src/wtp/wtp_conf.c b/src/wtp/wtp_conf.c index 8c85c95d..2e18d902 100644 --- a/src/wtp/wtp_conf.c +++ b/src/wtp/wtp_conf.c @@ -209,7 +209,7 @@ int wtpconf_ac_list() int wtpconf_preinit() { - conf_control_port=strdup(CAPWAP_CONTROL_PORT_STR); + conf_control_port=strdup(CW_CONTROL_PORT_STR); conf_dtls_cipher=strdup(CONF_DEFAULT_DTLS_CIPHER); diff --git a/src/wtp/wtp_conf.h b/src/wtp/wtp_conf.h index dbe55de2..a46d90fb 100644 --- a/src/wtp/wtp_conf.h +++ b/src/wtp/wtp_conf.h @@ -93,7 +93,7 @@ extern uint8_t conf_macaddress_len; #ifndef CONF_DEFAULT_MAX_DISCOVERY_INTERVAL - #define CONF_DEFAULT_MAX_DISCOVERY_INTERVAL CAPWAP_MAX_DISCOVERY_INTERVAL + #define CONF_DEFAULT_MAX_DISCOVERY_INTERVAL CW_MAX_DISCOVERY_INTERVAL #endif #ifndef CONF_DEFAULT_SILENT_INTERVAL @@ -101,7 +101,7 @@ extern uint8_t conf_macaddress_len; #endif #ifndef CONF_DEFAULT_DISCOVERY_INTERVAL - #define CONF_DEFAULT_DISCOVERY_INTERVAL CAPWAP_DISCOVERY_INTERVAL + #define CONF_DEFAULT_DISCOVERY_INTERVAL CW_DISCOVERY_INTERVAL #endif #ifndef CONF_DEFAULT_MAX_DISCOVERIES