Commit Graph

4218 Commits

Author SHA1 Message Date
Harald Welte 579699bc2d gprs_ns2_vty: Allow creating NSE in sgsn-role
Change-Id: I694fa6c80d04d13cb1afaae93a9ae43b6dfd2207
Related: OS#3373
2021-03-24 00:30:22 +01:00
Harald Welte 5b034fbab0 gprs_ns2: Introduce gprs_ns2_create_nse2() for SGSN side SNS
gprs_ns2_create_nse() doesn't allow the caller to specify if the
BSS or the SGSN role of IP-SNS shall be implemented.  Add
gprs_ns2_create_nse2() to fix that.

Change-Id: I6db8c36f7c69b592d7d0fbcf323804f7e9912be2
Related: OS#3373
2021-03-24 00:25:56 +01:00
Harald Welte 694dad502a gprs_ns2_sns: Rename BSS-side states to include 'bss' in name
Clearly separate those states that only occur on the BSS side from
those of the SGSN side (which already have a prefix)

Change-Id: Iebc97637063b2676abff4a7dce50272d9b4e336b
Related: OS#3373
2021-03-23 15:22:16 +01:00
Harald Welte f61a9150a9 gprs_ns2_sns: Add some more OSMO_ASSERT about BSS role
Some functions are only to be called when operating in BSS role,
let's enforce that by sprinkling some OSMO_ASSERT() around.

Related: OS#3373
Change-Id: I20d1bd8df62e0bb84696e291756e2d96acf49246
2021-03-23 11:57:16 +01:00
Harald Welte 4f1274614e gprs_ns2_sns: Support for SGSN-side IP-SNS
This adds the core functionality of implementing the SGSN-side of IP-SNS
inside a new FSM.  The SGSN-side FSM shares states, events, structures
and code with the BSS-side whenever possible.

Note that this commit does not yet use the SGSN-side FSM, that is part
of subsequent commits.

Closes: OS#3373
Change-Id: I780413ffacd9cb71f64cc38057aae781eeb59b2b
2021-03-23 11:57:16 +01:00
Harald Welte 9fb5d80007 osmo-aka-verify: Fix use case with OP and not OPc
Change-Id: Ic6b5da83276ce2618cd80c6d34d3322bad7b4c48
2021-03-22 11:53:23 +01:00
Vadim Yanitskiy c3c914a5df utils/osmo-aka-verify: fix swapped CK/IK arguments
The positions of arguments in the call to "milenage_check" do not
match the ordering of the parameters:

  * "ck" is passed to "ik"
  * "ik" is passed to "ck"

Let's simply reorder the arguments of milenage_check()
to match the ordering in milenage_f2345().

Change-Id: Ia003d3c9d88fb8f6740791583855a709b8639160
Fixes: CID#220324
2021-03-21 22:36:43 +01:00
Harald Welte 8602106224 utils: osmo-aka-verify to verify UMTS AKA (SIM side)
This new utility implements the UMTS AKA procedures of the SIM
side.  It can be used to manually verify the correctness of
authentication tuples received from the network.

Change-Id: I497747fbf09f633dcd7c592bd9af7fca9a820645
2021-03-20 11:00:27 +00:00
Oliver Smith a7eb735b8d Revert "stats: log error when missing stats values"
This reverts commit d290439b4a, which
caused "stats values skipped" messages to appear even if they were not
skipped. Revert for now, replace with a proper version in the future.

Related: SYS#4877
Change-Id: Ib43bd53188a4d31d771feb921ea14abe1a3ec877
2021-03-19 16:47:52 +01:00
Daniel Willmann 2fa0e9df68 tlv: Fix length returned by t{l16,16l}v_put
Every other function returns a pointer to the first byte after the tlv
that was just written.

tl16v seems to be a copy and paste error from tlv16 above and t16lv seems
to count the 16-bit tag twice.

The new tests verify that the return value of *_put(buf, tag, len, val)
points to buf + *_GROSS_LEN(len).

Change-Id: I268a7e11fb5dce67ce1bd7974ab86c4d2bd002f7
2021-03-18 14:20:35 +01:00
Oliver Smith d290439b4a stats: log error when missing stats values
Let the user know when the stats were not consumed fast enough for the
given FIFO length.

Related: SYS#4877
Change-Id: If0e8ab55103007693101538fb6ea310075217774
2021-03-17 17:52:37 +01:00
Oliver Smith d89d35e933 tests/stats: enable logging in test output
Move test output from stdout to stderr and enable logging to stderr.
This is in preparation for the next patch, which will add a new log
message when osmo_stat_item_get_next() skips a value.

Related: SYS#4877
Change-Id: Ie0eaec2f93ac6859397a6bfca45039fdcc27cb9e
2021-03-17 16:39:35 +01:00
Harald Welte 9e37bf4bbc gprs_ns2_sns: Split allstate action in generic and BSS-specific part
Related: OS#3373
Change-Id: Icd40bd76df12795b4efcaf5865c6cf00da145f94
2021-03-10 12:23:09 +00:00
Harald Welte 06d9bf910b gprs_ns2: Encapsulate setting NSE dialect
Setting the NSE dialect possibly involves the creating (or destruction)
of a IP-SNS FSM.  Encapsulate that, rather than having every caller
re-implement that.

Change-Id: I24fdc26fbcfda039bd58ea166f4d5c2fd1801da1
2021-03-10 12:23:09 +00:00
Harald Welte c1c7e4a830 gprs_ns2_sns: Unify handling of SNS-CONFIG for IPv4 + IPv6
Related: OS#3373
Change-Id: I49e5ca4a09bc772ef5a0cd5c2a76c8b200e56d1b
2021-03-10 12:23:09 +00:00
Daniel Willmann 2aa527bd99 stats: Ensure that each osmo_stat_item only reports once per interval
We should never report multiple values for a metric. It is confusing for
the log reporter and wrong for statsd. Statsd will record only one value,
but will it be the first, last, ...?
This can happen if an osmo_stat_item changes more than once within the
same reporting interval.

With this patch only one aggregate value is sent to the log reporters.
The value reported is the maximum during this interval. Other
aggregations could be possible (min, last), but reporting a (useful)
average is not because the values don't include a timestamp and most
osmo_stat_items change at unregular intervals.

Change-Id: I366ab1c66f4ae6363111ea4e41b66b7d5bcade9c
Related: SYS#4877
2021-03-09 14:08:15 +01:00
Harald Welte 24920e2c97 gprs_ns2_sns: refactor ns2_sns_st_size_onenter()
Let's move computing of the local IP endpoints to a separate function,
so it can not only be used when entering the SNS_SIZE state. Preparation
for SGSN-side IP-SNS.

Change-Id: I5d7ce419135a8ef538cf9abcb76a49049ed7d5f9
Related: OS#3373
2021-03-05 17:08:03 +01:00
Harald Welte 2230a91711 gprs_ns2_vty: Clarify VTY help string wording
Change-Id: I7d70f8cc811c2f4aabf9fc00e4e612dfc4b031d3
2021-03-05 17:08:00 +01:00
Harald Welte 502845ec17 gprs_ns2_sns: Remove TODO (spec agrees, the correct cause code is used)
Change-Id: I6c431ba9e30d19425bf1cc1cc4d081949058610b
2021-03-05 17:06:54 +01:00
Harald Welte 05992873a7 gprs_ns2_sns: Implement error log in case no binds found for NSE
Change-Id: I66ce4b429ad2597343b48210fdcbc95a1f34cbcd
2021-03-05 17:06:54 +01:00
Harald Welte a0fb37627f TODO-RELEASE: Request increasing _LAST_OSMOVTY_NODE next release
We've used up all but one "library reserved" VTY nodes at this point,
and we should definitely add some more reserved nodes in the next
libosmovty ABI version / release.

Change-Id: Idfe1e7d97f3f29fc219e80dcb6ce6bb768733adf
2021-03-05 17:06:38 +01:00
Harald Welte 7d0daac1ce gprs_ns2: Pass peer/remote sockaddr argument to ns2_create_vc()
This is a preparation towards auto-creating SNS NS-VCs in SGSN role

Related: OS#3373
Change-Id: Idf92712079cd9b7e4ff2cf8df314b372d63e6e52
2021-03-04 13:35:14 +01:00
Harald Welte a39b2592a0 gprs_ns2: Remove any references to DNS; we use DLNS in NS2.
Related: OS#5058
Change-Id: I1f047e022a029d5f982deae0b30fec9e5a00d1ac
2021-03-04 13:35:14 +01:00
Harald Welte b9f23878bb gprs_ns2_sns: Dispatch inbound SNS-ACK to FSM
We don't really handle inbound SNS-ACK yet (as we don't originate
SNS ADD/DEL/CHGWEIGHT procedures yet).  However, the message
receive code should already dispatch those events to the FSM,
just like we do for the (equally unimplemented) handling of inbound
SNS-SIZE which is already dispatched to the FSM.

Change-Id: If6d5f96d85e6f05534fe49376f4473d912535ad4
2021-03-04 13:35:14 +01:00
Harald Welte 22274dfeb5 gprs_ns2: Log all transmitted SNS messages
We already have similar log statements for all NS-{RESET,BLOCK,UNBLOCK,...}
and it's confusing that even a debug-level NS log file doesn't show
transmitting SNS messages at all.

Change-Id: I0d31c3911d3acd6ac7296c370e920d53412d8289
2021-03-04 13:35:14 +01:00
Harald Welte 04647e169e cosmetic: ssn: some more comments
Change-Id: I87f76ab19d834d96a268b0d47b9dfe2424151d63
2021-03-04 09:09:13 +00:00
Alexander Couzens 3255668afb gprs_ns2: don't OSMO_ASSERT() while freeing NS-VC.
When freeing the NS-VC there are cases when the NSE is still alive.
This means that gprs_ns2_free_nsvc() calls  ns2_prim_status_ind(),
which in turn calls ns2_count_transfer_cap().  The latter must deal
with such a situation rather than OSMO_ASSERT()

Change-Id: I4f32dee705c9886717339fe7cce5b4cd8d2c18f7
2021-03-03 07:50:00 +00:00
Alexander Couzens 5baa141315 gprs_bssgp: use BVCI_SIGNALLING/BVCI_PTM instead of 0/1
Makes more understandable and clear what's meant in the code.

Related: OS#3879
Change-Id: I9d0545fac0af0dcc1783040a376a9b8e65a92699
2021-03-01 19:44:02 +00:00
Alexander Couzens 7819ff6959 gprs_bssgp: add support for SGSN oriented RESET
To support SGSN oriented RESET introduce a role flag to
track what's running the gprs_bssgp (local side).

Related: OS#3879
Change-Id: Ibcbaffa94cbdc4296a8a7c372304ac11d50d9559
2021-03-01 19:44:02 +00:00
Oliver Smith b76811b1da osmo-release.sh: support epoch
Related: OS#5046
Change-Id: I5d9d18d7cc84f185222ee176e6546bb3553a3598
2021-02-26 11:53:53 +01:00
Pau Espin e75fa1e2ec tests/gb: Fix printf format errors on ARM 32 bits
Seen building on RPI4 32 bits raspbian:
error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘size_t’ {aka ‘unsigned int’} [-Werror=format=]

Change-Id: I62199bfc7f3a78403334f5580f31fa5743223c9b
2021-02-25 10:40:31 +00:00
Pau Espin 43abde1b3a osmo-release.sh: Properly rearrange var init and sanity checks
Change-Id: If62024fafcd30bc3399115248116e15e141b1cbb
2021-02-24 16:44:48 +01:00
Pau Espin e6230eff90 osmo-release.sh: Check LIBVERSION matches rpm *.spec.in
Change-Id: I7b8d56cc255167407370c888647255d8992f4202
2021-02-24 13:22:44 +01:00
Pau Espin 01312215fa osmo-release.sh: Drop repeated DRY_RUN early exit
Change-Id: Ib45fa3f5f89e1f7321d6ceace1b9336e5416c38c
2021-02-24 12:52:32 +01:00
Pau Espin 44507195e0 osmo-release.sh: Check configure.ac dependency versions match those in rpm *.spec.in
Change-Id: I694f4055b39f91aaa0cf5997af67feefad99fdf5
2021-02-24 12:50:03 +01:00
Harald Welte 4bedb53b34 Bump version: 1.5.0.3-45cf → 1.5.1
Change-Id: I6eea93d9723f7e6ffd1f9eb3d260a5b666cb2124
2021-02-24 09:35:21 +01:00
Harald Welte af52bcc5a0 attempt to fix RPM spec file after recent soversion bump
In I3bc0826c0000be4d76235ed6b5be86d216ea2e4d the soversion was
chhanged (e.g. libosmocore.so.16 to libosmocore.so.17) but the
spec.in file was not adjusted accordingly.

Change-Id: Id7e1e3feef6bda1a2d2a615a61635e22d550b5a3
2021-02-24 08:28:30 +00:00
Pau Espin 181578355b osmo-release.sh: Fix rc!=0 on TODO-RELEASE file without comment lines
Change-Id: Iff09a090284a0f65fd798d99265cba51f3309923
2021-02-23 14:31:11 +01:00
Pau Espin Pedrol f286fdc87e Bump version: 1.4.0.535-e387-dirty → 1.5.0
Change-Id: I3bc0826c0000be4d76235ed6b5be86d216ea2e4d
2021-02-23 14:03:31 +01:00
Pau Espin Pedrol e3870b30ef osmo-release.sh: Omit tab whitespace matching debian/control versions
Change-Id: I054245b54adfaae3d51bcfc3a3d1e3ecbaa5f116
2021-02-23 13:54:30 +01:00
Harald Welte fcbf3470b9 CBSP: Fix encoding of warning period
The warning period encoding was wrong, resulting in way too short
warning periods being encoded than intended/specified by the caller.

Change-Id: Idf3cae48a6ab45550d7bbd937bb49a0e1a4e8aed
2021-02-22 10:06:12 +01:00
Harald Welte 48f22b0e87 CBSP: fix encoding/decoding of keep-alive repetition period
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
2021-02-22 09:58:00 +01:00
Harald Welte 3217d5187f support for stats static userspace probes via systemtap
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
2021-02-22 09:58:00 +01:00
Pau Espin 6e9dd02bf8 logging: Deprecate API log_set_print_filename
Let's flag the API as deprecated so that people start using
log_set_print_filename2() API instead, which has less ackward
behavior implications like changing the print status of category-hex.

Related: OS#5034
Change-Id: If9b6b322989536a12094e6105c3aabc84d8be24a
2021-02-20 17:13:58 +00:00
Pau Espin 01e0d3e7fd Drop use of log_set_print_filename() API inside libosmocore
Let's use log_set_print_filename2() API instead, which has less ackward
behavior implications like changing the print status of category-hex.

Related: OS#5034
Change-Id: Ifc78e1dcba5baf0b41f6ccbbbd1e3f06552d73da
2021-02-20 17:13:58 +00:00
Pau Espin 690b661fbc tests: Set print_category values explicitly
This will alow easily changing default values for print_category vs
print_category_hex later.

In any case, every test relying on logging output validation should
always explicitly state the config to avoid issues in the future if
default values change.

Related: OS#5034
Change-Id: If29b40557d5c2bcda04b964f344070bad58d8f28
2021-02-20 17:13:58 +00:00
Alexander Couzens 2665388e26 gprs_ns2: free_nse: free the SNS fsm early
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
2021-02-19 12:57:23 +01:00
Pau Espin 662d10dcda logging: Allow prefixing thread ID to each log line
Related: OS#5032
Change-Id: I38fc93ab0182b4edbd639c7ed0f31ce51964ee18
2021-02-19 11:21:46 +00:00
Alexander Couzens 7bb39e368d gprs_ns2: ensure no duplicate UDP NSVC can be created
Change-Id: I58a95817e2730bbbaa851a43a5b072d1de2db037
2021-02-19 10:41:50 +00:00
Alexander Couzens b2de546a5c gprs_ns2: add value_string for GPRS_NS2_AFF_CAUSE_SNS_NO_ENDPOINTS
Change-Id: I7c9245be248cb8697a370f80021612c14efa5cbb
2021-02-19 10:41:50 +00:00