[PATCH] osmo-mgw[master]: mgcp_client: detect SDP section-start parsing errors

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Feb 21 15:59:02 UTC 2018


mgcp_client: detect SDP section-start parsing errors

After call to mgcp_find_section_end(), actually check the proper variable to
evaluate its return value.

Show in mgcp_client_test output that the parsing errors are fixed, and enable
the assertion that no tests should fail.

Change-Id: I62a2453cd9e2e7d5408423161fa65ec9c9989f98
---
M src/libosmo-mgcp-client/mgcp_client.c
M tests/mgcp_client/mgcp_client_test.c
M tests/mgcp_client/mgcp_client_test.err
3 files changed, 9 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/40/6640/2

diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c
index de940c0..e054593 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -262,7 +262,7 @@
 
 	/* Find beginning of the parameter (SDP) section */
 	data_ptr = mgcp_find_section_end(data);
-	if (!data) {
+	if (!data_ptr) {
 		LOGP(DLMGCP, LOGL_ERROR,
 		     "MGCP response: cannot find start of SDP parameters\n");
 		rc = -EINVAL;
diff --git a/tests/mgcp_client/mgcp_client_test.c b/tests/mgcp_client/mgcp_client_test.c
index 588b313..50e21b5 100644
--- a/tests/mgcp_client/mgcp_client_test.c
+++ b/tests/mgcp_client/mgcp_client_test.c
@@ -371,9 +371,7 @@
 		talloc_free(r);
 	}
 
-	/* Expecting failures due to known bugs, will be resolved in a subsequent commit.
 	OSMO_ASSERT(!failures);
-	*/
 }
 
 static const struct log_info_cat log_categories[] = {
diff --git a/tests/mgcp_client/mgcp_client_test.err b/tests/mgcp_client/mgcp_client_test.err
index 9079c27..7309242 100644
--- a/tests/mgcp_client/mgcp_client_test.err
+++ b/tests/mgcp_client/mgcp_client_test.err
@@ -15,9 +15,8 @@
 
 test_sdp_section_start() test [0]:
 body: ""
-got rc=0
-FAIL: Expected rc=-22
-got audio_port=0
+DLMGCP MGCP response: cannot find start of SDP parameters
+got rc=-22
 
 test_sdp_section_start() test [1]:
 body: "\n\n"
@@ -51,19 +50,16 @@
 
 test_sdp_section_start() test [7]:
 body: "some mgcp header data\r\nand header params\n\r\nm=audio 23\r\n"
-got rc=0
-FAIL: Expected rc=-22
-got audio_port=0
+DLMGCP MGCP response: cannot find start of SDP parameters
+got rc=-22
 
 test_sdp_section_start() test [8]:
 body: "some mgcp header data\r\nand header params\r\n\rm=audio 23\r\n"
-got rc=0
-FAIL: Expected rc=-22
-got audio_port=0
+DLMGCP MGCP response: cannot find start of SDP parameters
+got rc=-22
 
 test_sdp_section_start() test [9]:
 body: "some mgcp header data\r\nand header params\n\r\rm=audio 23\r\n"
-got rc=0
-FAIL: Expected rc=-22
-got audio_port=0
+DLMGCP MGCP response: cannot find start of SDP parameters
+got rc=-22
 Done

-- 
To view, visit https://gerrit.osmocom.org/6640
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I62a2453cd9e2e7d5408423161fa65ec9c9989f98
Gerrit-PatchSet: 2
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list