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.orglaforge has submitted this change. ( 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
M src/intf_line.c
2 files changed, 15 insertions(+), 7 deletions(-)
Approvals:
Jenkins Builder: Verified
tnt: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/src/ctl.c b/src/ctl.c
index ee5066f..482366f 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(e1_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;
diff --git a/src/intf_line.c b/src/intf_line.c
index fe9edbb..5994805 100644
--- a/src/intf_line.c
+++ b/src/intf_line.c
@@ -251,12 +251,7 @@
switch (ts->mode) {
case E1_TS_MODE_RAW:
- l = recv(ts->fd, buf_ts, fts, MSG_TRUNC);
- if (l > fts) {
- LOGPTS(ts, DXFR, LOGL_ERROR, "Truncated message: Client tried to "
- "send %d bytes but our buffer is limited to %d\n", l, fts);
- l = fts;
- }
+ l = read(ts->fd, buf_ts, fts);
break;
case E1_TS_MODE_HDLCFCS:
l = _e1_tx_hdlcfs(ts, buf_ts, fts);
--
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: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200712/2db30344/attachment.htm>