neels has submitted this change. (
https://gerrit.osmocom.org/c/osmo-mgw/+/37278?usp=email
)
Change subject: mgcp_test.c: fix various missing '\r' and '\n'
......................................................................
mgcp_test.c: fix various missing '\r' and '\n'
The only valid line endings are '\n' and '\r\n'.
We usually use '\r\n' like we were in MSDOS.
MGCP, RFC3435 3.1:
Headers and session descriptions are encoded as a set of text lines,
separated by a carriage return and line feed character (or,
optionally, a single line-feed character).
SDP, RFC8866 5:
The sequence CRLF (0x0d0a) is used to end a line,
although parsers SHOULD be tolerant and also accept lines terminated
with a single newline character.
There should probably be tests for '\n' line endings, but mixing them in
the same MGCP message is ridiculous.
Change-Id: I6d530535a3a5f1d1a0716ab9e4a8079ba1de242e
---
M tests/mgcp/mgcp_test.c
M tests/mgcp/mgcp_test.ok
2 files changed, 49 insertions(+), 22 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
laforge: Looks good to me, approved
diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index 65756e0..b2b8b82 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -131,11 +131,11 @@
#define MDCX4_ADDR0000 \
"MDCX 18983216 1@mgw MGCP 1.0\r\n" \
- "M: sendrecv\r" \
+ "M: sendrecv\r\n" \
"C: 2\r\n" \
"I: %s\r\n" \
"L: p:20, a:AMR, nt:IN\r\n" \
- "\n" \
+ "\r\n" \
"v=0\r\n" \
"o=- %s 23 IN IP4 0.0.0.0\r\n" \
"c=IN IP4 0.0.0.0\r\n" \
@@ -149,11 +149,11 @@
#define MDCX4 \
"MDCX 18983217 1@mgw MGCP 1.0\r\n" \
- "M: sendrecv\r" \
+ "M: sendrecv\r\n" \
"C: 2\r\n" \
"I: %s\r\n" \
"L: p:20, a:AMR, nt:IN\r\n" \
- "\n" \
+ "\r\n" \
"v=0\r\n" \
"o=- %s 23 IN IP4 5.6.7.8\r\n" \
"c=IN IP4 5.6.7.8\r\n" \
@@ -188,11 +188,11 @@
#define MDCX4_PT1 \
"MDCX 18983218 1@mgw MGCP 1.0\r\n" \
- "M: SENDRECV\r" \
+ "M: SENDRECV\r\n" \
"C: 2\r\n" \
"I: %s\r\n" \
"L: p:20-40, a:AMR, nt:IN\r\n" \
- "\n" \
+ "\r\n" \
"v=0\r\n" \
"o=- %s 23 IN IP4 5.6.7.8\r\n" \
"c=IN IP4 5.6.7.8\r\n" \
@@ -203,11 +203,11 @@
#define MDCX4_PT2 \
"MDCX 18983219 1@mgw MGCP 1.0\r\n" \
- "M: sendrecv\r" \
+ "M: sendrecv\r\n" \
"C: 2\r\n" \
"I: %s\r\n" \
"L: p:20-20, a:AMR, nt:IN\r\n" \
- "\n" \
+ "\r\n" \
"v=0\r\n" \
"o=- %s 23 IN IP4 5.6.7.8\r\n" \
"c=IN IP4 5.6.7.8\r\n" \
@@ -218,11 +218,11 @@
#define MDCX4_PT3 \
"MDCX 18983220 1@mgw MGCP 1.0\r\n" \
- "M: sendrecv\r" \
+ "M: sendrecv\r\n" \
"C: 2\r\n" \
"I: %s\r\n" \
"L: a:AMR, nt:IN\r\n" \
- "\n" \
+ "\r\n" \
"v=0\r\n" \
"o=- %s 23 IN IP4 5.6.7.8\r\n" \
"c=IN IP4 5.6.7.8\r\n" \
@@ -234,11 +234,11 @@
/* Test different upper/lower case in options */
#define MDCX4_PT4 \
"MDCX 18983221 1@mgw MGCP 1.0\r\n" \
- "m: sendrecv\r" \
+ "m: sendrecv\r\n" \
"c: 2\r\n" \
"i: %s\r\n" \
"l: A:amr, NT:IN\r\n" \
- "\n" \
+ "\r\n" \
"v=0\r\n" \
"o=- %s 23 IN IP4 5.6.7.8\r\n" \
"c=IN IP4 5.6.7.8\r\n" \
@@ -249,11 +249,11 @@
#define MDCX4_SO \
"MDCX 18983222 1@mgw MGCP 1.0\r\n" \
- "M: sendonly\r" \
+ "M: sendonly\r\n" \
"C: 2\r\n" \
"I: %s\r\n" \
"L: p:20, a:AMR, nt:IN\r\n" \
- "\n" \
+ "\r\n" \
"v=0\r\n" \
"o=- %s 23 IN IP4 5.6.7.8\r\n" \
"c=IN IP4 5.6.7.8\r\n" \
@@ -264,7 +264,7 @@
#define MDCX4_RO \
"MDCX 18983223 1@mgw MGCP 1.0\r\n" \
- "M: recvonly\r" \
+ "M: recvonly\r\n" \
"C: 2\r\n" \
"I: %s\r\n" \
"L: p:20, a:AMR, nt:IN\r\n"
@@ -338,14 +338,14 @@
"a=ptime:40\r\n"
#define CRCX_ZYN \
- "CRCX 2 1@mgw MGCP 1.0\r" \
- "M: recvonly\r" \
+ "CRCX 2 1@mgw MGCP 1.0\r\n" \
+ "M: recvonly\r\n" \
"C: 2\r\n" \
- "\n" \
- "v=0\r" \
- "c=IN IP4 123.12.12.123\r" \
- "m=audio 5904 RTP/AVP 97\r" \
- "a=rtpmap:97 GSM-EFR/8000\r"
+ "\r\n" \
+ "v=0\r\n" \
+ "c=IN IP4 123.12.12.123\r\n" \
+ "m=audio 5904 RTP/AVP 97\r\n" \
+ "a=rtpmap:97 GSM-EFR/8000\r\n"
#define CRCX_ZYN_RET \
"200 2 OK\r\n" \
diff --git a/tests/mgcp/mgcp_test.ok b/tests/mgcp/mgcp_test.ok
index a81d9dd..6dfb608 100644
--- a/tests/mgcp/mgcp_test.ok
+++ b/tests/mgcp/mgcp_test.ok
Binary files differ
--
To view, visit
https://gerrit.osmocom.org/c/osmo-mgw/+/37278?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I6d530535a3a5f1d1a0716ab9e4a8079ba1de242e
Gerrit-Change-Number: 37278
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged