Hack to deal with cisco messed wtp descriptors.
FossilOrigin-Name: a7917b7e37caeef0708004d17d2b151d8d66386cd9d9b48b96496b0bb9ffd05b
This commit is contained in:
		| @ -23,7 +23,10 @@ | |||||||
| #include "cw_util.h" | #include "cw_util.h" | ||||||
| #include "cw_log.h" | #include "cw_log.h" | ||||||
|  |  | ||||||
| int wtpinfo_readelem_wtp_descriptor(struct wtpinfo * wtpinfo, int type, uint8_t *msgelem, int len) |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | static int wtpinfo_readelem_wtp_descriptor_(struct wtpinfo * wtpinfo, int type, uint8_t *msgelem, int len, int cq) | ||||||
| { | { | ||||||
| 	if (type != CWMSGELEM_WTP_DESCRIPTOR) | 	if (type != CWMSGELEM_WTP_DESCRIPTOR) | ||||||
| 		return 0; | 		return 0; | ||||||
| @ -36,10 +39,13 @@ int wtpinfo_readelem_wtp_descriptor(struct wtpinfo * wtpinfo, int type, uint8_t | |||||||
|  |  | ||||||
| 	int ncrypt = *(msgelem+2); | 	int ncrypt = *(msgelem+2); | ||||||
| 	int i; | 	int i; | ||||||
| 	if (ncrypt == 0){ | 	if (ncrypt == 0 ){ | ||||||
| 		/* non-conform */ | 		/* non-conform */ | ||||||
| 		cw_log_debug1("Non-standard-conform WTP descriptor detected (See RFC 5415)"); | 		cw_log_debug1("Non-standard-conform WTP descriptor detected (See RFC 5415)"); | ||||||
| 		i=4; | 		if (!cq)  | ||||||
|  | 			i=3; | ||||||
|  | 		else | ||||||
|  | 			i=4; | ||||||
| 	} | 	} | ||||||
| 	else{ | 	else{ | ||||||
| 		i=ncrypt*3+3; | 		i=ncrypt*3+3; | ||||||
| @ -90,4 +96,14 @@ int wtpinfo_readelem_wtp_descriptor(struct wtpinfo * wtpinfo, int type, uint8_t | |||||||
| 	return 1; | 	return 1; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | 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); | ||||||
|  | 	if (rc==-1){ | ||||||
|  | 		cw_log_debug2("Bad wtp descriptor, trying cisco hack"); | ||||||
|  | 		rc =wtpinfo_readelem_wtp_descriptor_(wtpinfo, type, msgelem, len,1); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return rc; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user