Join to a real vWLC works

FossilOrigin-Name: 924b4e58697b9cd2c2326f541e8cc302be46496c4b5ffb29d73fc305b5d7bf56
This commit is contained in:
7u83@mail.ru 2018-04-07 19:47:35 +00:00
parent d53b45ccb9
commit 572e1b6d97
10 changed files with 71 additions and 25 deletions

View File

@ -4,9 +4,9 @@
<Project Name="wtp" Path="wtp.project" Active="No"/>
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
<Project Name="mod_capwap" Path="mod_capwap.project" Active="No"/>
<Project Name="mod_cisco" Path="mod_cisco.project" Active="Yes"/>
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
<Project Name="libcw" Path="libcw.project" Active="No"/>
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="Yes"/>
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
<BuildMatrix>
<WorkspaceConfiguration Name="Debug" Selected="yes">

View File

@ -215,8 +215,8 @@
#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 CAPWAP_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS 10
#define CAPWAP_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS 11
/**@}*/
#define CAPWAP_ELEM_CAPWAP_LOCAL_IPV4_ADDRESS 30
#define CAPWAP_ELEM_CAPWAP_LOCAL_IPV6_ADDRESS 50

View File

@ -13,8 +13,8 @@ struct cw_StrListElem capwap_strings_elem[] = {
{CW_ELEM_ADD_MAC_ACL_ENTRY, "Add MAC ACL Entry"},
{CW_ELEM_ADD_STATION, "Add Station"},
{CW_ELEM_RESERVED_9, "Reserved 9"},
{CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS, "Control IPv4 Address"},
{CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, "Control IPv6 Address"},
{CAPWAP_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS, "Control IPv4 Address"},
{CAPWAP_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, "Control IPv6 Address"},
{CAPWAP_ELEM_CAPWAP_LOCAL_IPV4_ADDRESS, "CAWPAP Local IPv4 Address"},
{CAPWAP_ELEM_CAPWAP_LOCAL_IPV6_ADDRESS, "CAPWAP Local IPv6 Address"},
{CW_ELEM_CAPWAP_TIMERS, "CAPWAP Timers"},

View File

@ -295,8 +295,9 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
if (!message){
/* Message is unknown */
if (search.type & 1){
cw_dbg(DBG_MSG_ERR,
"Message type %d (%s) unrecognized, sending response.",
"Message type %d [%s] unrecognized, sending response.",
search.type, cw_strmsg(search.type),
cw_strstate(conn->capwap_state));
result_code = CAPWAP_RESULT_MSG_UNRECOGNIZED;
@ -304,6 +305,14 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
errno = EAGAIN;
return -1;
}
cw_dbg(DBG_MSG_ERR,
"Message type %d [%s] unrecognized, discarding.",
search.type, cw_strmsg(search.type),
cw_strstate(conn->capwap_state));
errno = EAGAIN;
return -1;
}
/* Throw away unexpected messages */
/* maybe we have to check this too: if (!(message->type & 1))

View File

@ -10,9 +10,6 @@ cw_KTV_t * cw_ktv_add(mavl_t kvtstore, const char *key, const struct cw_Type *ty
cw_KTV_t mdata, *mresult;
int exists;
/* cw_dbg(DBG_ELEM,"KVStore (%p,%d) add elem (%s): %s", kvstore, kvstore->count,
type->name, key );
*/
mdata.key=cw_strdup(key);
if (!mdata.key){
cw_log(LOG_ERR, "Can't allocate memory for KTV key %s: %s",
@ -28,6 +25,7 @@ cw_KTV_t * cw_ktv_add(mavl_t kvtstore, const char *key, const struct cw_Type *ty
return NULL;
}
mavl_del(kvtstore,&mdata);
mresult = mavl_add(kvtstore, &mdata, &exists);
if (exists){
cw_log(LOG_ERR, "Element already exists %s", key);

View File

@ -134,7 +134,7 @@ static struct cw_ElemHandler handlers[] = {
{
"CAPWAP Control IPv4 Address", /* name */
CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS, /* Element ID */
CAPWAP_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS, /* Element ID */
0,0, /* Vendor / Proto */
6,6, /* min/max length */
CW_TYPE_BSTR16, /* type */
@ -145,7 +145,7 @@ static struct cw_ElemHandler handlers[] = {
{
"CAPWAP Control IPv6 Address", /* name */
CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, /* Element ID */
CAPWAP_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, /* Element ID */
0,0, /* Vendor / Proto */
18,18, /* min/max length */
CW_TYPE_BSTR16, /* type */
@ -272,8 +272,8 @@ static int discovery_response_states[] = {CAPWAP_STATE_DISCOVERY,0};
static struct cw_ElemDef discovery_response_elements[] ={
{0,0,CAPWAP_ELEM_AC_DESCRIPTOR, 1, 0},
{0,0,CAPWAP_ELEM_AC_NAME, 1, 0},
{0,0,CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS, 1, 0},
{0,0,CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, 1, 0},
{0,0,CAPWAP_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS, 1, 0},
{0,0,CAPWAP_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, 1, 0},
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
{0,0,0,0,0}
@ -312,6 +312,14 @@ static struct cw_ElemDef join_response_elements[] ={
{0,0,CAPWAP_ELEM_AC_DESCRIPTOR, 1, 0},
{0,0,CAPWAP_ELEM_AC_NAME, 1, 0},
{0,0,CAPWAP_ELEM_ECN_SUPPORT, 1, 0},
{0,0,CAPWAP_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS, 1, 0},
{0,0,CAPWAP_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS, 1, 0},
{0,0,CAPWAP_ELEM_CAPWAP_LOCAL_IPV4_ADDRESS, 1, 0},
{0,0,CAPWAP_ELEM_CAPWAP_LOCAL_IPV6_ADDRESS, 1, 0},
{0,0,CAPWAP_ELEM_MAXIMUM_MESSAGE_LENGTH, 0, 0},
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
/* {0,0,CAPWAP_ELEM_AC_DESCRIPTOR, 1, 0},
{0,0,CAPWAP_ELEM_AC_NAME, 1, 0},
{0,0,CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS, 1, 0},

View File

@ -46,7 +46,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CAPWAP_STATE_DISCOVERY,
.msg_id = CAPWAP_MSG_DISCOVERY_RESPONSE,
.elem_id = CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS,
.elem_id = CAPWAP_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS,
.item_id = CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST,
.start = cw_in_capwap_control_ip_address,
.min_len = 6,
@ -60,7 +60,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CAPWAP_STATE_DISCOVERY,
.msg_id = CAPWAP_MSG_DISCOVERY_RESPONSE,
.elem_id = CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS,
.elem_id = CAPWAP_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS,
.item_id = CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST,
.start = cw_in_capwap_control_ip_address, // Change to v6 handler
.min_len = 18,
@ -163,7 +163,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CAPWAP_STATE_JOIN,
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
.elem_id = CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS,
.elem_id = CAPWAP_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS,
.item_id = CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST,
.start = cw_in_capwap_control_ip_address,
.min_len = 6,
@ -176,7 +176,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CAPWAP_STATE_JOIN,
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
.elem_id = CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS,
.elem_id = CAPWAP_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS,
.item_id = CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST,
.start = cw_in_capwap_control_ip_address, // Change to v6 handler
.min_len = 18,

View File

@ -76,12 +76,12 @@ int capwap_out_capwap_control_ip_address(struct cw_ElemHandler * eh,
l = address->type->len(address);
switch(eh->id){
case CW_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS:
case CAPWAP_ELEM_CAPWAP_CONTROL_IPV4_ADDRESS:
if (l!=4){
continue;
}
break;
case CW_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS:
case CAPWAP_ELEM_CAPWAP_CONTROL_IPV6_ADDRESS:
if (l!=16){
continue;
}

View File

@ -43,6 +43,13 @@ static struct cw_ElemDef join_request_elements[] = {
};
static int join_response_states[] = { CAPWAP_STATE_JOIN, 0 };
static struct cw_ElemDef join_response_elements[] = {
{0, 0, CAPWAP80211_ELEM_WTP_RADIO_INFORMATION, 1, 0},
{0, 0, 0, 0, 0}
};
static struct cw_MsgDef messages[] = {
{
@ -61,6 +68,14 @@ static struct cw_MsgDef messages[] = {
join_request_elements
}
,
{
"Join Request",
CAPWAP_MSG_JOIN_RESPONSE,
CW_ROLE_AC,
join_response_states,
join_response_elements
}
,
{0, 0, 0, 0, 0}
};

View File

@ -268,8 +268,16 @@ 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,1, CW_IGNORE},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_PATH_MTU, 0, 0},
{0,0,0,00}
};
static struct cw_MsgDef messages[] = {
{
NULL, /* name */
@ -292,6 +300,14 @@ static struct cw_MsgDef messages[] = {
join_request_states,
join_request_elements
},
{
NULL, /* name */
CAPWAP_MSG_JOIN_RESPONSE, /* type */
CW_ROLE_WTP,
join_response_states,
join_response_elements
},
{0,0,0,0}
};