2015-04-13 10:58:28 +02:00
|
|
|
|
|
|
|
#include "capwap.h"
|
|
|
|
#include "intavltree.h"
|
|
|
|
#include "dbg.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "capwap_items.h"
|
|
|
|
#include "bstr.h"
|
|
|
|
#include "sock.h" //tube
|
|
|
|
|
2016-03-13 09:39:26 +01:00
|
|
|
#include "vendors.h"
|
2015-04-13 10:58:28 +02:00
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
void cw_get_wtp_name(struct conn *conn,struct sockaddr *addr)
|
2015-04-13 10:58:28 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int cw_set_capwap_mode(struct conn *conn,int mode)
|
|
|
|
{
|
|
|
|
cw_dbg(DBG_INFO,"Setting CAPWAP mode to %d for %s",mode,sock_addr2str(&conn->addr));
|
|
|
|
conn->capwap_mode_out=mode;
|
2015-04-19 23:27:44 +02:00
|
|
|
return 1;
|
2015-04-13 10:58:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int cw_detect_capwap(struct conn *conn)
|
|
|
|
{
|
2015-04-19 23:27:44 +02:00
|
|
|
mbag_t is = conn->incomming;
|
2015-04-13 10:58:28 +02:00
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
mbag_item_t * item = mbag_get(is,CW_ITEM_WTP_SOFTWARE_VERSION);
|
2015-04-13 10:58:28 +02:00
|
|
|
if (item) {
|
2016-03-04 20:20:28 +01:00
|
|
|
bstrv_t s = item->data;
|
|
|
|
uint32_t v = bstrv_get_vendor_id(s);
|
2015-04-13 10:58:28 +02:00
|
|
|
|
|
|
|
switch(v) {
|
|
|
|
case CW_VENDOR_ID_CISCO:
|
|
|
|
cw_set_capwap_mode(conn,CW_MODE_CISCO);
|
|
|
|
break;
|
|
|
|
default:
|
2015-05-04 07:41:34 +02:00
|
|
|
cw_set_capwap_mode(conn,CW_MODE_CAPWAP);
|
2015-04-13 10:58:28 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int cw_in_check_cipwap_join_req(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
|
|
|
int len,struct sockaddr *from)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
int rc = cw_in_check_join_req(conn,a,data,len,from);
|
|
|
|
|
|
|
|
|
|
|
|
if ( rc==0 ) {
|
|
|
|
cw_detect_capwap(conn);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|