Merge branch 'refactor'

FossilOrigin-Name: 1505b13bc7be477b27f827ac6e06229fc28080dc87e3aa3c3e94d36f56bd9498
This commit is contained in:
7u83@mail.ru
2018-02-23 13:21:43 +00:00
29 changed files with 188 additions and 209 deletions

View File

@ -330,7 +330,7 @@ IDL_PROPERTY_SUPPORT = YES
# all members of a group must be documented explicitly.
# The default value is: NO.
DISTRIBUTE_GROUP_DOC = NO
DISTRIBUTE_GROUP_DOC = YES
# Set the SUBGROUPING tag to YES to allow class member groups of the same type
# (for instance a group of public functions) to be put as a subgroup of that

View File

@ -25,8 +25,6 @@
#ifndef __CAPWAP_H
#define __CAPWAP_H
//#include <stdio.h>
#include <stdint.h>
#include <string.h>
@ -41,132 +39,87 @@
/* capwap version and iana number */
/**
*@defgroup CAPWAPConstants CAPWAP Constants
*@defgroup CAPWAP CAPWAP Defintions from RFC5415
*@{
*/
/**
*@defgroup CAPWAPConstants CAPWAP General Constants
*@brief General constants as defined in RFC5415
*@{
*/
/** CAPWAP Version */
#define CW_VERSION (0)
#define CW_IANA_ENTERPRISE_NUMBER 0
#define CAPWAP_VERSION (0)
#define CAPWAP_IANA_ENTERPRISE_NUMBER 0
*
/** CAPWAP Control Port*/
#define CW_CONTROL_PORT 5246
#define CAPWAP_CONTROL_PORT 5246
/** CAPWAP Control Port as String */
#define CW_CONTROL_PORT_STR "5246"
#define CAPWAP_CONTROL_PORT_STR "5246"
/** CAPWAP Data Port */
#define CAPWAP_DATA_PPORT 5247
/** CAWPAP DataPort as String */
#define CAPWAP_DATA_PPORT_STR "5247"
#define CAPWAP_DATA_PORT_STR "5247"
/**@}*/
/**
* CAPWAP header flags.
*/
#define CW_FLAG_HDR_R1 0x01 /* bit 0 reserved 1 */
#define CW_FLAG_HDR_R2 0x02 /* bit 1 reserved 2 */
#define CW_FLAG_HDR_R3 0x04 /* bit 2 reserved 3 */
#define CW_FLAG_HDR_K 0x08 /* bit 3 Keep alive flag */
#define CW_FLAG_HDR_M 0x10 /* bit 4 MAC Adress field present */
#define CW_FLAG_HDR_W 0x20 /* bit 5 wireless info present */
#define CW_FLAG_HDR_L 0x40 /* bit 6 last fragment */
#define CW_FLAG_HDR_F 0x80 /* bit 7 fragment */
#define CW_FLAG_HDR_T 0x100 /* bit 8 type of payload frame */
/**
* @addtogroup CAPWAPWBIDS Wireless binding IDs
* @{
*/
#define CW_WBID_RESERVED1 0
#define CW_WBID_IEEE80211 1
#define CW_WBID_RESERVED2 2
#define CW_WBID_EPCGLOBAL 3
/**@}*/
#define CAPWAP_PACKET_PREAMBLE (CW_VERSION<<4)
#define CAPWAP_DTLS_PACKET_PREAMBLE (CW_VERSION<<4|1)
/*
* control header stuff
*/
/**
*@addtogroup CAPWAPConstants
*@defgroup CAPWAPHeaderFlags CAPWAP Header Flags
*@brief The CAPWAP control header flags
*
*@{
*/
#define CAPWAP_FLAG_HDR_R1 0x01 /**< bit 0 reserved 1 */
#define CAPWAP_FLAG_HDR_R2 0x02 /**< bit 1 reserved 2 */
#define CAPWAP_FLAG_HDR_R3 0x04 /**< bit 2 reserved 3 */
#define CAPWAP_FLAG_HDR_K 0x08 /**< bit 3 Keep alive flag */
#define CAPWAP_FLAG_HDR_M 0x10 /**< bit 4 MAC Adress field present */
#define CAPWAP_FLAG_HDR_W 0x20 /**< bit 5 wireless info present */
#define CAPWAP_FLAG_HDR_L 0x40 /**< bit 6 last fragment */
#define CAPWAP_FLAG_HDR_F 0x80 /**< bit 7 fragment */
#define CAPWAP_FLAG_HDR_T 0x100 /**< bit 8 type of payload frame */
/**@}*/
/**
* CAPWAP message types as defined in RFC 5416
* @defgroup CAPWAPWBIDS CAPWAP Wireless binding IDs
* @{
*/
enum cw_message_types{
/**Discovery Request = 1*/
CW_MSG_DISCOVERY_REQUEST = 1,
/** Discovery Response = 2 */
CW_MSG_DISCOVERY_RESPONSE = 2,
/** Join Request = 3 */
CW_MSG_JOIN_REQUEST = 3,
/** Join Response = 4 */
CW_MSG_JOIN_RESPONSE = 4,
/** Config. Status Request = 5*/
CW_MSG_CONFIGURATION_STATUS_REQUEST = 5,
/** Config. Status Response = 6 */
CW_MSG_CONFIGURATION_STATUS_RESPONSE = 6,
/** Config. Update Request = 7 */
CW_MSG_CONFIGURATION_UPDATE_REQUEST = 7,
CW_MSG_CONFIGURATION_UPDATE_RESPONSE = 8,
CW_MSG_WTP_EVENT_REQUEST = 9,
CW_MSG_WTP_EVENT_RESPONSE = 10,
CW_MSG_CHANGE_STATE_EVENT_REQUEST = 11,
CW_MSG_CHANGE_STATE_EVENT_RESPONSE = 12,
CW_MSG_ECHO_REQUEST = 13,
CW_MSG_ECHO_RESPONSE = 14,
CW_MSG_IMAGE_DATA_REQUEST = 15,
CW_MSG_IMAGE_DATA_RESPONSE = 16,
CW_MSG_RESET_REQUEST = 17,
CW_MSG_RESET_RESPONSE = 18,
CW_MSG_PRIMARY_DISCOVERY_REQUEST = 19,
CW_MSG_PRIMARY_DISCOVERY_RESPONSE = 20,
CW_MSG_DATA_TRANSFER_REQUEST = 21,
CW_MSG_DATA_TRANSFER_RESPONSE = 22,
CW_MSG_CLEAR_CONFIGURATION_REQUEST = 23,
CW_MSG_CLEAR_CONFIGURATION_RESPONSE = 24,
CW_STATION_CONFIGURATION_REQUEST = 25,
CW_STATION_CONFIGURATION_RESPONSE = 26,
CW_MSG_MAXMSG = 26
};
//cw_msg_t;
#define CAPWAP_WBID_RESERVED1 0
#define CAPWAP_WBID_IEEE80211 1
#define CAPWAP_WBID_RESERVED2 2
#define CAPWAP_WBID_EPCGLOBAL 3
/**@}*/
#define CAPWAP_PACKET_PREAMBLE (CAPWAP_VERSION<<4)
#define CAPWAP_DTLS_PACKET_PREAMBLE (CAPWAP_VERSION<<4|1)
/*
#define CW_MSG_DISCOVERY_REQUEST 1
#define CW_MSG_DISCOVERY_RESPONSE 2
/**
* @defgroup CAPWAPMessages CAPWAP message types as defined in RFC 5416
* @{
*/
/**
* The Discovery Request message is sent by the WTP to
* find an AC on the network and inform the AC about some
* basic capabillities of the WTP. */
#define CAPWAP_MSG_DISCOVERY_REQUEST 1
/**
* A Discovery Response message is send by the AP to
* the WTP after receiving a Discovery Request message. */
#define CAPWAP_MSG_DISCOVERY_RESPONSE 2
#define CW_MSG_JOIN_REQUEST 3
#define CW_MSG_JOIN_RESPONSE 4
@ -204,25 +157,33 @@ CW_MSG_MAXMSG = 26
#define CW_STATION_CONFIGURATION_RESPONSE 26
#define CW_MSG_MAXMSG 26
*/
/**@}*/
/**
* CAPWAP message elements as defined in RFC 5415
*/
* @defgroup CAPWAPMsgElems CAPWAP Message Elements
* @brief CAPWAP message elements as defined in RFC 5415
* @{
*/namin
#define CW_ELEM_AC_DESCRIPTOR 1
#define CW_ELEM_AC_IPV4_LIST 2
#define CW_ELEM_AC_IPV6_LIST 3
#define CW_ELEM_AC_DESCRIPTOR 1 /**< AC Descriptor */
#define CW_ELEM_AC_IPV4_LIST 2 /**< AC IP V4 List */
#define CW_ELEM_AC_IPV6_LIST 3 /**< AC IP V6 List */
#define CW_ELEM_AC_NAME 4
#define CW_ELEM_AC_NAME_WITH_PRIORITY 5
#define CW_ELEM_AC_NAME_WITH_INDEX CW_ELEM_AC_NAME_WITH_PRIORITY /* Draft 7 naming */
#define CW_ELEM_AC_NAME_WITH_INDEX CW_ELEM_AC_NAME_WITH_PRIORITY /**< Draft 7 naming */
#define CW_ELEM_AC_TIMESTAMP 6
/**@{
* one for all
*/
/* yes one for alllll */
#define CW_ELEM_ADD_MAC_ACL_ENTRY 7
#define CW_ELEM_ADD_STATION 8
#define CW_ELEM_RESERVED_9 9
#define CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS 10
#define CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS 11
/**@}*/
#define CW_ELEM_CAPWAP_LOCAL_IPV4_ADDRESS 30
#define CW_ELEM_CAPWAP_LOCAL_IPV6_ADDRESS 50
#define CW_ELEM_CAPWAP_TIMERS 12
@ -272,7 +233,7 @@ CW_MSG_MAXMSG = 26
#define CW_ELEM_WTP_IPV4_IP_ADDRESS 42
#define CW_ELEM_WTP_IPV6_IP_ADDRESS 43
/**@}*/
/**
* @defgrpup BOARD_SUBELEMS Board Data Sub-Elements
@ -310,12 +271,23 @@ CW_MSG_MAXMSG = 26
#define CW_WTP_FRAME_TUNNEL_MODE_N 8 /* native mode */
/* Discovery Types */
#define CW_DISCOVERY_TYPE_UNKNOWN 0
#define CW_DISCOVERY_TYPE_STATIC 1
#define CW_DISCOVERY_TYPE_DHCP 2
#define CW_DISCOVERY_TYPE_DNS 3
#define CW_DISCOVERY_TYPE_AC_REFERRAL 4
/**
* @defgroup CAPWAPDiscoveryTypes CAPWAP Discovery Types
* @brief CAPWAP Discovery Types defined in RFC5415
* @{
*/
/** Discovery Type is unknown */
#define CAPWAP_DISCOVERY_TYPE_UNKNOWN 0
/** AC was discoverd by a static IP address stored in AP's config */
#define CAPWAP_DISCOVERY_TYPE_STATIC 1
/** AC was discovered by DHCP option 43 returned from a DHCP server */
#define CAPWAP_DISCOVERY_TYPE_DHCP 2
/** AC was discovered by DNS lookup */
#define CAPWAP_DISCOVERY_TYPE_DNS 3
/** AC was discovered by referral */
#define CAPWAP_DISCOVERY_TYPE_AC_REFERRAL 4
/**@}*/
/* WTP mac types */
@ -759,3 +731,7 @@ int cw_in_radio_administrative_state_wtp(struct conn *conn, struct cw_action_in
#endif
/**
*@}
*/

View File

@ -16,7 +16,7 @@ cw_action_in_t capwap_80211_actions_ac_in[] = {
* Discovery Resquest
*/
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_REQUEST,
{0, 0, CW_STATE_DISCOVERY, CAPWAP_MSG_DISCOVERY_REQUEST,
CW_ACTION_IN_80211_WTP_RADIO_INFORMATION, 1}
,
/* --------------------------------------------------------
@ -35,7 +35,7 @@ cw_action_in_t capwap_80211_actions_ac_in[] = {
cw_action_out_t capwap_80211_actions_ac_out[]={
/* Radio Infos */
{CW_MSG_DISCOVERY_RESPONSE, NULL /*CW_ELEM80211_WTP_RADIO_INFORMATION*/, 0,
{CAPWAP_MSG_DISCOVERY_RESPONSE, NULL /*CW_ELEM80211_WTP_RADIO_INFORMATION*/, 0,
CW_ELEM80211_WTP_RADIO_INFORMATION, NULL,cw_out_radio_infos, NULL,1}
,

View File

@ -13,7 +13,7 @@
cw_action_in_t capwap_80211_actions_wtp_in[] = {
/* Discovery Response */
{0, 0, CW_STATE_DISCOVERY, CW_MSG_DISCOVERY_RESPONSE,
{0, 0, CW_STATE_DISCOVERY, CAPWAP_MSG_DISCOVERY_RESPONSE,
CW_ACTION_IN_80211_WTP_RADIO_INFORMATION, 1}
,
@ -34,7 +34,7 @@ cw_action_out_t capwap_80211_actions_wtp_out[]={
*/
/* 802.11 Radio Information */
{CW_MSG_DISCOVERY_REQUEST, CW_ITEM_RADIO_INFOS /*CW_ELEM80211_WTP_RADIO_INFORMATION*/, 0,
{CAPWAP_MSG_DISCOVERY_REQUEST, CW_ITEM_RADIO_INFOS /*CW_ELEM80211_WTP_RADIO_INFORMATION*/, 0,
CW_ELEM80211_WTP_RADIO_INFORMATION, NULL,cw_out_radio_infos, NULL,1}
,

View File

@ -26,8 +26,8 @@
* CAPWAP Message Strings
*/
struct cw_strlist_elem capwap_strings_msg[] = {
{ CW_MSG_DISCOVERY_REQUEST, "Discovery Request" },
{ CW_MSG_DISCOVERY_RESPONSE,"Discovery Response" },
{ CAPWAP_MSG_DISCOVERY_REQUEST, "Discovery Request" },
{ CAPWAP_MSG_DISCOVERY_RESPONSE,"Discovery Response" },
{ CW_MSG_JOIN_REQUEST, "Join Request"},
{ CW_MSG_JOIN_RESPONSE,"Join Response"},
{ CW_MSG_CONFIGURATION_STATUS_REQUEST,"Configuration Status Request"},

View File

@ -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, CW_VERSION << 4 | 0);
cw_set_hdr_preamble(buffer, CAPWAP_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, CW_VERSION << 4 | 0);
cw_set_hdr_preamble(buffer, CAPWAP_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) != (CW_VERSION << 4)) {
if ((preamble & 0xf0) != (CAPWAP_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,
CW_VERSION);
CAPWAP_VERSION);
errno = EAGAIN;
return -1;
}

View File

@ -89,16 +89,16 @@
#define cw_get_hdr_rmac_size(th) cw_get_hdr_rmac_len(th)
#define cw_get_hdr_rmac_data(th) (th+9)
#define cw_get_hdr_flag_r1(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_R1 ) ? 1:0)
#define cw_get_hdr_flag_r2(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_R2 ) ? 1:0)
#define cw_get_hdr_flag_r3(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_R3 ) ? 1:0)
#define cw_get_hdr_flag_r1(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_R1 ) ? 1:0)
#define cw_get_hdr_flag_r2(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_R2 ) ? 1:0)
#define cw_get_hdr_flag_r3(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_R3 ) ? 1:0)
#define cw_get_hdr_flag_k(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_K ) ? 1:0)
#define cw_get_hdr_flag_m(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_M ) ? 1:0)
#define cw_get_hdr_flag_w(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_W ) ? 1:0)
#define cw_get_hdr_flag_l(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_L ) ? 1:0)
#define cw_get_hdr_flag_f(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_F ) ? 1:0)
#define cw_get_hdr_flag_t(th) ((ntohl( *((uint32_t*)th)) & CW_FLAG_HDR_T ) ? 1:0)
#define cw_get_hdr_flag_k(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_K ) ? 1:0)
#define cw_get_hdr_flag_m(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_M ) ? 1:0)
#define cw_get_hdr_flag_w(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_W ) ? 1:0)
#define cw_get_hdr_flag_l(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_L ) ? 1:0)
#define cw_get_hdr_flag_f(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_F ) ? 1:0)
#define cw_get_hdr_flag_t(th) ((ntohl( *((uint32_t*)th)) & CAPWAP_FLAG_HDR_T ) ? 1:0)
/**
* Get length wireless specific data
@ -196,7 +196,7 @@ static inline void cw_set_hdr_rid(uint8_t * th, int rid)
#define cw_set_hdr_flags(th,flags,set) \
( set ? ((*((uint32_t*)th)) |= htonl(flags)) : ((*((uint32_t*)th)) &= (0xffffffff^htonl(flags))) )
#define cw_set_hdr_flag_f(th,set) cw_set_hdr_flag(th, CW_FLAG_HDR_F)
#define cw_set_hdr_flag_f(th,set) cw_set_hdr_flag(th, CAPWAP_FLAG_HDR_F)
@ -267,13 +267,13 @@ static inline int cw_get_hdr_msg_total_len(uint8_t * rawmsg)
static inline int cw_set_hdr_rmac(uint8_t * th, bstr_t rmac)
{
if (!rmac) {
cw_set_hdr_flags(th, CW_FLAG_HDR_M, 0);
cw_set_hdr_flags(th, CAPWAP_FLAG_HDR_M, 0);
cw_set_hdr_hlen(th, 2);
return 0;
}
int rmac_len = bstr_len(rmac);
memcpy(cw_get_hdr_rmac(th), rmac, rmac_len + 1);
cw_set_hdr_flags(th, CW_FLAG_HDR_M, 1);
cw_set_hdr_flags(th, CAPWAP_FLAG_HDR_M, 1);
int hlen = 4 + rmac_len / 4;

View File

@ -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,CW_CONTROL_PORT);
sock_setport((struct sockaddr*)&addr,CAPWAP_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,CW_CONTROL_PORT);
sock_setport((struct sockaddr*)&addr,CAPWAP_CONTROL_PORT);
memcpy(&acip->ip,&addr,sizeof(addr));
acip->index = cw_get_word(data+16);
}

View File

@ -26,7 +26,7 @@ int cw_in_radio_generic(struct conn *conn, struct cw_action_in *a, uint8_t * dat
mbag_t radio = mbag_i_get_mbag(conn->radios, rid, NULL);
if (!radio) {
if (a->vendor_id != 0
|| ( (a->vendor_id == 0) && (a->msg_id != CW_MSG_DISCOVERY_REQUEST
|| ( (a->vendor_id == 0) && (a->msg_id != CAPWAP_MSG_DISCOVERY_REQUEST
&& a->msg_id != CW_MSG_JOIN_REQUEST) )) {
cw_dbg(DBG_ELEM_ERR, "Radio not found %d", rid);
return 0;

View File

@ -16,7 +16,7 @@ uint8_t *cw_init_data_keep_alive_msg(uint8_t * buffer,uint8_t *rmac)
cw_set_hdr_rmac(buffer, rmac);
cw_set_hdr_flags(buffer, CW_FLAG_HDR_K,1);
cw_set_hdr_flags(buffer, CAPWAP_FLAG_HDR_K,1);
return cw_get_hdr_payload_ptr(buffer);
}

View File

@ -19,7 +19,7 @@ void cw_init_response(struct conn * conn, uint8_t *req)
int dhbytes;
memcpy(buffer,req,shbytes);
cw_set_hdr_hlen(buffer,2);
cw_set_hdr_flags(buffer,CW_FLAG_HDR_M,1);
cw_set_hdr_flags(buffer,CAPWAP_FLAG_HDR_M,1);
dhbytes = cw_get_hdr_msg_offset(buffer);
uint8_t * msgptr = req+shbytes;

View File

@ -168,7 +168,7 @@ uint8_t * fragman_add(frag_t * frags, uint8_t *packet, int hlen, int payloadlen)
f->bytesreceived+=payloadlen;
}
if (val0 & CW_FLAG_HDR_L){
if (val0 & CAPWAP_FLAG_HDR_L){
f->bytesneeded=dst+payloadlen;
}

View File

@ -202,7 +202,7 @@ int netconn_send_capwap_msg(struct netconn * nc, uint8_t *rawmsg, int msglen)
int mtu = 1400;
while (msglen>mtu){
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F,1);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F,1);
cw_put_dword(ptr+4, nc->fragid<<16 | fragoffset<<3 );
cw_dbg_pkt_nc(DBG_PKT_OUT,nc,ptr,mtu,(struct sockaddr*)&nc->addr);
@ -219,9 +219,9 @@ int netconn_send_capwap_msg(struct netconn * nc, uint8_t *rawmsg, int msglen)
if (fragoffset)
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F | CW_FLAG_HDR_L,1);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F | CAPWAP_FLAG_HDR_L,1);
else
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F,0);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F,0);
cw_put_dword(ptr+4, nc->fragid<<16 | fragoffset<<3 );
@ -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) != (CW_VERSION << 4)) {
if ((preamble & 0xf0) != (CAPWAP_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,
CW_VERSION);
CAPWAP_VERSION);
errno = EAGAIN;
return -1;
}

View File

@ -36,7 +36,7 @@ cw_dbg(DBG_X,"Here is a conn_send_msg for anything");
int mtu = conn->mtu;
while (packetlen>mtu){
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F,1);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F,1);
cw_put_dword(ptr+4, conn->fragid<<16 | fragoffset<<3 );
cw_dbg_pkt(DBG_PKT_OUT,conn,ptr,mtu,(struct sockaddr*)&conn->addr);
@ -54,9 +54,9 @@ cw_dbg(DBG_X,"Here is a conn_send_msg for anything");
if (fragoffset)
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F | CW_FLAG_HDR_L,1);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F | CAPWAP_FLAG_HDR_L,1);
else
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F,0);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F,0);
cw_put_dword(ptr+4, conn->fragid<<16 | fragoffset<<3 );
@ -83,7 +83,7 @@ int conn_send_data_msg(struct conn * conn, uint8_t *rawmsg,int len)
int mtu = conn->mtu;
while (packetlen>mtu){
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F,1);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F,1);
cw_put_dword(ptr+4, conn->fragid<<16 | fragoffset<<3 );
cw_dbg_pkt(DBG_PKT_OUT,conn,ptr,mtu,(struct sockaddr*)&conn->addr);
@ -101,9 +101,9 @@ int conn_send_data_msg(struct conn * conn, uint8_t *rawmsg,int len)
if (fragoffset)
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F | CW_FLAG_HDR_L,1);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F | CAPWAP_FLAG_HDR_L,1);
else
cw_set_hdr_flags(rawmsg,CW_FLAG_HDR_F,0);
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F,0);
cw_put_dword(ptr+4, conn->fragid<<16 | fragoffset<<3 );