Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package osmo-e1d for openSUSE:Factory 
checked in at 2022-04-02 18:20:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/osmo-e1d (Old)
 and      /work/SRC/openSUSE:Factory/.osmo-e1d.new.1900 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "osmo-e1d"

Sat Apr  2 18:20:56 2022 rev:5 rq:966547 version:0.3.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/osmo-e1d/osmo-e1d.changes        2021-11-20 
02:40:51.684439378 +0100
+++ /work/SRC/openSUSE:Factory/.osmo-e1d.new.1900/osmo-e1d.changes      
2022-04-02 18:21:14.693800726 +0200
@@ -1,0 +2,8 @@
+Sat Apr  2 14:45:10 UTC 2022 - Jan Engelhardt <jeng...@inai.de>
+
+- Update to release 0.3.0
+  * e1d: Add watchdog timer to detect dead lines / USB devices
+  * e1d-ts-pipe: Don't write more HDLC bytes than e1d supports
+  * e1d: reliably detect EOF (HDLC-FCS & RAW mode)
+
+-------------------------------------------------------------------

Old:
----
  0.2.2.tar.gz

New:
----
  0.3.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ osmo-e1d.spec ++++++
--- /var/tmp/diff_new_pack.VZEPZ7/_old  2022-04-02 18:21:15.185795203 +0200
+++ /var/tmp/diff_new_pack.VZEPZ7/_new  2022-04-02 18:21:15.189795158 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package osmo-e1d
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 # Copyright (c) 2019-2021, Martin Hauke <mar...@gmx.de>
 #
 # All modifications and additions to the file contributed by third parties
@@ -18,7 +18,7 @@
 
 
 Name:           osmo-e1d
-Version:        0.2.2
+Version:        0.3.0
 Release:        0
 Summary:        Osmocom E1 Daemon
 License:        GPL-2.0-or-later
@@ -52,13 +52,15 @@
 %description -n libosmo-e1d1
 Osmocom E1 Daemon Protocol Library.
 
-%package -n libosmo-e1d-devel
+%package devel
 Summary:        Header files for the Osmocom E1 daemon protocol library
 License:        LGPL-3.0-or-later
 Group:          Development/Libraries/C and C++
 Requires:       libosmo-e1d1 = %version
+Provides:       libosmo-e1d-devel = %version-%release
+Obsoletes:      libosmo-e1d-devel < %version-%release
 
-%description -n libosmo-e1d-devel
+%description devel
 This subpackage contains libraries and header files for developing
 applications that want to make use of libosmo-e1d.
 
@@ -111,7 +113,7 @@
 %files -n libosmo-e1d1
 %_libdir/libosmo-e1d.so.1*
 
-%files -n libosmo-e1d-devel
+%files devel
 %_includedir/%name/
 %_libdir/libosmo-e1d.so
 %_libdir/pkgconfig/libosmo-e1d.pc

++++++ 0.2.2.tar.gz -> 0.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-e1d-0.2.2/debian/changelog 
new/osmo-e1d-0.3.0/debian/changelog
--- old/osmo-e1d-0.2.2/debian/changelog 2021-11-16 18:10:15.000000000 +0100
+++ new/osmo-e1d-0.3.0/debian/changelog 2022-01-01 15:42:20.000000000 +0100
@@ -1,3 +1,14 @@
+osmo-e1d (0.3.0) unstable; urgency=medium
+
+  * e1d: reliably detect EOF in _e1_ts_{read,write} (RAW mode)
+  * e1d: reliably detect EOF (HDLC-FCS mode)
+  * Introduce a #define for the maximum HDLC buffer size (264)
+  * e1d-ts-pipe: Don't write more HDLC bytes than e1d supports
+  * e1d: Add watchdog timer to detect dead lines / USB devices
+  * update ice1usb_proto.h to current master
+
+ -- Harald Welte <lafo...@osmocom.org>  Sat, 01 Jan 2022 15:42:20 +0100
+
 osmo-e1d (0.2.2) unstable; urgency=medium
 
   [ Harald Welte ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-e1d-0.2.2/include/osmocom/e1d/proto.h 
new/osmo-e1d-0.3.0/include/osmocom/e1d/proto.h
--- old/osmo-e1d-0.2.2/include/osmocom/e1d/proto.h      2021-11-16 
18:10:15.000000000 +0100
+++ new/osmo-e1d-0.3.0/include/osmocom/e1d/proto.h      2022-01-01 
15:42:20.000000000 +0100
@@ -92,6 +92,7 @@
 #define E1DP_INVALID   0xff
 #define E1DP_DEFAULT_SOCKET "/tmp/osmo-e1d.ctl"
 
+#define E1DP_MAX_SIZE_HDLC     264
 
 struct osmo_e1dp_msg_hdr {
        uint16_t magic;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-e1d-0.2.2/src/e1d-ts-pipe.c 
new/osmo-e1d-0.3.0/src/e1d-ts-pipe.c
--- old/osmo-e1d-0.2.2/src/e1d-ts-pipe.c        2021-11-16 18:10:15.000000000 
+0100
+++ new/osmo-e1d-0.3.0/src/e1d-ts-pipe.c        2022-01-01 15:42:20.000000000 
+0100
@@ -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);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-e1d-0.2.2/src/e1d.h new/osmo-e1d-0.3.0/src/e1d.h
--- old/osmo-e1d-0.2.2/src/e1d.h        2021-11-16 18:10:15.000000000 +0100
+++ new/osmo-e1d-0.3.0/src/e1d.h        2022-01-01 15:42:20.000000000 +0100
@@ -30,6 +30,8 @@
 #include <osmocom/core/timer.h>
 #include <osmocom/vty/command.h>
 
+#include <osmocom/e1d/proto.h>
+
 enum e1d_vty_node {
        E1D_NODE = _LAST_OSMOVTY_NODE + 1,
        LINE_NODE
@@ -66,8 +68,8 @@
                struct osmo_isdnhdlc_vars tx;
                struct osmo_isdnhdlc_vars rx;
 
-               uint8_t rx_buf[264];
-               uint8_t tx_buf[264];
+               uint8_t rx_buf[E1DP_MAX_SIZE_HDLC];
+               uint8_t tx_buf[E1DP_MAX_SIZE_HDLC];
                int tx_ofs;
                int tx_len;
        } hdlc;
@@ -121,6 +123,12 @@
                struct osmo_timer_list timer;
        } ts0;
 
+       /* watchdog timer to catch situations where no more USB data is 
received */
+       struct {
+               struct osmo_timer_list timer;
+               uint32_t rx_bytes;
+       } watchdog;
+
        void *e1gen_priv;
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-e1d-0.2.2/src/ice1usb_proto.h 
new/osmo-e1d-0.3.0/src/ice1usb_proto.h
--- old/osmo-e1d-0.2.2/src/ice1usb_proto.h      2021-11-16 18:10:15.000000000 
+0100
+++ new/osmo-e1d-0.3.0/src/ice1usb_proto.h      2022-01-01 15:42:20.000000000 
+0100
@@ -1,7 +1,14 @@
-#pragma once
+/*
+ * ice1usb_proto.h
+ *
+ * Copyright (C) 2020  Harald Welte <lafo...@osmocom.org>
+ * SPDX-License-Identifier: MIT
+ *
+ * Header file describing the USB protocol between the icE1usb firmware and 
the host
+ * software (currently really only osmo-e1d)
+ */
 
-/* Header file describing the USB protocol between the icE1usb firmware and 
the host
- * software (currently really only osmo-e1d) */
+#pragma once
 
 /***********************************************************************
  * Control Endpoint / Device Requests
@@ -75,12 +82,12 @@
  ***********************************************************************/
 
 enum ice1usb_irq_type {
-       ICE1USB_IRQQ_T_ERRCNT           = 1,
+       ICE1USB_IRQ_T_ERRCNT            = 1,
 };
 
 /* Ensue ro keep those in sync with e1.h */
 #define ICE1USB_ERR_F_ALIGN_ERR        0x01
-#define ICE1USB_ERR_F_TICK_ERR 0x02
+#define ICE1USB_ERR_F_LOS      0x02
 
 struct ice1usb_irq_err {
        /* 16-bit little-endian counters */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-e1d-0.2.2/src/intf_line.c 
new/osmo-e1d-0.3.0/src/intf_line.c
--- old/osmo-e1d-0.2.2/src/intf_line.c  2021-11-16 18:10:15.000000000 +0100
+++ new/osmo-e1d-0.3.0/src/intf_line.c  2022-01-01 15:42:20.000000000 +0100
@@ -35,6 +35,7 @@
 #include <osmocom/core/utils.h>
 #include <osmocom/core/stats.h>
 #include <osmocom/core/rate_ctr.h>
+#include <osmocom/core/timer.h>
 #include <osmocom/e1d/proto.h>
 
 #include "e1d.h"
@@ -64,6 +65,20 @@
        .ctr_desc = line_ctr_description,
 };
 
+/* watchdog timer, called once per second to check if we still receive data on 
the line */
+static void line_watchdog_cb(void *data)
+{
+       struct e1_line *line = data;
+
+       if (line->watchdog.rx_bytes < 240000) {
+               LOGPLI(line, DE1D, LOGL_ERROR, "Received Only %u bytes/s 
(expected: 262144): Line dead?\n",
+                       line->watchdog.rx_bytes);
+       }
+
+       line->watchdog.rx_bytes = 0;
+       osmo_timer_schedule(&line->watchdog.timer, 1, 0);
+}
+
 // ---------------------------------------------------------------------------
 // e1d structures
 // ---------------------------------------------------------------------------
@@ -196,6 +211,10 @@
 
        llist_add_tail(&line->list, &intf->lines);
 
+       /* start watchdog timer */
+       osmo_timer_setup(&line->watchdog.timer, line_watchdog_cb, line);
+       osmo_timer_schedule(&line->watchdog.timer, 1, 0);
+
        LOGPLI(line, DE1D, LOGL_NOTICE, "Created\n");
 
        return line;
@@ -206,6 +225,8 @@
 {
        LOGPLI(line, DE1D, LOGL_NOTICE, "Destroying\n");
 
+       osmo_timer_del(&line->watchdog.timer);
+
        /* close all [peer] file descriptors */
        for (int i=0; i<32; i++)
                e1_ts_stop(&line->ts[i]);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-e1d-0.2.2/src/mux_demux.c 
new/osmo-e1d-0.3.0/src/mux_demux.c
--- old/osmo-e1d-0.2.2/src/mux_demux.c  2021-11-16 18:10:15.000000000 +0100
+++ new/osmo-e1d-0.3.0/src/mux_demux.c  2022-01-01 15:42:20.000000000 +0100
@@ -62,7 +62,7 @@
                        LOGPTS(ts, DXFR, LOGL_DEBUG, "RX Message: %d [ %s]\n",
                                rv, osmo_hexdump(ts->hdlc.rx_buf, rv));
                        rv = write(ts->fd, ts->hdlc.rx_buf, bytes_to_write);
-                       if (rv < 0)
+                       if (rv <= 0)
                                return rv;
                } else  if (rv < 0 && ts->id == 4) {
                        LOGPTS(ts, DXFR, LOGL_ERROR, "ERR RX: %d %d %d [ %s]\n",
@@ -97,7 +97,7 @@
                                        rv, osmo_hexdump(ts->hdlc.tx_buf, rv));
                                ts->hdlc.tx_len = rv;
                                ts->hdlc.tx_ofs = 0;
-                       } else if (rv < 0 && errno != EAGAIN)
+                       } else if ((rv < 0 && errno != EAGAIN) || rv == 0)
                                return rv;
                }
 
@@ -147,7 +147,7 @@
                break;
        }
 
-       if (l < 0 && errno != EAGAIN) {
+       if ((l < 0 && errno != EAGAIN) || l == 0) {
                LOGPTS(ts, DE1D, LOGL_ERROR, "dead socket during read: %s\n",
                        strerror(errno));
                e1_ts_stop(ts);
@@ -293,7 +293,7 @@
                break;
        }
 
-       if (rv < 0 && errno != EAGAIN) {
+       if ((rv < 0 && errno != EAGAIN) || rv == 0) {
                LOGPTS(ts, DE1D, LOGL_ERROR, "dead socket during write: %s\n",
                        strerror(errno));
                e1_ts_stop(ts);
@@ -391,6 +391,8 @@
                return -1;
        }
 
+       line->watchdog.rx_bytes += size;
+
        ftr = size / 32;
        OSMO_ASSERT(size % 32 == 0);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-e1d-0.2.2/src/usb.c new/osmo-e1d-0.3.0/src/usb.c
--- old/osmo-e1d-0.2.2/src/usb.c        2021-11-16 18:10:15.000000000 +0100
+++ new/osmo-e1d-0.3.0/src/usb.c        2022-01-01 15:42:20.000000000 +0100
@@ -330,10 +330,10 @@
                        errcnt->flags & ICE1USB_ERR_F_ALIGN_ERR ? "LOST" : 
"REGAINED");
        }
 
-       if ((errcnt->flags & ICE1USB_ERR_F_TICK_ERR) != (last->flags & 
ICE1USB_ERR_F_TICK_ERR)) {
+       if ((errcnt->flags & ICE1USB_ERR_F_LOS) != (last->flags & 
ICE1USB_ERR_F_LOS)) {
                LOGPLI(line, DE1D, LOGL_ERROR, "Rx Clock %s\n",
-                       errcnt->flags & ICE1USB_ERR_F_TICK_ERR ? "LOST" : 
"REGAINED");
-               if (errcnt->flags & ICE1USB_ERR_F_TICK_ERR)
+                       errcnt->flags & ICE1USB_ERR_F_LOS ? "LOST" : 
"REGAINED");
+               if (errcnt->flags & ICE1USB_ERR_F_LOS)
                        line_ctr_add(line, LINE_CTR_LOS, 1);
        }
 
@@ -351,7 +351,7 @@
        }
 
        switch (irq->type) {
-       case ICE1USB_IRQQ_T_ERRCNT:
+       case ICE1USB_IRQ_T_ERRCNT:
                if (xfer->actual_length < sizeof(*irq)) {
                        LOGPLI(line, DE1D, LOGL_ERROR, "Short ERRCNT interrupt: 
%u<%zu\n",
                                xfer->actual_length, sizeof(*irq));

Reply via email to