Change in osmo-e1d[master]: Use SOCK_STREAM sockets for E1_TS_MODE_RAW

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

laforge gerrit-no-reply at lists.osmocom.org
Sat Jul 11 08:51:47 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/19220 )


Change subject: Use SOCK_STREAM sockets for E1_TS_MODE_RAW
......................................................................

Use SOCK_STREAM sockets for E1_TS_MODE_RAW

SEQPACKET is great for preserving message boundaries on signaling
channels that use HDLC.  However, its semantics, particularly regarding
truncation, are sub-optimal for RAW slots containing raw user
bitstreams (typically TRAU frames or PCM audio data).

So let's use SOCK_STREAM for RAW and keep SEQPACKET for HDLCFCS.

Closes: OS#4663
Change-Id: I1767ceaa5d2a008db0009b8027667a71c0fdc0f1
---
M src/ctl.c
1 file changed, 14 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/20/19220/1

diff --git a/src/ctl.c b/src/ctl.c
index 163024a..aff6ce2 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -25,6 +25,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
@@ -110,10 +111,22 @@
 _e1d_ts_start(struct e1_ts *ts, enum e1_ts_mode mode)
 {
 	int ret, sd[2];
+	int sock_type;
 
 	LOGPTS(ts, DE1D, LOGL_INFO, "Starting in mode %s\n", get_value_string(osmo_e1dp_ts_mode_names, mode));
 
-	ret = socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sd);
+	switch (mode) {
+	case E1_TS_MODE_HDLCFCS:
+		sock_type = SOCK_SEQPACKET;
+		break;
+	case E1_TS_MODE_RAW:
+		sock_type = SOCK_STREAM;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	ret = socketpair(AF_UNIX, sock_type, 0, sd);
 	if (ret < 0)
 		return ret;
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/19220
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I1767ceaa5d2a008db0009b8027667a71c0fdc0f1
Gerrit-Change-Number: 19220
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200711/54c4ce13/attachment.htm>


More information about the gerrit-log mailing list