Commit Graph

808 Commits

Author SHA1 Message Date
Vadim Yanitskiy 3b582af2eb modem: route L1CTL prims to/from libosmo-gprs-rlcmac
Change-Id: I38e9a686f8edc3fe55f961d75e68602c33bbbaaf
Related: OS#5500
2023-03-17 12:15:29 +00:00
Vadim Yanitskiy bb6df124d2 layer23: implement Rx/Tx API for GPRS related messages
Change-Id: I87950e893ef96ff8328f43f1548111aa9f66439b
Related: OS#5500
2023-03-17 12:15:29 +00:00
Vadim Yanitskiy e15996378f modem: fix modem_gmm_prim_up_cb(): add missing break
Change-Id: Ibd16232d76d83d90f27d08b47aa38509161270b6
Fixes: CID#311019
2023-03-17 16:21:00 +07:00
Vadim Yanitskiy 4949ab7471 layer23/{mobile,modem}: prefix VTY prompt with project's name
Change-Id: If7ce89362c75e2c15995dfb08cfcfdcad24e2529
2023-03-17 16:11:48 +07:00
Vadim Yanitskiy b2dfbb8859 layer23/{mobile,modem}: fix segfault on VTY connection
It was a mistake to call vty_init(), passing it a pointer to the
vty_app_info structure allocated on the stack, because it gets
overwritten when the calling function _vty_init() returns.

Change-Id: I75843a964254243c70bedcf8ff97d854107ee21a
Fixes: 9feb5057 "layer23: refactor the application API concept"
2023-03-16 23:41:48 +00:00
Vadim Yanitskiy 42ca40dd1e modem: add test VTY command for sending raw LLC PDUs
Change-Id: I14f58e715d77a1b1cb40fdd3ddd09084360f2274
Related: OS#5500
2023-03-16 13:47:06 +00:00
Vadim Yanitskiy b29a26c620 modem: add test VTY command to send CHANNEL REQUEST
Do not call grr_tx_chan_req() unconditionally from grr_rx_bcch().
Add a special (hidden, expert mode) VTY command for that.

Change-Id: I049a8d7f58ae9703d06dff235973ba376702c873
Related: OS#5500
2023-03-16 13:46:53 +00:00
Pau Espin 1612c8f862 layer23: modem: Depend on libosmo-gprs-gmm
Related: OS#5501
Change-Id: I82a2b9c043eae42435ca781689fc3381e7a31bea
2023-03-15 15:38:54 +01:00
Vadim Yanitskiy 7ea900525c modem: clean up #includes (using include-what-you-use)
Change-Id: I728f3eea1590f46bef6e0eb4beb9714f6c9a1614
2023-03-14 15:06:26 +00:00
Vadim Yanitskiy 8240ef74fc modem: move GRR specific code into its own file
Change-Id: I25caa0bd01e3d090803512f5b13cad58439f44f8
Related: OS#5500
2023-03-14 15:06:26 +00:00
Pau Espin b8c3bef737 layer23: Call osmo_fd_unregister() before closing and changing bfd->fd
Change-Id: I886062c1a944acf0982755a7acddf7e2233d13a8
2023-03-14 12:17:36 +00:00
Vadim Yanitskiy 6db5f8b9ce modem: get rid of app_data.chan_req, use ms->rrlayer
Change-Id: I77d0a834a73c511f157c6f1524b9e98df3f4def4
Related: OS#5500
2023-03-14 18:51:09 +07:00
Vadim Yanitskiy 7f9c01f00f modem: get rid of app_data.{ccch_mode,si}, use ms->cellsel
Change-Id: Ib711a3b893c43c0875c431c90cd0a2ebfafe1926
Related: OS#5500
2023-03-14 18:51:09 +07:00
Vadim Yanitskiy 67943df4b7 layer23: fix parsing of command line options
After the recent refactoring, parsing of the command line options is
broken for some arguments.  Specifically, the value of '-a'/'--arfcn'
is ignored and hard-coded ARFCN=871 is used instead.

The problem is that l23_app_init(), which allocates an MS state and
sets the initial ARFCN, is called *before* handle_options().  So the
cfg_test_arfcn is used before it gets overwritten from the argv[].

The usual approach in osmo-* apps is to parse the command line
arguments first, and only then execute code which depends on
configurable parameters.  Let's follow this approach too.

Change-Id: I77ca11c14561fa3fcb9add60ccea5b0b847a20c4
2023-03-13 06:18:02 +07:00
Vadim Yanitskiy 9feb5057da layer23: refactor the application API concept
With this set of changes we have a cleaner l23 app architecture:

* struct vty_app_info: all l23 applications must define this struct;
* struct vty_app_info: *cfg_supported() becomes a mask of L23_OPT_*;
* struct vty_app_info: explicitly set L23_OPT_* in all l23 apps;
* drop l23_app_info(), there can be only one vty_app_info per an app;

It's no more needed to obtain the vty_app_info by calling a function
and checking the returned value against NULL everywhere.  This kind
of information is rather static (not dynamically composed) and needs
not to be encapsulated into functions.

Change-Id: I89004cd5308927305f79b102f7b695709148df6d
2023-03-13 06:16:48 +07:00
Max 22f12ba92e vty: fix local-host docs
Change-Id: I69d0fa32105a3d114cdcae84ef2cc3ada578f13a
2023-03-08 22:05:07 +03:00
Max 736438693e mobile: allow configuring local GSMTAP address
Change-Id: Ia1555db653cf0bb20af74617f33aad31c971bfdb
2023-03-08 17:47:04 +00:00
Max e2930dad35 mobile: log state/event details on error
Change-Id: I24a4635e9a9a0984c0e1036e8b6ea19b08a06223
2023-03-06 17:27:39 +00:00
Max 9a9fca7e1d mobile: deprecate --gsmtap-ip option
Change-Id: I44b355f9a0bafee16a284537de76662a61111b09
2023-03-06 15:19:56 +00:00
Max 69bbbc5249 mobile: log MCC/MNC of the network while registering
Change-Id: I114eade36303f161fea171745a1a9b05e461e349
2023-03-06 15:16:35 +00:00
Max 42beda4557 mobile: drop duplicated #define
Change-Id: If5bda46dcc5b541a9d08cfd880a2a8f181426484
2023-03-04 23:15:18 +03:00
Pau Espin 35f93ac454 modem: Use libosmo-gprs-rlcmac L1CTL primitives
Related: OS#5500
Change-Id: I9d3066f19077796b2ccf70b15cc57b6488f015be
2023-02-27 14:50:56 +00:00
Max 0fb9853582 mobile: add vty statsd support
Change-Id: I7905b44478dcb9bcf0a1a68fde95f470c07edca3
2023-02-21 08:49:13 +00:00
Oliver Smith 65957cf877 Run struct_endianness.py
Ensure there is no diff to prepare to run this in CI.

Related: OS#5884
Change-Id: I617c967c5f34c0be2cf6fd43ceb1af17897f2bf1
2023-02-20 11:18:43 +01:00
Pau Espin f1e99e59e2 layer23: Support configuring GSMTAP through VTY in l23 apps.
This allow all l23 apps supporting L23_OPT_VTY and L23_OPT_TAP to
dynamically configure gsmtap through a "gsmtap" VTY node:

gsmtap
 remote-host 127.0.0.1
 lchan sacch
 lchan lsacch
 lchan sacch/4
 lchan sacch/8
 lchan sacch/f
 lchan sacch/h
 lchan unknown
 lchan bcch
 lchan ccch
 lchan rach
 lchan agch
 lchan pch
 lchan sdcch
 lchan sdcch/4
 lchan sdcch/8
 lchan facch/f
 lchan facch/h
 lchan pacch
 lchan cbch
 lchan pdch
 lchan pttch
 lchan cbch
 lchan tch/f
 lchan tch/h
 category gprs dl-unknown
 category gprs dl-dummy
 category gprs dl-ctrl
 category gprs dl-data-gprs
 category gprs dl-data-egprs
 category gprs ul-unknown
 category gprs ul-dummy
 category gprs ul-ctrl
 category gprs ul-data-gprs
 category gprs ul-data-egprs

VTY cmd "lchan" enables/disables tapping on general channel types,
while "category" allows fine-grained selection of messages being
tapped within the enabled lchan which would tap those messages.

Change-Id: I2582a1633d37d350a7f4c2bb5e03793bdf46e839
2023-02-02 18:18:21 +01:00
Pau Espin 3531b9afb6 layer23: Use updated libosmo-gprs-rlcmac header name
header file name gprs_rlcmac.h was renamed to csn1-defs.h during recent
libosmo-gprs-rlcmac development. Use the new names everywhere.

Depends: libosmo-gprs.git Change-Id I84ea63ed0b804699fd995a2e0c07ced17b3ad4c8

Change-Id: I205536907d9062b78453ce9bc404db1633e9a616
2023-02-01 17:38:52 +01:00
Pau Espin 59f3e4d4fb Get rid of openbsc leftover references
Get rid of the global variable since it's only used once inside a
function anyway.

Change-Id: I0b4f536b16f3693ef16de8505036943c3a30b1df
2023-01-31 12:30:07 +01:00
Pau Espin 738b65d240 layer23: Integreate mobile further into l23_app
Several functions and data structures in mobile app are refactored to
follow more closely the l23_app API and structures. These movements
allow starting to use already some shared infrastructure defined under
layer23/common.
This is not a full migration to l23_app, since mobile still keeps a
separate main() with a few extra code. This commit is rather a step
towards an eventual merge of mobile's main.cpp into
layer23/common/main.c

This is a preparation commit to later one adding gsmtap VTY configuration
to all l23 apps.

Change-Id: I3141b6cb4a0482970f434180ef8dda3af1d4aa0c
2023-01-31 11:59:08 +01:00
Pau Espin 60716bcfe6 modem: Initial integration of libosmo-gprs-rlcmac
This commit places code to forward unitdata LLC<->RLCMAC.

Depends: libosmo-gprs.git Change-Id I1870fa6a264612c5a669bfb832e6e8c0a892cb74
Related: OS#5500
Change-Id: I0e628d9ddaa5ad6a205f07746d4176d1b8df7eb0
2023-01-30 19:57:36 +00:00
Pau Espin 53996bb3d8 modem: Initial integration of libosmo-gprs-{llc,sndcp}
Change-Id: I820328009ccdd1f8112aeb163efa064ec1465d2a
2023-01-30 19:57:36 +00:00
Pau Espin c9cc4c305d Depend on libosmo-gprs-{llc,sndcp}
These will be needed for the MS to speak SNDCP and LLC.

Change-Id: I80811f73b798151257107bc94aedabe71fee0300
2023-01-19 20:02:17 +01:00
Pau Espin 3da09d1f7e layer23: Initial integration of tun device
Use the new tundev API from libosmocore to create tun devices for each
configured (and enbled) APN.
No address nor routes are yet set on the tun devices because we still
lack GMM/SNDCP/LLC/RLCMAC layers to negotiate them.

A follow up patch will add some code to interact with the SNDCP layer.

Depends: libosmocore.git Change-Id I3463271666df1e85746fb7b06ec45a17024b8c53
Change-Id: I86cac406843157aa2e51727cf8ccac9804d7961d
2023-01-19 20:02:07 +01:00
Pau Espin 6327f40be6 layer23: Introduce APN VTY node
This commit adds an initial set of VTY commands to manage APN
configuration and set up, which is used by the modem app.

The sample modem.cfg file is updated to showcase how to configure APNs.
The app doesn't do anything with them yet. A follow up patch will add
code to create tun devices for each configured APN.

Change-Id: I7b4eaa0de428b418bb1d89bd544694e89beb3e6e
2023-01-19 19:12:09 +01:00
Pau Espin c1bddf20b5 layer23: main: Log line about using config file before parsing it
Change-Id: I66b5b18887b8deb37c3784fec90644470498d7b5
2023-01-17 19:49:10 +01:00
Pau Espin 50097dd4c0 layer23: Use shift operand to define bitmask values
Change-Id: I22e2f543c077a4df4623c5e3bd44f8f068596baf
2023-01-17 19:49:10 +01:00
Pau Espin b8cc5b8c9a layer23: generate config.h
Follow-up commits will add some extra checks we want to have in config.h
Include config.h in files using PACKAGE_VERSION.

Change-Id: Ic779a3168012780feef8d173371387d09d383bfd
2023-01-17 18:16:34 +00:00
Pau Espin 0621ff9cbd layer23: ms.h: Use enum type in ms->shutdown
Change-Id: I5456f7a8675e6ab620bc93b56e2c4ad22d3900e8
2023-01-17 18:16:34 +00:00
Pau Espin 3d3505b726 layer23: Let each app allocate its ms obj and start layer2 when needed
This allows apps to allocate the objects as they please: simple apps can
statically allocate it at startup. Others may want to allocate them
through VTY.
Some apps may also want to dynamically start and stop layer2.

Change-Id: I32f99df76a5513eff9df5489d28d60aedf96dec3
2023-01-17 18:16:34 +00:00
Pau Espin 8f59b1a0b9 layer23: Move layer2-socket VTY command to common/
This allows configuring layer2-socket for other apps than mobile, like
the "modem" one.

Change-Id: If7419f8fc54a54eed68a076968d93dba5ac977b7
2023-01-17 18:16:34 +00:00
Pau Espin 3b8d5bb26a layer23: Move '(no) shutdown' VTY code to common/vty.c
Change-Id: Ib5c9b6f3efa255d67980945db9f98dd8a112af0e
2023-01-17 18:16:34 +00:00
Vadim Yanitskiy eb654c07d2 layer23: fix integer overflow in l1ctl_tx_data_req()
Found by clang:

  l1ctl.c:397:52: warning: implicit conversion from 'int' to 'int8_t'
                  (aka 'signed char') changes value from 255 to -1
                  [-Wconstant-conversion]

Change-Id: I23e9ea5ad59099c24db60057c8e7da1e6a0d2293
2023-01-17 18:10:55 +00:00
Pau Espin 0fe3f7d4e5 layer23: Move settings.{c,h} under common/
Some of those can be reused by other apps (like modem).

Change-Id: I0a741b2384195d512fdc49eda6762241f385b1f1
2023-01-16 13:34:31 +01:00
Pau Espin 93aa93b6c4 layer23: Move script_lua_close() call outside of settings.c
The only caller of gsm_settings_exit() is in app_mobile so far, which is
the only app supporting/using lua scripting so far.

Change-Id: I634a4514ead9d064e7509c3fbbb3a2c89c7f3a56
2023-01-16 13:34:31 +01:00
Pau Espin f15eeadb21 layer23: Move subscriber.{c,h} under common/
Some of those can be reused by other apps (like modem).

Change-Id: I3727e40bcc9a4ee93aaf2c4ced070cc789653e80
2023-01-16 13:34:31 +01:00
Pau Espin 2b03270b30 layer23: Move support.{c,h} under common/
Some of those can be reused by other apps (like modem).

Change-Id: I3c5af4db8e603aa004d0b6410b09b5143173b874
2023-01-16 13:34:31 +01:00
Pau Espin adb67e5106 layer23: Initial VTY framework to share VTY code between apps
A small layer23 framework is added which allows apps to easily share/reuse
VTY commands while giving some flexiblity to add new per-app
specific configs/cmds, since not all commands may be relevant for all
apps.

Some of the mobile app code is moved to common, and sample infra is
added to modem app.
Future commits will most probably keep moving more stuff mobile->common
and then reusing those in modem app, as found needed.

Change-Id: Iabfb3129199488d790b89884bc1e424f2aca696f
2023-01-16 13:34:28 +01:00
Pau Espin b54dbfcde9 mobile: settings.h: Add missing type forward declaration
Change-Id: Ibdfa905e2bd24f03d23ce114e969647b07a2009f
2023-01-16 10:31:01 +01:00
Pau Espin fb030a8897 layer23: Initialize osmocom_ms further in common code
Change-Id: Ic629cf229167ddd4c533a2abf1b82ad78d1144a9
2023-01-16 10:30:56 +01:00
Pau Espin 9010a6be52 layer23: mobile: Several fixes and improvements in show_ms_cmd
Fix missing VTY param description.
Fix wrong indentation.
Fix unneeded else after early return.

Change-Id: I4a55328e71ec16355974c20275c0e525077252e1
2023-01-16 10:30:15 +01:00
Pau Espin ea03422cd8 layer23: mobile: Fix typo in vty string
Change-Id: I05238b72735600aae46126c24d5e96444e91ef06
2023-01-16 10:30:15 +01:00