Allow to configure a timeslot as type E1INP_TS_TYPE_NONE. The timeslot
is then put back in its unconfigured state
Change-Id: I073cfaba0d5073447842f22665e213135ea3f635
Related: OS#5198
* VTY command e1_line N connect-timeout T to set the connect() timeout
* use ipa_client_conn_open2 to connect with timeout
Related: SYS#6237
Change-Id: I7379102d19c172bed2aa00377d92bc885f54b640
Set the keepalive parameters to E1INP_USE_DEFAULT initially instead
of 0. Do this independent of the driver (the only driver making use of
this is ipaccess).
Closes: OS#5785
Change-Id: Ia7659c209aea0d26eb37d31e771adc91b17ae668
Since a recent commit (see hash below), e1_input.c code was fixed to
release the line from the global line list (e1inp_line_list) before
freeing the object. However, the change didn't have into account that
there were cloned lines from the original one which had a duplicate of
the original line->list. Hence, whenver a clone was freed, it actually
removed the original line from the global list.
Since the original line is the one actually holding the permanent
reference due to being configured over VTY, let's fix e1inp_line_clone
to reset the clone->list so that whenever it is freed it doesn't affect
the original line.
Fixes: 49924f0a79
Related: SYS#5642
Change-Id: I0627da0d28057649b494e2bd83b283b09fb9a2d7
Specially important regarding the pre-allocated reference count.
This was done when moving the API to use osmo_use_count internally,
because previous code already came with refcount=1.
Change-Id: I819a13732c5d0ff150bc11d1cfd64e96ee81bad2
This was not an observable issue so far because both osmo-bts and
osmo-bsc used to keep the same line created once, keeping at least 1
reference count to it.
Change-Id: I1314d6b917ecb622994507475eb894e649a1a2ad
In order to allow configuration of pcap files per e1_line
the vty command is now (for example line 0):
e1_line 0 pcap /tmp/e1cap.pcap
in place of:
pcap /tmp/e1cap.pcap
Also ensures that a configured pcap appears in 'show running-config'
and is written to the config file on issuing 'write'
This commit deprecates e1_set_pcap_fd()
Change-Id: I316c3d6a839e84c2f52a148c6b8dd6f5933cf4bf
Unlike the legacy TRAU mode, this only adds I460 mux/demux,
without any TRAU frame synchronization. The user must still be
adding the actual sub-channels using osmo_i460_subchan_add()
depending on his requirements.
Change-Id: I44da6dfec77ef475adb35001a0e4fa11d549aa02
Drop the function e1inp_close_socket since it's only used by the caller
at hand, and it's only exported through "internal.h", so no app is using
it. Remove it because there's only a caller, and furthermore because
keeping it (and putting bfd->data==line) would introduce a layer
violation because the bfd->data==line is only used for ipaccess so far.
Triggering path:
handle_ts1_read ret=0 "Sign link vanished"
ipaccess_drop
line->ops->sign_link_down
(osmo-bsc) ipaccess_drop_oml
e1inp_sign_link_destroy
link->ts->line->driver->close
ipaccess_close
Related: OS#4624
Change-Id: If23cc722106a9f70c998e591369a4acafa52c519
osmo_use_count is available since libosmocore 1.1.0 release, so bump
required libosmocore version in autotools and packages.
struct e1inp_line field refcnt is kept in order to keep ABI
compatibility accessing struct fields. The new use_count is added at the
end. Size of struct changing is fine since it is allocated through
an API and a pointer should be used by clients.
e1inp_line_clone API is changed but it's not used by anyone outside
libosmo-abis, so it's fine.
Related: OS#4624
Change-Id: I0658b2e9c452598025cc0f1d0b060076171767cc
Increase reference count when a new sign_link using the line is created.
Otherwise the line is freed too quickly during e1inp_sign_link_destroy()
with several TRX being used, since each RSL link is missing a reference.
That extra refcoutny in update() is not really needed given that we already
have a link assigned on the line when we call update.
Fixes: OS#3612
Fixes: OS#4094
Change-Id: I74405b0e87a89c17d58e87024f4aedbd30832013
Historically, OpenBSC has primarily been used with setups that have
a single E1 based BTS connected. This meant that an error message on
the E1 LAPD implicitly has to be related to that single BTS.
However, in more comprehensive setups, there may be many BTSs on many
E1 lines with many signaling slots. At this point, it's important to
know which line/timeslot/tei/sapi a given log message relates to.
This patch introduces related log context.
Change-Id: Ib81a749ae24013b17caaf5fd64ccd9acbbc3ce08
Requires: libosmocore.git Change-Id Ie6742843fff809edffcac24c4dce4edf66bc71be
Related: OS#1938
This will update the pcap fd in all open lines and close
the previous one (if applicable).
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I5c7dd740ba0a90b40c69a53b3dcc9d6d6a98f660
osmo-e1d is part of the Osmocom 'software defined E1 interface,
which consists of a USB device for the actual E1 hardware interfacing,
and a daemon (osmo-e1d) implementing a libusb-based driver.
This commit adds initial support for talking to osmo-e1d using
the related libosmoe1d library. You need to use '--enable-e1d'
at configure time to enable it.
Change-Id: Ia0431c124e3b5b4108aee7b109d8c4bb0d8b45d4
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
The '.' is illegal character in counter names, as they are exported
via CTRL interface, where '.' has a special meaning that cannot be
used by strings comprising the variable name.
Change-Id: I730d1acdd5562cd2c1758ceee31193010b14337d
Ensure that pointers in cloned e1inp_lines point to valid memory.
Some members of struct e1inp_line can simply be deep-copied.
Use talloc reference counting for pointers to objects which may
be shared between clones (driver-private state and counters).
Prevents double-free bugs, e.g. when multiple links referring
to the same line are closed.
Also, do not forget to unlink struct e1inp_line's counter group from
the counter list. Fixes use-after-free in rate_ctr_timer_cb() during
osmo-bts shutdown.
Change-Id: I9f4724b4a5a064801591e9acf4f2fd1db006d082
Related: OS#3011
Related: OS#3137
In case the counter group allocation fails, we must handle this
gracefully and fail the allocation of the parent object, too.
Change-Id: Iff8506832d3472ab193b19b43cfbe7a9511075d1
Related: OS#2361
alpine linux is using the musl libc and this triggered some minor
compilation issues. Remove unused mISDN include and defines from
the general E1 input handling and address the other warnings and
errors.
/usr/include/sys/fcntl.h:1:2: warning: #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> [-Wcpp]
#warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>
^~~~~~~
In file included from input/misdn.c:48:0:
../include/mISDNif.h:286:2: error: unknown type name 'u_int'
u_int id;
^~~~~
Change-Id: I997e45a456faedb5f370fd02ded300c1e36b791b
This is useful for protocols that use HDLC framing for signalling on E1
timeslots, but which don't use LAPD inside (our E1INP_TS_TYPE_SIGN).
Examples are particularly a MTP2/MTP3 SS7 stack, like it is used on the
A interfaces or on the core network interfaces of classic
circuit-switched networks.
Change-Id: I2d75801df4d7cbb8dad325f4d6689841f0196fa6
In the past, the A-bis E1 input system only unederstood LAPD signalling
time-slots and trau-slots with 16kBps sub-slots. This adds the notion
of a 'raw' transparent 64kBps slot, without any furthe de-multiplexing
nor any HLDC inside.
Change-Id: I0c25c2688eddd0c55c15b280a8c6e8a49629516b
It is quite useful for the signal receiver to know on which of the many
E1/T1 timeslots a given event (like a 'link down' event) has happened.
The line number, TEI and SAPI are isnuficcient in case there are
multiple signalling TS in the line.
Change-Id: I07f0f79e0cda09766f357032ffb4e7ad643d448a
The e1_input code for PCAP writing uses the Layer3 RSL/OML message and
prepends a fake LAPD header. This means that all frames look like UI
frames in wireshark. In case we use in-kernel LAPD of mISDN, this is
the best we can do. However, in case of software (libosmocore) LAPD,
we can do better, by dumping the real LAPD frames at the interface
between LAPD code and the physical layer.
Related: OS#1763
Change-Id: Id0815690b5bc0a9b7f29f5cfde9d2f24c4f88ee5
In order to make use of the IPAC_PROTO_OSMO stream_id of the IPA
multiplex via the e1_input abstraction layer, we need to define
E1INP_SIGN_OSMO and treat it like other signalling (OML/RSL).
This is required for the upcoming code that uses IPAC_PROTO_OSMO
to remotely insert routing table entries into the OML router (e.g. from
osmo-bts).
e1_input.c: In function 'e1inp_tx_ts':
e1_input.c:620:6: warning: variable 'len' set but not used [-Wunused-but-set-variable]
Fix it by performing a stricter checking on the muxed bits
before transmission. Let's see if this spots some hidden bug
in this code.
CC e1_input.lo
e1_input.c: In function 'e1_set_pcap_fd':
e1_input.c:143:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
e1_set_pcap_fd returns now the result of write. OpenBSC is still
assuming that this function returns nothing, so it simply ignores
this return value by now.
Holger reported a leak in the ipaccess_drop path and a patch to
fix this. This is a new version of the patch posted that also
handle the case in which only one of the link (OML / RSL) is
established and no ID_RESP was received.
Based on patch of Holger Freyther.
* HSL/IPA had different socket closing code for the same thing,
create one method for it.
* Both methods tried to send an event but as we are on the close
path the sign_link was already removed from the list and the
input event sending method couldn't find the sign_link using the
sapi/tei provided.
The core functionality of input/lapd.c is removed. Now it uses lapd_core.c
of libosmogsm. The stucture of lapd_instance and SAP (SAPI/TEI handling)
is kept, as well as interfaceing and header transcoding. The former
implementation of datalink is completely replaced, except for the minimal
TEI manager..
Currently it supports 3 modes:
- ABIS (BS11/Ericsson/Nokia)
- ISDN (Not used yet)
- ASAT (A interface for satellite)
all these modes can run as NETWORK or USER.
the "e1_line <0-255> port <0-255>" vty command allows the user to
set which physical port/card number should be represented by the
given virtual e1_line.
Furthermore, we now actually query the DAHDI hardware to determine the
number of ports of a given span (e.g. only 24 in case of T1) instead of
blindly assuming there are 31 timeslots on each port.
This specifically will fix T1 timeslot (/dev/dahdi/%u) calculation in
setups with multiple DAHDI spans/ports and a T1 span != span 1.
With multiple BTS attached to a single line, we have to call
->line_update() multiple times. I broke this myself while avoiding
that A-bis over IP drivers bind to the socket several times.
To fix this situation, Harald prefers that this case is internally
handled by the ipaccess and hsl drivers by means of the driver_data
field in the e1inp_line structure.
Reported-by: Gus Bourg <gus@bourg.net>
struct e1inp_line_ops {
- enum e1inp_line_role role;
- char *addr;
- void *data;
+ union {
+ struct {
+ enum e1inp_line_role role; /* BSC or BTS mode. */
+ const char *addr; /* IP address .*/
+ void *dev; /* device parameters. */
+ } ipa;
+ struct {
+ const char *port; /* e.g. /dev/ttyUSB0 */
+ unsigned int delay;
+ } rs232;
+ } cfg;
Now this structure contains the configuration details for the
virtual E1 line, instead of using a pointer.
This also get the line_update callback to its original layout:
+ int (*line_update)(struct e1inp_line *line);