2015-04-07 07:44:55 +02:00
|
|
|
|
|
|
|
#include "capwap.h"
|
|
|
|
#include "intavltree.h"
|
|
|
|
#include "dbg.h"
|
2015-04-10 17:52:01 +02:00
|
|
|
#include "log.h"
|
2015-04-07 07:44:55 +02:00
|
|
|
#include "capwap_items.h"
|
2016-04-10 15:57:49 +02:00
|
|
|
#include "format.h"
|
|
|
|
#include "connlist.h"
|
2015-04-07 07:44:55 +02:00
|
|
|
|
|
|
|
int cw_in_check_join_req(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
2015-04-12 23:28:55 +02:00
|
|
|
int len,struct sockaddr *from)
|
2015-04-07 07:44:55 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
cw_action_in_t * mlist[60];
|
|
|
|
|
|
|
|
/* Check for mandatory elements */
|
|
|
|
int n = cw_check_missing_mand(mlist,conn,a);
|
|
|
|
if (n) {
|
2015-04-13 11:00:46 +02:00
|
|
|
if ( conn->strict_capwap ){
|
|
|
|
cw_dbg_missing_mand(DBG_MSG_ERR,conn,mlist,n,a);
|
|
|
|
conn->capwap_state=CW_STATE_JOIN;
|
|
|
|
return CW_RESULT_MISSING_MAND_ELEM;
|
|
|
|
}
|
|
|
|
cw_dbg_missing_mand(DBG_RFC,conn,mlist,n,a);
|
2015-04-07 07:44:55 +02:00
|
|
|
}
|
|
|
|
|
2016-04-10 15:57:49 +02:00
|
|
|
connlist_lock(conn->connlist);
|
|
|
|
struct conn *cc = connlist_get_by_session_id(conn->connlist,conn);
|
|
|
|
if (!cc){
|
|
|
|
connlist_add_by_session_id(conn->connlist,conn);
|
|
|
|
}
|
|
|
|
connlist_unlock(conn->connlist);
|
|
|
|
if (cc){
|
|
|
|
cw_dbg(DBG_ELEM_ERR,"Session already in use %s",format_bin2hex(conn->session_id,16));
|
|
|
|
conn->capwap_state=CW_STATE_JOIN;
|
|
|
|
return CW_RESULT_JOIN_FAILURE_SESSION_ALREADY_IN_USE;
|
|
|
|
}
|
2015-04-07 07:44:55 +02:00
|
|
|
|
|
|
|
/* set result code to ok and change to configure state */
|
2015-04-19 23:27:44 +02:00
|
|
|
mbag_set_dword(conn->outgoing,CW_ITEM_RESULT_CODE,0);
|
2015-04-07 07:44:55 +02:00
|
|
|
conn->capwap_state = CW_STATE_CONFIGURE;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|