The warning period encoding was wrong, resulting in way too short
warning periods being encoded than intended/specified by the caller.
Change-Id: Idf3cae48a6ab45550d7bbd937bb49a0e1a4e8aed
Even though the value is only between 0..120s, they didn't encode
it 1:1 in the uint8_t, but 3GPP chose to use the same encoding
as for the warning period (which has a much larger range).
Let's fix this in our implementation.
Before this patch, osmo-cbc wanted to send 30s keep-alive repetition
period, but a spec-compliant receiver actually decoded this as 80s.
Change-Id: I04baa6b6b99b092fa0512b3b6138a363c7f3a13d
We currently only have probes for the logging sub-system.
This patch adds two tracepoints for tracing the performance
impact of statistics reporting: stat_start and stat_done.
They can be used to trace the amount of time a libosmocore-using
application spends in reporting/exporting statistics. This includes
both the CPU time for encoding the statistics, as well as the system
calls for sending them.
Change-Id: I7208c45f6d051505dd2435305c67b4d26c0b1dd2
Related: OS#4311
Related: SYS#4877
If the SNS fsm isn't freed early, the SNS code will re-create a NSVC
when calling free_nsvc().
Fixes libasan heap-use-after-free.
Change-Id: If350df1d8d6dcea5715dd23b8bd1d684098cdb1f
A NS Status can contain the original NS message which might result
in a NS PDU which exceeds the MTU of the NS-VC.
Truncate the original message to the maximum possible.
Based on truncate BSSGP status message.
Related: OS#4889
Change-Id: I35d8f8bf0eae890f4db56423da0b23b638d24311
When the MTU of the frame relay device changes, update the bind
and notify all NSEs.
Related: OS#4889
Change-Id: I946f7655c9526ffd98dabdce219c6a419b71e00c
An event which originates by a received PDU is prefixed by RX.
An event which originates by code gets a REQ prefix.
Fixes: OS#5014
Change-Id: Ia8a6378cdca19b086e89058b1cc055f45c0bba7b
Implement the load sharing based on modulo of the LSP. As long the gprs_ns2 doesn't
support the resource distribution function (48.016 § 4.4a) this simple
approach is good enought.
Fixes: OS#4836
Change-Id: I8c2fe5d647694886ac600470fca6ea5d5d210a85
Introduce a `ip-sns-bind BINDID` vty command within a `nse` vty object.
The ip-sns-bind defines the binds which will be used by the dynamic
configuration with IP-SNS.
This is only the first part which only uses the binds when doing a
new SNS configuration.
The outgoing add procedure will be supported in a later patch
when the SNS fsm supports outgoing procedures.
This is a behaviour change of the API and must be synchronized with
the osmo-pcu. Otherwise SNS won't work with osmo-pcu.
Related: SYS#5354
Change-Id: I9ab8092bf286e7d90e92f5702a5404425e959c84
This allows differentiating threads withing an application, while still
keeping same numbering for single-threaded application (since first
thread ID is always the same as the process group ID).
Related: OS#5027
Change-Id: I33da02524fc064e133b2b762af7060139c4cfd81
Recent commit filling this field forgot to convert it to network byte
order.
Related: OS#5027
Fixes: bb149ecda2
Change-Id: I50857f35cb28138fa6f28100afeaa00f492f303a
This API wraps conventional gettid() linux-specific API, which even in
Linux itself is sometimes not properly supported/announced.
This API also allows future porting to other platforms if needed, and so
far falls back to getpid() if no gettid(9 can be found.
Code ported from osmo-trx.git, see commit 7a07de1efd4eb7cc11c33d3ad25cb2df70aa1ef1.
Related: OS#5027
Change-Id: Id7534beeb22fcd50813dab76dd68818e2ff87ec2
It was recently discovered that PID field in gsmtap log messages was
always set to 0. Before this patch, the field was never being set.
The approach of this patch is to record the PID of process one, in
order to avoid calling getpid() syscall on each
log line to be sent. The counterpart of this optimization is that
eventual fork() calls would still keep the old incorrect value, but I
think nobody can safely assume that fork() is possible once all this
kind of infrastructure has already been configured (fork() should only
be done really at the start of the program before any osmocom foo is
initialized, or to immediatelly call exec()).
Related: OS#5027
Change-Id: I7db00d1810f0860166bffa0bda8566caa82e06a9
The BSSGP layer needs to know the MTU of the NS UNIDATA payload.
The MTU can be 0 if the NSE doesn't contain any NSVC.
Every status indication will contain the mtu value.
The MTU in the status indication contains the maximum transfer
unit of a BSSGP message. From NS side the maximum SDU.
Related: OS#4889
Change-Id: I5016b295db6185ec131d83089cf6c806e34ef1b6
CGI-PS type doesn't exist in GSM 08.08 Cell Id lists. That type of cell
id is osmocom-specific and used internally. In here CGI-PS is
automatically converted to CGI (since the later is an extension of this
one).
The encode/decode_cell_id_u are left intact (comment added) since those
can still be used (and are used by RIM code) to encode/decode TS 48.018
Cell Identifiers.
Related: SYS#4909
Change-Id: Id74f4577c397c1ba696f00395858311bd82cb2c8
It's a static internal function, so it makes sense to have it at start
of its related section.
It will be used by other functions in follow up patches.
Change-Id: I60f61f8f7bb6543feb068bdcee76d3b752565c95
If the BSS (or SGSN) has sent a BVC-RESET PDU for a BVCI to the SGSN (or
BSS) and is awaiting a BVC-RESET- ACK PDU in response, but instead
receives a BVC-RESET PDU indicating the same BVCI, then this shall be
interpreted as a BVC-RESET ACK PDU and the T2 timer shall be stopped.
Related: OS#4974
Change-Id: I4d15733f9f205cb563b66ef9e41dc8df50151900
The log line sneaked in when fixing the alive ms
Fixes: ab0e8646c4 ("gprs_ns2_vc_fsm: use CLOCK_MONOTONIC for alive elapsed timer")
Change-Id: Iffe367b240f47c39232bbc26991c19752a1c75ad
bssgp_bvc_get_features_* are fsm "methods" and the name should indicate
that just lika all other function names in bssgp_bvc_fsm.h
Change-Id: I30fbbe36cdabf9635eaf4dfb1e93c8ce0f667b39
Add functions to get/set the maximum supported BSSGP PDU size by the NS
layer.
IPv4 and IPv6 should not matter since we can just enable IP
fragmentation and send NS PDUs up to 2**16 + bytes. Frame relay does not
support fragmentation and this is the reason we need to be aware of the
maximum PDU size. Luckily with 1600 bytes the MTU in frame relay can hold a
regular IP packet including NS/BSSGP overhead.
On the NS layer this corresponds to the size of an NS SDU in NS-UNITDATA
(3GPP TS 48.016 Ch. 9.2.10)
Change-Id: I9bb82ead27366b7370c9ff968e03ca2113ec11f0
Related: OS#4889
It seems like we still don't have NS2 VTY tests running in libosmocore
so this only got caught once osmo-sgsn/osmo-gbproxy builds failed.
Change-Id: Id3cd407b05457a4703ee38c4b1b1b65800bbd30e
Related: OS#4887
The alive elapsed timeout was only set once on the start of the
test procedure but not every time an ALIVE PDU was sent.
Fixes: OS#4997
Change-Id: I029696dfff21919f97ac4c33cdd82162b5ab1555
gettimeofday can jump and the comment says it should not be used for elapsed timer.
Related: OS#4997
Change-Id: I41989d8f9f82f4d1f7b97f11577653699365c8ae
Allow to assign a signalling and data weight to UDP binds.
Those weights will be used when doing dynamic configuration over
IP-SNS.
This is only the first part which only uses the assigned weights
when doing a new SNS configuration.
The outgoing change weight procedure will be supported in a later patch
when the SNS fsm supports outgoing procedures.
Related: SYS#5354
Change-Id: I5133e4229377d44772a9af28628a2bc420fea34b
<0026> gprs_ns2_fr.c:515 BIND(hdlcnet1) Can not create AF_PACKET socket. Are you root or have CAP_NET_RAW?
=================================================================
==3872359==ERROR: AddressSanitizer: heap-use-after-free on address 0x6130000030c0 at pc 0x7fef120aa92e bp 0x7ffebf6b5c20 sp 0x7ffebf6b5c18
READ of size 8 at 0x6130000030c0 thread T0
#0 0x7fef120aa92d in osmo_fr_link_free (/usr/local/lib/libosmogb.so.11+0x16992d)
#1 0x7fef1205105a in free_bind (/usr/local/lib/libosmogb.so.11+0x11005a)
Change-Id: I23c0f1697edd5734085fa18b0a2f253c0f206c53
The followign happens if osmo-gbproxy is started without CAP_NET_RAW:
<0026> gprs_ns2_fr.c:515 BIND(hdlcnet1) Can not create AF_PACKET socket. Are you root or have CAP_NET_RAW?
gprs_ns2_fr.c:176:2: runtime error: member access within null pointer of type 'struct msgb' AddressSanitizer:DEADLYSIGNAL
the second line is free_bind() iterating overr the backlog while
destroying the not-yet-fully-initialized bind.
Let's make sure the backlog llist_head is always initialized properly.
Change-Id: I4d2fa50955c5897cd469fee68d4ddc65a9f5688f
Move it above the place where the bit is set, since the bit represents
whether Extension Information is available, not whether R99 is
available.
Change-Id: Ice592acc50a24efd7fe4cf1a91f1d48fd74f38d8
In prepration to introduce more commands e.g. ip-sns-bind rename the ip-sns-remote
Related: SYS#5354
Change-Id: Ida979f3b9daa5f7280a629441e4006a7635653b0
The SNS must know when all NS-VC have failed. Further more
there might be a corner case when the SNS configuration succeeds but
no NS-VC comes up afterwards.
Related: OS#5355
Change-Id: Ie72da9adeefe0c2850d49a9208b2d0a4556f9101
When writing to the AF_PACKET socket, we have to distinguish the
pseudo-errors like -ENOBUFS (where we do want to add to the backlog)
from real errors like -ENETDOWN, -EMSGSIZE, ... where we don't want
to add the failed packet to the backlog.
Change-Id: Ibbb6805da0f118466c4c91e458e62b63b84cb794
This patch improves the behavior of the newly-added backlog in
situations where the interface goes up/down.
* don't add new packets to the backlog while if_running == false
* flush the backlog on both ifup and ifdown events
Change-Id: Ib35d099526544fe2cff64566fd56147a906adab9
There's not really any point in storing multiple LMI messages,
and then transmitting them in inverse order, as the existing code
does. Instead, we shall store only the last (failed) LMI message
and try to transmit that at highest priority, before any NS messages
in the actual queue.
Change-Id: I5407a76a34d7e687966fe1a915febf3a87256593
Reading a log line like this:
<0026> gprs_ns2_vc_fsm.c:808 GPRS-NS2-VC(FR-hdlcnet1-DLCI16-NSE02001-NSVC00001)[0x6120000024a0]{UNBLOCKED}: Received Event RESET
is very ambiguous. Does it mean we received a NS-RESET message? Does it
mean the FSM was instructed to send a NS-RESET? ...
Let's make sure the human-readable names give a very clear indication
of what exactly is happening.
Change-Id: I8b7615b3eca04212831163ff0ea4aea35069cd0e