Module: kamailio
Branch: master
Commit: f088d2afe4153b9e440a4293211c78f5a25af691
URL: 
https://github.com/kamailio/kamailio/commit/f088d2afe4153b9e440a4293211c78f5a25af691

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2018-09-17T16:18:58+02:00

core: if nosip msg hooks skip handling the packet, stop sip routing processing

---

Modified: src/core/receive.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/f088d2afe4153b9e440a4293211c78f5a25af691.diff
Patch: 
https://github.com/kamailio/kamailio/commit/f088d2afe4153b9e440a4293211c78f5a25af691.patch

---

diff --git a/src/core/receive.c b/src/core/receive.c
index df8db65ca6..b14ebf8fb9 100644
--- a/src/core/receive.c
+++ b/src/core/receive.c
@@ -169,6 +169,7 @@ int receive_msg(char *buf, unsigned int len, struct 
receive_info *rcv_info)
        sr_event_param_t evp = {0};
        unsigned int cidlockidx = 0;
        unsigned int cidlockset = 0;
+       int errsipmsg = 0;
 
        if(sr_event_enabled(SREV_NET_DATA_RECV)) {
                if(sip_check_fline(buf, len) == 0) {
@@ -214,15 +215,22 @@ int receive_msg(char *buf, unsigned int len, struct 
receive_info *rcv_info)
                msg_set_time(msg);
 
        if(parse_msg(buf, len, msg) != 0) {
+               errsipmsg = 1;
                evp.data = (void *)msg;
                if((ret = sr_event_exec(SREV_RCV_NOSIP, &evp)) < 
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);
-               } else if(ret == NONSIP_MSG_DROP)
+                       LM_DBG("attempt of nonsip message processing failed\n");
+               } else if(ret == NONSIP_MSG_DROP) {
+                       LM_DBG("nonsip message processing completed\n");
                        goto error02;
+               }
+       }
+       if(errsipmsg==1) {
+               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;
        }
 
        if(unlikely(parse_headers(msg, HDR_FROM_F | HDR_TO_F | HDR_CALLID_F | 
HDR_CSEQ_F, 0)


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to