2015-04-07 07:44:55 +02:00
|
|
|
|
|
|
|
#include "capwap.h"
|
2015-04-10 17:14:55 +02:00
|
|
|
#include "capwap_items.h"
|
|
|
|
|
2015-04-07 07:44:55 +02:00
|
|
|
#include "intavltree.h"
|
2015-04-10 17:52:01 +02:00
|
|
|
#include "log.h"
|
2015-04-07 07:44:55 +02:00
|
|
|
#include "dbg.h"
|
|
|
|
#include "sock.h"
|
|
|
|
|
|
|
|
int cw_in_check_disc_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
|
|
|
{
|
2018-03-05 12:23:16 +01:00
|
|
|
char sock_buf[SOCK_ADDR_BUFSIZE];
|
2015-04-07 07:44:55 +02:00
|
|
|
|
2015-04-12 19:19:29 +02:00
|
|
|
cw_action_in_t *mlist[120];
|
2015-04-07 07:44:55 +02:00
|
|
|
int n = cw_check_missing_mand(mlist, conn, a);
|
|
|
|
|
|
|
|
conn->capwap_state = CW_STATE_NONE;
|
|
|
|
|
2016-03-17 01:26:12 +01:00
|
|
|
|
2015-04-12 19:19:29 +02:00
|
|
|
if (n && conn->strict_capwap) {
|
|
|
|
cw_dbg_missing_mand(DBG_MSG_ERR, conn, mlist, n, a);
|
|
|
|
/* if mandatory elements are missing, in strict
|
|
|
|
mode send no discovery response */
|
2015-04-11 19:00:51 +02:00
|
|
|
cw_dbg(DBG_MSG_ERR,
|
2015-04-07 07:44:55 +02:00
|
|
|
"Ignoring Discovery Request from %s - missing mandatory elements.",
|
2018-03-05 12:23:16 +01:00
|
|
|
sock_addr2str(from,sock_buf));
|
2015-04-07 07:44:55 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-04-12 19:19:29 +02:00
|
|
|
if ( n ) {
|
|
|
|
/* put a warning here */
|
|
|
|
cw_dbg_missing_mand(DBG_RFC, conn, mlist, n, a);
|
|
|
|
}
|
|
|
|
|
2015-04-10 17:14:55 +02:00
|
|
|
|
|
|
|
|
2015-04-07 07:44:55 +02:00
|
|
|
/* ok, send response */
|
2018-02-28 07:38:02 +01:00
|
|
|
conn->capwap_state = CAPWAP_STATE_JOIN;
|
2015-04-10 17:14:55 +02:00
|
|
|
|
2015-04-07 07:44:55 +02:00
|
|
|
return 0;
|
|
|
|
}
|