pespin submitted this change.
mgw: Increment rate_ctr MGCP_*_FAIL_UNHANDLED_PARAM during parsing
We could not do it before because we had no easy access to the command
verb being parsed. Now that we have access to it, bettter increase it
where we have exact path where stuff happens.
Change-Id: I3ea45fc1d25284b253ac9b7f0c0a925c10c994ca
---
M src/libosmo-mgcp/mgcp_msg.c
M src/libosmo-mgcp/mgcp_protocol.c
2 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/src/libosmo-mgcp/mgcp_msg.c b/src/libosmo-mgcp/mgcp_msg.c
index afeadd5..f7cba70 100644
--- a/src/libosmo-mgcp/mgcp_msg.c
+++ b/src/libosmo-mgcp/mgcp_msg.c
@@ -422,6 +422,22 @@
goto mgcp_header_done;
default:
LOG_MGCP_PDATA(pdata, LOGL_NOTICE, "unhandled option: '%c'/%d\n", *line, *line);
+ switch (pdata->rq->verb) {
+ case MGCP_VERB_CRCX:
+ rate_ctr_inc(rate_ctr_group_get_ctr(pdata->rq->trunk->ratectr.mgcp_crcx_ctr_group,
+ MGCP_CRCX_FAIL_UNHANDLED_PARAM));
+ break;
+ case MGCP_VERB_MDCX:
+ rate_ctr_inc(rate_ctr_group_get_ctr(pdata->rq->trunk->ratectr.mgcp_mdcx_ctr_group,
+ MGCP_MDCX_FAIL_UNHANDLED_PARAM));
+ break;
+ case MGCP_VERB_DLCX:
+ rate_ctr_inc(rate_ctr_group_get_ctr(pdata->rq->trunk->ratectr.mgcp_dlcx_ctr_group,
+ MGCP_DLCX_FAIL_UNHANDLED_PARAM));
+ break;
+ default:
+ break;
+ }
return -539;
}
}
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 0e0f9dd..ef0aad4 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -689,15 +689,8 @@
/* parse CallID C: and LocalParameters L: */
rc = mgcp_parse_hdr_pars(pdata);
- switch (rc) {
- case 0:
- break; /* all good, continue below */
- case -539:
- rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_FAIL_UNHANDLED_PARAM));
+ if (rc < 0)
return create_err_response(rq->trunk, NULL, -rc, "CRCX", pdata->trans);
- default:
- return create_err_response(rq->trunk, NULL, -rc, "CRCX", pdata->trans);
- }
/* Parse SDP if found: */
if (hpars->have_sdp) {
@@ -901,15 +894,8 @@
}
rc = mgcp_parse_hdr_pars(pdata);
- switch (rc) {
- case 0:
- break; /* all good, continue below */
- case -539:
- rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_MDCX_FAIL_UNHANDLED_PARAM));
+ if (rc < 0)
return create_err_response(rq->trunk, NULL, -rc, "MDCX", pdata->trans);
- default:
- return create_err_response(rq->trunk, NULL, -rc, "MDCX", pdata->trans);
- }
/* If a CallID is provided during MDCX, validate (unless endp was explicitly configured to ignore it
* through "X-Osmo-IGN: C") that it matches the one previously set. */
@@ -1094,15 +1080,8 @@
}
rc = mgcp_parse_hdr_pars(pdata);
- switch (rc) {
- case 0:
- break; /* all good, continue below */
- case -539:
- rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_DLCX_FAIL_UNHANDLED_PARAM));
+ if (rc < 0)
return create_err_response(rq->trunk, NULL, -rc, "DLCX", pdata->trans);
- default:
- return create_err_response(rq->trunk, NULL, -rc, "DLCX", pdata->trans);
- }
if (hpars->callid) {
/* If we have no endpoint, but a call id in the request, then this request cannot be handled */
To view, visit change 39737. To unsubscribe, or for help writing mail filters, visit settings.