| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In gprs_ns_process_msg(), we were dispatching the S_NS_UNBLOCK
signal before sending out the NS_POUT_UNBLOCK_ACK message.
Signal handlers might send messages to the other side, assuming
that NS is now unblocked. However, since such messages will arrive
before the UNBLOCK_ACK message the receiver might discard them.
This problem has been observed with our TTCN3 BSSGP_Emulation
as a peer to osmo-pcu.
This patch makes TTCN3 PCU TC_paging() test pass regardless of
whether the test or osmo-pcu is started first. Before this patch,
this test would only pass if the test was started before osmo-pcu.
A remaining problem is that the test does not yet keep passing
reliably unless osmo-pcu is restarted between test runs.
Change-Id: I3af54a14bb6bcfa167c9a9d9f67835e7f5b9f1bb
Related: OS#2890
Related: OS#2388
|
|
|
|
|
|
|
|
| |
Ironically, when deprecating osmo_init_logging() in
I216837780e9405fdaec8059c63d10699c695b360, I forgot to change the callers
within libosmocore itself, i.e. in the various regression tests.
Change-Id: Ia36c248f99353d5baaa2533f46a2f60a8579bdf8
|
|
|
|
|
|
| |
Use bssgp_msgb_tlli_put() instead of copy-pasted code.
Change-Id: I06d60566a19dcae701f8648c19fbd8db6d586f77
|
|
|
|
|
|
| |
Helps fix sanitizer build on debian 9.
Change-Id: I0ef95ee8185a4789f0732b9420243dda5104d181
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
All successful and all error code paths of bssgp_fc_in() free the msgb, except
the code path calling fc_enqueue() when the msg is dropped (due to queue being
full, or failure to allocate).
Callers could theoretically catch the -ENOSPC return value and discard the
msgb. However, in other code paths, a callback's return value is returned,
which is expected to free the msgb, so such callback would have to never return
-ENOSPC when it freed the msgb. Much simpler semantics would be to free the
msgb in every code path, no matter which kind of error occurred.
Who is currently calling bssgp_fc_in and how do they handle the return value?
- bssgp_fc_test.c ignores the return value (and hits a mem leak aka sanitizer
build failure if the queue is full).
- fc_timer_cb() ignores the return value.
- bssgp_tx_dl_ud() returns the bssgp_fc_in() rc.
- which is returned by a cascade of functions leading up to being returned,
for example, by gprs_llgmm_reset(), which is usually called with ignored
return code.
At this point it is already fairly clear that bssgp_fc_in() should always free
the msgb, since the callers don't seem to distinguish even between error or
success, let alone between -ENOSPC or other errors.
bssgp_fc_test: assert that no msgbs remain unfreed after the tests.
Adjust expected results.
Helps fix sanitizer build on debian 9.
Change-Id: I00c62a104baeaad6a85883c380259c469aebf0df
|
|
|
|
|
|
|
|
|
|
|
|
| |
Print remaining msgbs when done, then free the entire tall_msgb_context. To be
able to do that, call msgb_talloc_ctx_init() and use its return value.
A subsequent patch will fix a known mem leak and add assertions for 0b in 1
blocks remaining in the tall_msgb_context.
Helps fix sanitizer build on debian 9.
Change-Id: I67d347ab2642b0bfc27b21b44231a7f3146ff641
|
|
|
|
|
|
|
|
|
|
|
| |
The test fills up the queue / sends too large PDUs on purpose. Make that
obvious by outputting returned errors in the expected output.
Cosmetic:
- fc_in()'s return value is ignored, hence don't return anything.
- add comment.
Change-Id: I57d6fce2515a65f6dd037e75af5397079215cb46
|
|
|
|
|
|
|
|
| |
Ever since this test was changed to use osmo_gettimeofday_override, the times
it sees are exact every time and don't need rounding to pass the expected
output.
Change-Id: I4a9a5d31fc02eb55caf7ba9c141426d8115bb740
|
|
|
|
|
|
|
|
| |
Let's fix some erroneous/accidential references to wrong license,
update copyright information where applicable and introduce a
SPDX-License-Identifier to all files.
Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As rate counters are automatically exposed on the CTRL interface,
we need to make sure they don't contain special characters such as '.'
which are not permitted/supported by CTRL.
In order to be able to run old versions of osmocom programs with
libosmocore versions after this commit, we introduce some special
name mangling: Any '.' in the names are replaced with ':' during
counter group registration, if valid identifiers can be obtained
this way.
Change-Id: Ifc6ac824f5dae9a848bb4a5d067c64a69eb40b56
|
|
|
|
|
|
|
|
|
| |
* introduce defines with NS state names
* use them for vty and tests
* expand test output to print complete NS state
Change-Id: I69f8d536135ae76dbca623c2f1ffba625adcb1e9
Related: SYS#3610
|
|
|
|
|
|
|
|
|
|
| |
Commit 0d4e949e229a649ffd0503d8e930dba8be7dd34d changed the code to use
functions with local variables holding the bytes, but forgot to remove
the old global variables.
This test fixes compilation warnings.
Change-Id: I140de30038222b0419423d8c4f9da1946651a4e7
|
|
|
|
|
|
|
|
|
| |
Employ osmo_gettimeofday_override_* to take bssgp_fc_test off real time. The
jenkins build slave often failed the test based on sporadic time delays due to
server load and randomly rejected good patches. This patch ends that.
Change-Id: Ie5029b85c2a154554d75d7f9af49a3b93425fdd9
Related: OS#1809
|
|
|
|
|
|
|
| |
This allows feeding a custom time for unit tests by overriding
osmo_gettimeofday.
Change-Id: Ic7a81a6eb51f27fe452962b91f2eae2070d87089
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function originates from openbsc/src/gprs but is just specific
to BSSGP/Gb on the same level like bssgp_msgb_alloc.
This commit puts the former gprs_msgb_copy function beside
bssgp_msgb_alloc.
Renamed function:
gprs_msgb_copy -> bssgp_msgb_copy
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
| |
Use %td to print ptrdiff_t use %zu to print size_t,
include time.h on FreeBSD. Some more compiler warnings are
left but they require more thinking.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently the state is assumed to remain the same while the reset
procedure is active. While this works correctly in general, a single
unexpected BLOCK_ACK or UNBLOCK_ACK can change the state but will not
stop the reset procedure. The leads to repeated RESET messages, where
the corresponding RESET_ACK is ignored. This is a stable state which
can only be left by manual intervention or by reception of a RESET
message from the peer.
This commit changes the RESET timeout handler to set the state to
BLOCKED/RESET when sending the new NS RESET message.
Note that this should ensure a clean restart even if the state has been
screwed up. It does not fix the handling of BLOCK_ACK or UNBLOCK_ACK
in abnormal cases.
Addresses:
gprs_ns.c:349 NSEI=8895 Tx NS RESET (NSVCI=8895, cause=O&M intervention)
gprs_ns.c:878 NSVCI=8895 Rx NS RESET ACK (NSEI=8895, NSVCI=8895)
gprs_ns.c:887 NS RESET ACK Discarding unexpected message for NS-VCI 8895 from SGSN NSEI=8895
Ticket: OW#1551
Sponsored-by: On-Waves ehf
|
|
|
|
| |
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently large values for Bmax default MS get sliced since a uint16_t is
used as the type of the corresponding parameter of bssgp_tx_fc_bvc.
GSM 48.018, 11.3.2 which in turn refers to 11.3.5 specifies a maximum
of 6MB (0xffff * 100).
This commit changes the type to uint32_t to cover the full value
range.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The fix in the commit "bssgp: Fix call to llist_entry in
fc_queue_timer_cfg" prevents the flow control code from generating
certain logging messages ("-BSSGP-FC: fc_timer_cb() but still not
able to send PDU of 10 bytes") during the tests. This breaks the test
suite, since the update of the correseponding stderr output file
misses.
This commit updates the bssgp_fc_tests.err file accordingly.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently bssgp_rx_ptp might be called with bctx being NULL, when the
NS BVCI is neither BVCI_SIGNALLING nor BVCI_PTM, but the message is
a BVC_RESET or it contains an BVCI IE != BVCI_SIGNALLING where the
BVCI is not known.
This patch ensures that bssgp_rx_ptp will only be called with a
non-NULL bctx. A log message will be issued, if the bctx is NULL when
this was not expected.
Fixes: Coverity CID 1040674
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently incoming BSSGP STATUS messages are just logged and no other
action is taken. This makes it impossible for higher layers to react
to failures which are indicated by corresponding STATUS messages
unless a timeout is triggered as a result of that failure later on.
This commit adds a bssgp_rx_status() function and calls it on
incoming STATUS messages. That function logs a message, increments the
new BSSGP_CTR_STATUS counter if the bctx context exists and invokes
an NM_STATUS status indication. The latter will allow the application
to handle failures immediately. Since all STATUS messages should be
handled, the function is already called in bssgp_rcvmsg and the
message is no longer handled in (and will not reach) bssgp_rx_sign
and bssgp_rx_ptp.
Ticket: OW#1414
Sponsored-by: On-Waves ehf
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently sending SUSPEND/RESUME messages to this function (like it
is done in the osmo-sgsn) results in STATUS messages complaining
about an unknown BVCI. The reason is, that these messages rely on a
TLLI/RAI pair to identify the context and do not contain an explicit
BVCI.
This patch modifies bssgp_rcvmsg() to only complain about and unknown
BVCI if one is given but a matching context is not found (except for
RESET messages). The ctx argument is removed from the functions
handling SUSPEND and RESUME since it will always be NULL then.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
| |
This patch adds a test suite for the BSSGP protocol.
The first (and only) test checks the handling of BSSGP
SUSPEND/RESUME.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the OsmoSGSN we have a crash with a DEAD/BLOCKED GPRS-NS and
segmented SN-UNITDATA. For the caller it is not easy to know if
the passed msg buffer has been freed or not. The most easy solution
is to always take the ownership and either pass it on or free it
in case of an error.
Adjust indirect and direct callers of gprs_ns_sendmsg. I found
the following call-chains with an external msgb parameter.
gprs_ns_sendmsg
<- _bssgp_tx_dl_ud
<- bssgp_fc_in
<- bssgp_tx_dl_ud
Update the test to allocate a real msgb because for the test with
'1000' we will msgb_free it right away.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
| |
This patch extends test_sgsn_reset_invalid_state by assertions to check
that nscv->state and nsvc->remote_state have been set as expected.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The return value check has been removed in the commit 'Use
gprs_nsvc_reset instead of gprs_ns_tx_reset', because gprs_nsvc_reset
had no return value then. Since a compatible return value has been
added by 'Let gprs_nsvc_reset return a value', the former patch is
partly reverted by this commit.
The printf is now an OSMO_ASSERT. The commit message was taken
from Jacob.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently the NS-VC's state is updated from within gprs_ns_tx_reset,
which can lead to an inconsistent state when the RESET_ACK is lost.
In this state, the NSE_S_RESET bit is set but the Tns-reset timer is
not started.
This patch moves the state update into gprs_nsvc_reset. This way, the
state flags are consistent with the timer.
Addresses:
SGSN -> BSS NS_ALIVE
BSS -> SGSN NS_ALIVE_ACK
BSS -> SGSN BVC_RESET
SGSN -> BSS NS_STATUS, Cause: NS-VC blocked, NS VCI: 0x65
and there is no BSS->SGSN NS_ALIVE
Ticket: OW#1213
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This tests the behaviour for a certain combination of messages and
packet losses that can put the NS-VC object into an undefined state.
In that state, the peer's ALIVE messages are properly answered, but
the local test procedure has stopped, incoming unitdata PDUs are
answered by STATUS(NS-VC blocked) and the unblocking procedure is not
initiated.
Ticket: OW#1312
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
| |
This function forces the expiration of the timer within struct
gprs_nsvc. It is meant to be used for controlled (and faster) timer
expiration in unit tests. The timer_mode of the expired timer is
returned (or -1 if the timer wasn't active).
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
| |
This records the PDU type of the last message sent to the remote peer
in the global variable sent_pdu_type, which can then be used in
assertions.
Note that sent_pdu_type will remain unchanged if no message has been
sent via sendto.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
| |
Currently gprs_ns_tx_reset is used to let the NS stack generate
NS_RESET message. This is not adjusting the nsvc state properly.
This patch uses gprs_nsvc_reset instead which starts the full reset
procedure.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
| |
Currently those messages are answered by a NS_STATUS message when
received on an uninitialised (no NS_RESET hat been seen yet) NS_VC
which violates GPP TS 08.16 7.3.1 and 7.4.1.
This patch adds checks to gprs_ns_vc_create() and eventually returns
before the error NS_STATUS message is generated.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
| |
Several messages shall not be answered when a RESET hasn't been
received on a NS-VC:
- NS_RESET_ACK (see 3GPP TS 08.16, 7.3.1)
- NS_ALIVE_ACK (see 3GPP TS 08.16, 7.4.1)
- NS_STATUS (see 3GPP TS 08.16, 7.5.1)
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
| |
When a RESET is received on the same link with a different NSVCI from
a BSS on a dynamically created NS connection do not patch the nsvc
object but create a new one instead. Thus the NSVCI is never modified
at a nsvc object after the NS-VC has been established.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
| |
This modifies the NS stack's behavior to accept RESET and RESET_ACK
NSEI changes for NS-VC dynamically created by RESET messages from
BSSes. This feature is not used for NS-VC configured via VTY or NS-VC
to a SGSN.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes the implementations for the reception of RESET and
RESET_ACK to be compatible with 3GPP TS 08.16, 7.3.1:
- Just send a RESET_ACK with correct values back to the SGSN when a
RESET with an invalid NSVCI or NSEI has been received.
- Check RESET_ACK for matching NSEI and NSVCI.
- Ignore unexpected RESET_ACKs.
In addition, use RESET_ACK from a BSS to update the BSS source
address based on the NSVCI to be tolerant with changing UDP source
addresses/ports.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a test handling proper and mismatching RESETs. The latter may
occur, when ports change within a NS-VC without the SGSN getting
notice.
This tests for the behavior of the NS protocol stack for RESET and
RESET_ACK messages which changing/invalid NSEI and NSVCI like it is
being described in 3GPP TS 08.16, 7.3.1.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a SEGV error that happens the next time the statistics
are updated.
Addresses:
Program terminated with signal 11, Segmentation fault.
#0 0xb7711fa5 in rate_ctr_group_intv (grp=<optimized out>) at
rate_ctr.c:107
107 for (i = 0; i < grp->desc->num_ctr; i++) {
#0 0xb7711fa5 in rate_ctr_group_intv (grp=<optimized out>) at
rate_ctr.c:107
#1 rate_ctr_timer_cb (data=0x0) at rate_ctr.c:129
#2 0xb770ec59 in osmo_timers_update () at timer.c:243
#3 0xb770ef7a in osmo_select_main (polling=0) at select.c:133
#4 0x08049987 in main (argc=3, argv=0xbfba8084) at
gb_proxy_main.c:306
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
| |
The state matching condition is inverted. This is corrected by this
fix.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
| |
This adds tests for the gprs_ns_sendmsg() function. For this it
merges back functions from the gbproxy test.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Under special circumstances (see below) receiving a NS-RESET leads to
duplicated NS-VC entries.
This happens when the source port of a NS-VC changes to a new one
that has already been used by another NS-VC.
This patch changes gprs_ns_rx_reset() to check for this case and to
use the existing NS-VC object. The NS-VC object that was associated
with the source address before is detached from this source but kept
in the NS-VC list so that it can be reattached when a correspondent
NS-RESET is received later on. Meanwhile it will have a cleared link
layer address which will not match a real link info.
A new counter NS_CTR_REPLACED is incremented each time when the NS-VC
object is replacing another one. A new signal S_NS_REPLACED is added
which gets dispatched in this case, too.
Another new counter NS_CTR_NSEI_CHG is incremented each time when the
NSEI of a NS-VC object (with fixed NSVCI) changes.
Ticket: OW#874
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
| |
Adds the functions gprs_ns_ll_copy() and gprs_ns_ll_clear(). Renames
gprs_ns_format_peer() to gprs_ns_ll_str(). All of these functions
uniformly access the link layer part within the NS-VC objects.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
| |
Register an osmo signal handler to print a short notice about every
SS_L_NS signal that is generated while processing the tests.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently when a NS-RESET is recevied over a link that has not yet
been associated with a NS-VC, the NSEI is used to find an existing
NS-VC. If one is found, the reset procedure is initiated.
This behaviour is not conformant with 3GPP TS 08.16 (see chapter
4.2.3) which allows to use several NS-VC between two endpoints in
parallel.
The patch changes the implementation to use the NSVCI instead
of the NSEI to search for an existing NS-VC object.
Ticket: OW#874
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
According to 3GPP TS 08.16, 7.3 "Reset procedure" the entity
receiving a NS-RESET PDU responds with a NS-RESET-ACK and 'then'
starts the test procedure which essentially means, that a NS-ALIVE
gets sent and a timer is started.
Currently the NS-ALIVE is sent before the NS-RESET-ACK.
This patch fixes the implementation by reversing the order in which
these messages are sent.
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
| |
This tests the connection establishment by directly calling
gprs_ns_rcvmsg() and printing the resulting messages and the
NS-VC list.
|
|
|
|
|
|
|
|
|
| |
gb/bssgp_fc_test.c: In function ‘fc_out_cb’:
gb/bssgp_fc_test.c:46:1: warning: no return statement in function returning non-void [-Wreturn-type]
gb/bssgp_fc_test.c: In function ‘fc_in’:
gb/bssgp_fc_test.c:56:1: warning: no return statement in function returning non-void [-Wreturn-type]
gb/bssgp_fc_test.c: In function ‘test_fc’:
gb/bssgp_fc_test.c:79:3: warning: implicit declaration of function ‘usleep’ [-Wimplicit-function-declaration]
|