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

2018-02-22 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I62a2453cd9e2e7d5408423161fa65ec9c9989f98
Gerrit-PatchSet: 2
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


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

2018-02-21 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: mgcp_client: detect SDP section-start parsing errors
..


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(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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: merged
Gerrit-Change-Id: I62a2453cd9e2e7d5408423161fa65ec9c9989f98
Gerrit-PatchSet: 2
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


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

2018-02-21 Thread Neels Hofmeyr

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 
Gerrit-Reviewer: Jenkins Builder


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

2018-02-21 Thread Neels Hofmeyr

Review at  https://gerrit.osmocom.org/6640

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/1

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: newchange
Gerrit-Change-Id: I62a2453cd9e2e7d5408423161fa65ec9c9989f98
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr