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/+/26703 ) Change subject: e1d-ts-pipe: Don't write more HDLC bytes than e1d supports ...................................................................... e1d-ts-pipe: Don't write more HDLC bytes than e1d supports This avoids truncation and the following error message when operating in HDLC-FCS mode: <0001> mux_demux.c:91 (I0:L0:T16) Truncated message: Client tried to send 320 bytes but our buffer is limited to 264 Change-Id: I836d8b98ce5b831b0498c4650263ec3b3d4f2c45 --- M src/e1d-ts-pipe.c 1 file changed, 8 insertions(+), 4 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/e1d-ts-pipe.c b/src/e1d-ts-pipe.c index bae45de..2928e85 100644 --- a/src/e1d-ts-pipe.c +++ b/src/e1d-ts-pipe.c @@ -39,6 +39,7 @@ static void *g_ctx; static struct osmo_e1dp_client *g_client; static struct osmo_fd ts_ofd; +static enum osmo_e1dp_ts_mode g_mode = E1DP_TSMODE_RAW; static int outfd = 1; static int infd = 0; @@ -70,7 +71,11 @@ } if (what & OSMO_FD_WRITE) { - rc = read(infd, buf, sizeof(buf)); + unsigned int read_len = sizeof(buf); + if (g_mode == E1DP_TSMODE_HDLCFCS) + read_len = E1DP_MAX_SIZE_HDLC; + + rc = read(infd, buf, read_len); if (rc < 0 && errno != EAGAIN) exit(4); else if (rc == 0) { /* EOF */ @@ -120,7 +125,6 @@ int main(int argc, char **argv) { int intf_nr = -1, line_nr = -1, ts_nr = -1; - enum osmo_e1dp_ts_mode mode = E1DP_TSMODE_RAW; char *path = E1DP_DEFAULT_SOCKET; int bufsize = 160; int tsfd; @@ -172,7 +176,7 @@ fprintf(stderr, "Unknown mode '%s'\n", optarg); exit(2); } - mode = rc; + g_mode = rc; break; case 'r': rc = open(optarg, 0, O_RDONLY); @@ -199,7 +203,7 @@ exit(1); } - tsfd = ts_open(intf_nr, line_nr, ts_nr, mode, bufsize); + tsfd = ts_open(intf_nr, line_nr, ts_nr, g_mode, bufsize); if (tsfd < 0) exit(2); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/26703 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I836d8b98ce5b831b0498c4650263ec3b3d4f2c45 Gerrit-Change-Number: 26703 Gerrit-PatchSet: 1 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/20220101/f61ee784/attachment.htm>