Change in osmo-mgw[master]: mgcp_client: fix error handling in mgcp message generation

dexter gerrit-no-reply at lists.osmocom.org
Fri Jun 11 13:16:45 UTC 2021


Hello Jenkins Builder, neels, laforge, pespin, fixeria, 

I'd like you to reexamine a change. Please visit

    https://gerrit.osmocom.org/c/osmo-mgw/+/24182

to look at the new patch set (#4).

Change subject: mgcp_client: fix error handling in mgcp message generation
......................................................................

mgcp_client: fix error handling in mgcp message generation

The functions add_lco and add_sdp assert when the codec string can not
be generated. This is the case when an unexpected codec is addressed in
the input parameter mgcp_msg for mgcp_msg_gen(). Even though the API
user is expected only to use the codec identifiers in mgcp_client.h the
check should not be done with an assert. Instead mgcp_msg_gen() should
just return NULL imediately.

Also all generation functions should not use magic numbers as return
codes. Instead constants from errno.h should be used. It is also
problematic that the return codes from msgb_printf are added up.
Depending. It makes more sense to use an OR operator since msgb_printf
only returns 0 or -EINVAL, so the end result will be -EINVAL if one or
more msgb_printf fail and not just a random negative value.

Change-Id: Ibb788343e0bec9c0eaf33e6e4727d4d36c100017
Related: OS#5119
---
M src/libosmo-mgcp-client/mgcp_client.c
M tests/mgcp_client/mgcp_client_test.err
2 files changed, 67 insertions(+), 48 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/82/24182/4
-- 
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/24182
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ibb788343e0bec9c0eaf33e6e4727d4d36c100017
Gerrit-Change-Number: 24182
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newpatchset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210611/84326285/attachment.htm>


More information about the gerrit-log mailing list