Can handle unknown messages
FossilOrigin-Name: 189731bb4dae23486840ea02ba738a3eb8bad3dd58b184a89e9d3a5fbef3ff00
This commit is contained in:
parent
4dd1c09b31
commit
f0e838de0a
@ -4,8 +4,8 @@
|
|||||||
<Project Name="wtp" Path="wtp.project" Active="No"/>
|
<Project Name="wtp" Path="wtp.project" Active="No"/>
|
||||||
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
|
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
|
||||||
<Project Name="mod_capwap" Path="mod_capwap.project" Active="No"/>
|
<Project Name="mod_capwap" Path="mod_capwap.project" Active="No"/>
|
||||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="Yes"/>
|
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
||||||
<Project Name="libcw" Path="libcw.project" Active="No"/>
|
<Project Name="libcw" Path="libcw.project" Active="Yes"/>
|
||||||
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
||||||
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
||||||
<BuildMatrix>
|
<BuildMatrix>
|
||||||
|
@ -267,8 +267,6 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
|||||||
conn->detected = 1;
|
conn->detected = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("We have loaded the message set\n");
|
|
||||||
|
|
||||||
cw_dbg_msg(DBG_MSG_IN, conn, rawmsg, len, from);
|
cw_dbg_msg(DBG_MSG_IN, conn, rawmsg, len, from);
|
||||||
|
|
||||||
/* prepare struct for search operation */
|
/* prepare struct for search operation */
|
||||||
@ -277,7 +275,18 @@ printf("We have loaded the message set\n");
|
|||||||
struct cw_MsgData * message;
|
struct cw_MsgData * message;
|
||||||
/* Search for message combination */
|
/* Search for message combination */
|
||||||
message = mavl_get(conn->msgset->messages,&search);
|
message = mavl_get(conn->msgset->messages,&search);
|
||||||
|
|
||||||
|
int result_code = 0;
|
||||||
|
if (!message){
|
||||||
|
/* Message is unknown */
|
||||||
|
cw_dbg(DBG_MSG_ERR, "Message type %d (%s) unknown.",
|
||||||
|
search.type, cw_strmsg(search.type),
|
||||||
|
cw_strstate(conn->capwap_state));
|
||||||
|
result_code = CW_RESULT_MSG_UNRECOGNIZED;
|
||||||
|
cw_send_error_response(conn, rawmsg, result_code);
|
||||||
|
errno = EAGAIN;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// afm = cw_actionlist_in_get(conn->actions->in, &as);
|
// afm = cw_actionlist_in_get(conn->actions->in, &as);
|
||||||
@ -304,7 +313,7 @@ printf("We have loaded the message set\n");
|
|||||||
cw_dbg(DBG_MSG_ERR,
|
cw_dbg(DBG_MSG_ERR,
|
||||||
"Message type %d (%s) not allowed in %s State.", as.msg_id,
|
"Message type %d (%s) not allowed in %s State.", as.msg_id,
|
||||||
cw_strmsg(as.msg_id), cw_strstate(as.capwap_state));
|
cw_strmsg(as.msg_id), cw_strstate(as.capwap_state));
|
||||||
result_code = CW_RESULT_MSG_INVALID_IN_CURRENT_STATE;
|
result_code = CAPWAP_RESULT_MSG_INVALID_IN_CURRENT_STATE;
|
||||||
} else {
|
} else {
|
||||||
/* Message is unknown */
|
/* Message is unknown */
|
||||||
cw_dbg(DBG_MSG_ERR, "Message type %d (%s) unknown.",
|
cw_dbg(DBG_MSG_ERR, "Message type %d (%s) unknown.",
|
||||||
@ -388,7 +397,7 @@ printf("We have loaded the message set\n");
|
|||||||
/* all message elements are processed, do now after processing
|
/* all message elements are processed, do now after processing
|
||||||
by calling the "end" function for the message */
|
by calling the "end" function for the message */
|
||||||
|
|
||||||
int result_code = 0;
|
//int result_code = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -492,10 +492,14 @@ void cw_dbg_msg(int level, struct conn *conn, uint8_t * packet, int len,
|
|||||||
search.type = msg_id;
|
search.type = msg_id;
|
||||||
struct cw_MsgData * message;
|
struct cw_MsgData * message;
|
||||||
message = mavl_get(conn->msgset->messages,&search);
|
message = mavl_get(conn->msgset->messages,&search);
|
||||||
|
|
||||||
|
|
||||||
|
char * msname;
|
||||||
|
if (!message)
|
||||||
|
msname="Unknown";
|
||||||
|
else
|
||||||
|
msname = message->name;
|
||||||
|
|
||||||
s += sprintf(s, "%s Message (type=%d) ", message->name /*cw_strmsg(msg_id)*/, msg_id);
|
s += sprintf(s, "%s Message (type=%d) ", msname /*cw_strmsg(msg_id)*/, msg_id);
|
||||||
if (level == DBG_MSG_IN)
|
if (level == DBG_MSG_IN)
|
||||||
s += sprintf(s, "from %s ", sock_addr2str(from));
|
s += sprintf(s, "from %s ", sock_addr2str(from));
|
||||||
else
|
else
|
||||||
|
@ -101,7 +101,8 @@ static cw_msgdef_t messages[] = {
|
|||||||
/* Discovery Request Message*/
|
/* Discovery Request Message*/
|
||||||
{
|
{
|
||||||
.name = "Discovery Request",
|
.name = "Discovery Request",
|
||||||
.type = CAPWAP_MSG_DISCOVERY_REQUEST,
|
// .type = CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||||
|
.type = 7,
|
||||||
.states = (int[]){CAPWAP_STATE_DISCOVERY,0},
|
.states = (int[]){CAPWAP_STATE_DISCOVERY,0},
|
||||||
.elements = (cw_msgelemprops_t []){
|
.elements = (cw_msgelemprops_t []){
|
||||||
{&_DISCOVERY_TYPE,1},
|
{&_DISCOVERY_TYPE,1},
|
||||||
@ -132,7 +133,7 @@ static cw_msgdef_t messages[] = {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct cw_MsgSet * cisco_register_msg_set(struct cw_MsgSet * set, int mode){
|
struct cw_MsgSet * capwap_register_msg_set(struct cw_MsgSet * set, int mode){
|
||||||
if (mode != CW_MOD_MODE_CAPWAP)
|
if (mode != CW_MOD_MODE_CAPWAP)
|
||||||
return NULL;
|
return NULL;
|
||||||
cw_msgset_add(set,messages);
|
cw_msgset_add(set,messages);
|
||||||
|
Loading…
Reference in New Issue
Block a user