Fixed issues with result codes

FossilOrigin-Name: d2b3ffce2340674f747a8a3086dd0ce1b9594c320965078ae88f634753e0859a
This commit is contained in:
7u83@mail.ru 2016-03-13 17:38:51 +00:00
parent ef2ddd635a
commit f884609be8

View File

@ -163,8 +163,8 @@ static struct mod_ac * detect_mod(struct conn *conn, uint8_t * rawmsg, int len,
int i; int i;
for (i = 0; mods[i]; i++) { for (i = 0; mods[i]; i++) {
if (mods[i]->detect) { if (mods[i]->detect) {
if (mods[i]-> if (mods[i]->detect
detect(conn, rawmsg, len, elems_len, from, mode)) { (conn, rawmsg, len, elems_len, from, mode)) {
return mods[i]; return mods[i];
} }
@ -179,14 +179,17 @@ static struct cw_actiondef * load_mods(struct conn *conn, uint8_t * rawmsg, int
int elems_len, struct sockaddr *from) int elems_len, struct sockaddr *from)
{ {
struct mod_ac * cmod = detect_mod(conn, rawmsg, len, elems_len, from, MOD_MODE_CAPWAP); struct mod_ac *cmod =
detect_mod(conn, rawmsg, len, elems_len, from, MOD_MODE_CAPWAP);
if (cmod == MOD_NULL) { if (cmod == MOD_NULL) {
cw_dbg(DBG_MSG_ERR, "Cant't find mod to handle connection from %s , discarding message", cw_dbg(DBG_MSG_ERR,
"Cant't find mod to handle connection from %s , discarding message",
sock_addr2str_p(from)); sock_addr2str_p(from));
return NULL; return NULL;
} }
struct mod_ac * bmod = detect_mod(conn, rawmsg, len, elems_len, from, MOD_MODE_BINDINGS); struct mod_ac *bmod =
detect_mod(conn, rawmsg, len, elems_len, from, MOD_MODE_BINDINGS);
cw_dbg(DBG_INFO, "Mods deteced: %s,%s", cmod->name, bmod->name); cw_dbg(DBG_INFO, "Mods deteced: %s,%s", cmod->name, bmod->name);
@ -395,11 +398,12 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
} }
if (unrecognized) { if (unrecognized) {
cw_dbg(DBG_RFC, "Message has %d unrecognized message elements.", cw_dbg(DBG_RFC, "Message has %d unrecognized message elements.",
unrecognized); unrecognized);
if (!result_code) { /* set only resultcode for request messages */
if ( (!result_code) && ((afm->msg_id & 1))) {
result_code = CW_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT; result_code = CW_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
} }