2016-03-05 12:34:54 +01:00
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#include "capwap.h"
|
|
|
|
#include "intavltree.h"
|
|
|
|
#include "dbg.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "capwap_items.h"
|
|
|
|
|
|
|
|
int cw_in_check_generic_resp(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
|
|
|
int len,struct sockaddr *from)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/* Check if the message contains a result code and
|
|
|
|
if it indicates an errror */
|
|
|
|
mbag_item_t * result = mbag_get(conn->incomming,CW_ITEM_RESULT_CODE);
|
2016-03-13 18:55:42 +01:00
|
|
|
|
2016-03-05 12:34:54 +01:00
|
|
|
if (result ) {
|
2018-03-03 17:42:28 +01:00
|
|
|
if (!cw_rcok(result->u2.dword)){
|
|
|
|
return result->u2.dword;
|
2016-03-05 12:34:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-07 19:09:38 +01:00
|
|
|
cw_action_in_t * mlist[60];
|
2016-03-05 12:34:54 +01:00
|
|
|
|
|
|
|
/* Check for mandatory elements */
|
|
|
|
int n = cw_check_missing_mand(mlist,conn,a);
|
|
|
|
if (n && conn->strict_capwap) {
|
|
|
|
cw_dbg_missing_mand(DBG_MSG_ERR,conn,mlist,n,a);
|
|
|
|
errno=EAGAIN;
|
|
|
|
return -1; /* CW_RESULT_MISSING_MAND_ELEM */
|
|
|
|
}
|
|
|
|
if (n){
|
|
|
|
cw_dbg_missing_mand(DBG_RFC,conn,mlist,n,a);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we hava a result code, return it */
|
2016-03-13 18:55:42 +01:00
|
|
|
if ( result ) {
|
2018-03-03 17:42:28 +01:00
|
|
|
return result->u2.dword;
|
2016-03-13 18:55:42 +01:00
|
|
|
}
|
2016-03-05 12:34:54 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|