core: added more flexible processing for nonsip_hook messages 731/head
authorAlexandr Dubovikov <alexandr.dubovikov@gmail.com>
Mon, 1 Aug 2016 15:39:03 +0000 (17:39 +0200)
committerAlexandr Dubovikov <alexandr.dubovikov@gmail.com>
Mon, 1 Aug 2016 15:39:03 +0000 (17:39 +0200)
parser/parse_fline.c
receive.c

index ac0b461..5b2d346 100644 (file)
@@ -254,7 +254,7 @@ error:
        };
 error1:
        fl->type=SIP_INVALID;
-       LOG(L_ERR, "parse_first_line: bad message (offset: %d)\n", offset);
+       LOG(cfg_get(core, core_cfg, corelog), "parse_first_line: bad message (offset: %d)\n", offset);
        /* skip  line */
        nl=eat_line(buffer,len);
        return nl;
index b94b921..8ddf3e9 100644 (file)
--- a/receive.c
+++ b/receive.c
@@ -172,14 +172,14 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info)
        if(likely(sr_msg_time==1)) msg_set_time(msg);
 
        if (parse_msg(buf,len, msg)!=0){
-               if(sr_event_exec(SREV_RCV_NOSIP, (void*)msg)!=0) {
+               if((ret=sr_event_exec(SREV_RCV_NOSIP, (void*)msg))<NONSIP_MSG_DROP) {
                        LOG(cfg_get(core, core_cfg, corelog),
                                "core parsing of SIP message failed (%s:%d/%d)\n",
                                ip_addr2a(&msg->rcv.src_ip), (int)msg->rcv.src_port,
                                (int)msg->rcv.proto);
                        sr_core_ert_run(msg, SR_CORE_ERT_RECEIVE_PARSE_ERROR);
-               }
-               goto error02;
+               }               
+               else if(ret == NONSIP_MSG_DROP) goto error02;
        }
        LM_DBG("After parse_msg...\n");