From 956f1cc46b63b0a1465bd7df0c6f4754e1112891 Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Mon, 7 Mar 2016 17:57:01 +0000 Subject: [PATCH] Iitall. FossilOrigin-Name: 66d33bc86dfae5e467d49b4cbc840f919810510aed059f1fadee59fc362bedf0 --- src/cw/cw_in_check_generic_req.c | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/cw/cw_in_check_generic_req.c diff --git a/src/cw/cw_in_check_generic_req.c b/src/cw/cw_in_check_generic_req.c new file mode 100644 index 00000000..504f8095 --- /dev/null +++ b/src/cw/cw_in_check_generic_req.c @@ -0,0 +1,42 @@ + +#include + +#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) +{ + + cw_action_in_t * mlist[60]; + + /* 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); + if (result ) { + if (!cw_rcok(result->dword)){ + return result->dword; + } + } + + + /* 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 */ + if ( result ) + return result->dword; + + return 0; +}