More cisco-compatibility.

FossilOrigin-Name: 04ec8be34c8f04e70ce803fb8f47f72f426bdc7cf85edced8f09d3a9f1f0c50d
This commit is contained in:
7u83@mail.ru
2015-03-14 20:41:50 +00:00
parent b0191ba570
commit 4a20f80250
26 changed files with 439 additions and 64 deletions

View File

@ -26,7 +26,7 @@
static int wtpinfo_readelem_wtp_descriptor_(struct wtpinfo * wtpinfo, int type, uint8_t *msgelem, int len, int cq)
static int wtpinfo_readelem_wtp_descriptor_(struct wtpinfo * wtpinfo, int type, uint8_t *msgelem, int len, int capwap_mode)
{
if (type != CWMSGELEM_WTP_DESCRIPTOR)
return 0;
@ -37,19 +37,31 @@ static int wtpinfo_readelem_wtp_descriptor_(struct wtpinfo * wtpinfo, int type,
wtpinfo->max_radios=*msgelem;
wtpinfo->radios_in_use=*(msgelem+1);
int ncrypt = *(msgelem+2);
int i;
if (ncrypt == 0 ){
/* non-conform */
cw_dbg(DBG_CW_RFC,"Non-standard-conform WTP descriptor detected (See RFC 5415)");
if (!cq)
i=3;
else
int ncrypt;
int i=2;
switch (capwap_mode){
case CWMODE_CISCO:
wtpinfo->encryption_cap = ntohs( *((uint16_t*)(msgelem+2)) );
i=4;
break;
default:
{
ncrypt= *(msgelem+2);
if (ncrypt == 0 ){
/* non-conform */
cw_dbg(DBG_CW_RFC,"Non-standard-conform WTP descriptor detected (See RFC 5415)");
i=3;
}
else
i=ncrypt*3+3;
}
}
else{
i=ncrypt*3+3;
}
do {
if (i+8>len)
@ -101,10 +113,11 @@ static int wtpinfo_readelem_wtp_descriptor_(struct wtpinfo * wtpinfo, int type,
int wtpinfo_readelem_wtp_descriptor(struct wtpinfo * wtpinfo, int type, uint8_t *msgelem, int len)
{
int rc =wtpinfo_readelem_wtp_descriptor_(wtpinfo, type, msgelem, len,0);
int rc =wtpinfo_readelem_wtp_descriptor_(wtpinfo, type, msgelem, len,CWMODE_STD);
if (rc==-1){
cw_dbg(DBG_CW_RFC,"Bad wtp descriptor, trying cisco hack");
rc =wtpinfo_readelem_wtp_descriptor_(wtpinfo, type, msgelem, len,1);
cw_dbg(DBG_CW_RFC,"Bad wtp descriptor, trying cisco");
rc =wtpinfo_readelem_wtp_descriptor_(wtpinfo, type, msgelem, len,CWMODE_CISCO);
}
return rc;