mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-smlc.git
				synced 2025-10-31 20:23:50 +00:00 
			
		
		
		
	Compare commits
	
		
			48 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | c45aa8f571 | ||
|  | 1416f6497f | ||
|  | 576b13fb19 | ||
|  | 28748a57bb | ||
|  | 9b3ab7372b | ||
|  | b585ad15c9 | ||
|  | 4f54a410f5 | ||
|  | 310e21dbf1 | ||
|  | 062390702c | ||
|  | 22f0738935 | ||
|  | 39515ac59e | ||
|  | fea674ee2d | ||
|  | d5c7fd45b2 | ||
|  | 88731ffa1f | ||
|  | bc0ae88168 | ||
|  | 74450e80ea | ||
|  | ccfd8e40ea | ||
|  | ebf2429f39 | ||
|  | ddfea86880 | ||
|  | b9e204f3bd | ||
|  | 7dbd34a37e | ||
|  | 961e96bfd9 | ||
|  | 4b739ac260 | ||
|  | f66763e891 | ||
|  | e7535a4a9b | ||
|  | 7385427397 | ||
|  | 81e12318ae | ||
|  | 85f1cca096 | ||
|  | e8c4967639 | ||
|  | d09e87c645 | ||
|  | 386d5acdbe | ||
|  | 8c11b24ca0 | ||
|  | 8bcac6f928 | ||
|  | 74b4e61f36 | ||
|  | 7118875839 | ||
|  | cf29f44722 | ||
|  | 0fda654d29 | ||
|  | 848316e9d4 | ||
|  | 5ac8ab7cd9 | ||
|  | 518550e404 | ||
|  | f2a03654bb | ||
|  | accb1d1b25 | ||
|  | f30a8a1133 | ||
|  | cd82cb23be | ||
|  | bc54ff06f8 | ||
|  | b9b65d953f | ||
|  | 454047c586 | ||
|  | 5b7f1fd5c8 | 
							
								
								
									
										4
									
								
								.gitreview
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								.gitreview
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | [gerrit] | ||||||
|  | host=gerrit.osmocom.org | ||||||
|  | project=osmo-smlc | ||||||
|  |  | ||||||
| @@ -19,7 +19,7 @@ SUBDIRS = \ | |||||||
| BUILT_SOURCES = $(top_srcdir)/.version | BUILT_SOURCES = $(top_srcdir)/.version | ||||||
| EXTRA_DIST = \ | EXTRA_DIST = \ | ||||||
| 	     .version \ | 	     .version \ | ||||||
| 	     contrib/osmo-smlc.spec.in \ | 	     README.md \ | ||||||
| 	     debian \ | 	     debian \ | ||||||
| 	     git-version-gen \ | 	     git-version-gen \ | ||||||
| 	     osmoappdesc.py \ | 	     osmoappdesc.py \ | ||||||
|   | |||||||
							
								
								
									
										69
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | |||||||
|  | osmo-smlc - Osmocom Serving Mobile Location Centre | ||||||
|  | ================================================== | ||||||
|  |  | ||||||
|  | This repository contains a C-language implementation of a minimalistic | ||||||
|  | GSM Serving Mobile Location Centre (SMLC) for 2G (GSM).  It is part of the | ||||||
|  | [Osmocom](https://osmocom.org/) Open Source Mobile Communications project. | ||||||
|  |  | ||||||
|  | OsmoSMLC exposes | ||||||
|  |  * 3GPP Lb interface towards the BSC | ||||||
|  |  * The Osmocom typical telnet VTY and CTRL interfaces. | ||||||
|  |  * The Osmocom typical statsd exporter. | ||||||
|  |  | ||||||
|  | OsmoSMLC supports the following location methods: | ||||||
|  |  * currently only the Timing Advance based method of determining a mobile station; operator must configure the | ||||||
|  |    locations of the cells in the osmo-smlc configuration file | ||||||
|  |  | ||||||
|  | Homepage | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | You can find the OsmoSMLC issue tracker and wiki online at | ||||||
|  | <https://osmocom.org/projects/osmo-smlc> and <https://osmocom.org/projects/osmo-smlc/wiki> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | GIT Repository | ||||||
|  | -------------- | ||||||
|  |  | ||||||
|  | You can clone from the official osmo-smlc.git repository using | ||||||
|  |  | ||||||
|  |         git clone https://gitea.osmocom.org/cellular-infrastructure/osmo-smlc | ||||||
|  |  | ||||||
|  | There is a web interface at <https://gitea.osmocom.org/cellular-infrastructure/osmo-smlc> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Documentation | ||||||
|  | ------------- | ||||||
|  |  | ||||||
|  | User Manuals and VTY reference manuals are [optionally] built in PDF form | ||||||
|  | as part of the build process. | ||||||
|  |  | ||||||
|  | Pre-rendered PDF version of the current "master" can be found at | ||||||
|  | [User Manual](https://ftp.osmocom.org/docs/latest/osmosmlc-usermanual.pdf) | ||||||
|  | as well as the [VTY Reference Manual](https://ftp.osmocom.org/docs/latest/osmosmlc-vty-reference.pdf) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Mailing List | ||||||
|  | ------------ | ||||||
|  |  | ||||||
|  | Discussions related to osmo-smlc are happening on the | ||||||
|  | openbsc@lists.osmocom.org mailing list, please see | ||||||
|  | <https://lists.osmocom.org/mailman/listinfo/openbsc> for subscription | ||||||
|  | options and the list archive. | ||||||
|  |  | ||||||
|  | Please observe the [Osmocom Mailing List | ||||||
|  | Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules) | ||||||
|  | when posting. | ||||||
|  |  | ||||||
|  | Contributing | ||||||
|  | ------------ | ||||||
|  |  | ||||||
|  | Our coding standards are described at | ||||||
|  | <https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards> | ||||||
|  |  | ||||||
|  | We use a Gerrit based patch submission/review process for managing | ||||||
|  | contributions.  Please see | ||||||
|  | <https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit> for | ||||||
|  | more details | ||||||
|  |  | ||||||
|  | The current patch queue for osmo-smlc can be seen at | ||||||
|  | <https://gerrit.osmocom.org/#/q/project:osmo-smlc+status:open> | ||||||
							
								
								
									
										9
									
								
								TODO-RELEASE
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								TODO-RELEASE
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | |||||||
|  | # When cleaning up this file: bump API version in corresponding Makefile.am and rename corresponding debian/lib*.install | ||||||
|  | # according to https://osmocom.org/projects/cellular-infrastructure/wiki/Make_a_new_release | ||||||
|  | # In short: https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info | ||||||
|  | # LIBVERSION=c:r:a | ||||||
|  | # If the library source code has changed at all since the last update, then increment revision: c:r + 1:a. | ||||||
|  | # If any interfaces have been added, removed, or changed since the last update: c + 1:0:a. | ||||||
|  | # If any interfaces have been added since the last public release: c:r:a + 1. | ||||||
|  | # If any interfaces have been removed or changed since the last public release: c:r:0. | ||||||
|  | #library	what			description / commit summary line | ||||||
							
								
								
									
										22
									
								
								configure.ac
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								configure.ac
									
									
									
									
									
								
							| @@ -9,6 +9,8 @@ AC_CONFIG_AUX_DIR([.]) | |||||||
| AM_INIT_AUTOMAKE([dist-bzip2]) | AM_INIT_AUTOMAKE([dist-bzip2]) | ||||||
| AC_CONFIG_TESTDIR(tests) | AC_CONFIG_TESTDIR(tests) | ||||||
|  |  | ||||||
|  | CFLAGS="$CFLAGS -std=gnu11" | ||||||
|  |  | ||||||
| dnl kernel style compile messages | dnl kernel style compile messages | ||||||
| m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) | ||||||
|  |  | ||||||
| @@ -34,12 +36,11 @@ if test "x$PKG_CONFIG_INSTALLED" = "xno"; then | |||||||
| fi | fi | ||||||
| PKG_PROG_PKG_CONFIG([0.20]) | PKG_PROG_PKG_CONFIG([0.20]) | ||||||
|  |  | ||||||
| PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.6.0) | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.10.0) | ||||||
| PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.6.0) | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.10.0) | ||||||
| PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.6.0) | PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.10.0) | ||||||
| PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.6.0) | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.10.0) | ||||||
| PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 1.5.0) | PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 2.0.0) | ||||||
| PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 1.5.0) |  | ||||||
|  |  | ||||||
| dnl checks for header files | dnl checks for header files | ||||||
| AC_HEADER_STDC | AC_HEADER_STDC | ||||||
| @@ -115,13 +116,13 @@ AC_ARG_ENABLE([external_tests], | |||||||
| 				[Include the VTY/CTRL tests in make check [default=no]]), | 				[Include the VTY/CTRL tests in make check [default=no]]), | ||||||
| 		[enable_ext_tests="$enableval"],[enable_ext_tests="no"]) | 		[enable_ext_tests="$enableval"],[enable_ext_tests="no"]) | ||||||
| if test "x$enable_ext_tests" = "xyes" ; then | if test "x$enable_ext_tests" = "xyes" ; then | ||||||
| 	AC_CHECK_PROG(PYTHON2_AVAIL,python2,yes) | 	AC_CHECK_PROG(PYTHON3_AVAIL,python3,yes) | ||||||
| 	 if test "x$PYTHON2_AVAIL" != "xyes" ; then | 	 if test "x$PYTHON3_AVAIL" != "xyes" ; then | ||||||
| 		AC_MSG_ERROR([Please install python2 to run the VTY/CTRL tests.]) | 		AC_MSG_ERROR([Please install python3 to run the VTY/CTRL tests.]) | ||||||
| 	fi | 	fi | ||||||
| 	AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes) | 	AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes) | ||||||
| 	 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then | 	 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then | ||||||
| 		AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.]) | 		AC_MSG_ERROR([Please install https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests to run the VTY/CTRL tests.]) | ||||||
| 	fi | 	fi | ||||||
| fi | fi | ||||||
| AC_MSG_CHECKING([whether to enable VTY/CTRL tests]) | AC_MSG_CHECKING([whether to enable VTY/CTRL tests]) | ||||||
| @@ -206,5 +207,4 @@ AC_OUTPUT( | |||||||
|     doc/manuals/Makefile |     doc/manuals/Makefile | ||||||
|     contrib/Makefile |     contrib/Makefile | ||||||
|     contrib/systemd/Makefile |     contrib/systemd/Makefile | ||||||
|     contrib/osmo-smlc.spec |  | ||||||
|     Makefile) |     Makefile) | ||||||
|   | |||||||
| @@ -31,9 +31,8 @@ export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH" | |||||||
| export LD_LIBRARY_PATH="$inst/lib" | export LD_LIBRARY_PATH="$inst/lib" | ||||||
| export PATH="$inst/bin:$PATH" | export PATH="$inst/bin:$PATH" | ||||||
|  |  | ||||||
| osmo-build-dep.sh libosmo-abis | osmo-build-dep.sh libosmo-netif "" --disable-doxygen | ||||||
| osmo-build-dep.sh libosmo-netif | osmo-build-dep.sh libosmo-sigtran "" --disable-doxygen | ||||||
| osmo-build-dep.sh libosmo-sccp |  | ||||||
|  |  | ||||||
| # Additional configure options and depends | # Additional configure options and depends | ||||||
| CONFIG="" | CONFIG="" | ||||||
| @@ -58,12 +57,12 @@ LD_LIBRARY_PATH="$inst/lib" $MAKE check \ | |||||||
|   || cat-testlogs.sh |   || cat-testlogs.sh | ||||||
| LD_LIBRARY_PATH="$inst/lib" \ | LD_LIBRARY_PATH="$inst/lib" \ | ||||||
|   DISTCHECK_CONFIGURE_FLAGS="--enable-vty-tests --enable-external-tests --enable-werror $CONFIG" \ |   DISTCHECK_CONFIGURE_FLAGS="--enable-vty-tests --enable-external-tests --enable-werror $CONFIG" \ | ||||||
|   $MAKE distcheck \ |   $MAKE $PARALLEL_MAKE distcheck \ | ||||||
|   || cat-testlogs.sh |   || cat-testlogs.sh | ||||||
|  |  | ||||||
| if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then | if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then | ||||||
| 	make -C "$base/doc/manuals" publish | 	make -C "$base/doc/manuals" publish | ||||||
| fi | fi | ||||||
|  |  | ||||||
| $MAKE maintainer-clean | $MAKE $PARALLEL_MAKE maintainer-clean | ||||||
| osmo-clean-workspace.sh | osmo-clean-workspace.sh | ||||||
|   | |||||||
| @@ -1,90 +0,0 @@ | |||||||
| # |  | ||||||
| # spec file for package osmo-smlc |  | ||||||
| # |  | ||||||
| # Copyright (c) 2017, Martin Hauke <mardnh@gmx.de> |  | ||||||
| # |  | ||||||
| # All modifications and additions to the file contributed by third parties |  | ||||||
| # remain the property of their copyright owners, unless otherwise agreed |  | ||||||
| # upon. The license for this file, and modifications and additions to the |  | ||||||
| # file, is the same license as for the pristine package itself (unless the |  | ||||||
| # license for the pristine package is not an Open Source License, in which |  | ||||||
| # case the license is the MIT License). An "Open Source License" is a |  | ||||||
| # license that conforms to the Open Source Definition (Version 1.9) |  | ||||||
| # published by the Open Source Initiative. |  | ||||||
|  |  | ||||||
| ## Disable LTO for now since it breaks compilation of the tests |  | ||||||
| ## https://osmocom.org/issues/4113 |  | ||||||
| %define _lto_cflags %{nil} |  | ||||||
|  |  | ||||||
| Name:           osmo-smlc |  | ||||||
| Version:        @VERSION@ |  | ||||||
| Release:        0 |  | ||||||
| Summary:        OsmoSMLC: Osmocom's Location Service Center |  | ||||||
| License:        AGPL-3.0-or-later |  | ||||||
| Group:          Hardware/Mobile |  | ||||||
| URL:            https://osmocom.org/projects/osmo-smlc |  | ||||||
| Source:         %{name}-%{version}.tar.xz |  | ||||||
| BuildRequires:  autoconf |  | ||||||
| BuildRequires:  autoconf-archive |  | ||||||
| BuildRequires:  automake >= 1.9 |  | ||||||
| BuildRequires:  libtool >= 2 |  | ||||||
| BuildRequires:  pkgconfig >= 0.20 |  | ||||||
| %if 0%{?suse_version} |  | ||||||
| BuildRequires:  systemd-rpm-macros |  | ||||||
| %endif |  | ||||||
| BuildRequires:  pkgconfig(libosmo-netif) >= 1.1.0 |  | ||||||
| BuildRequires:  pkgconfig(libosmo-sccp) >= 1.5.0 |  | ||||||
| BuildRequires:  pkgconfig(libosmo-sigtran) >= 1.5.0 |  | ||||||
| BuildRequires:  pkgconfig(libosmocore) >= 1.6.0 |  | ||||||
| BuildRequires:  pkgconfig(libosmoctrl) >= 1.6.0 |  | ||||||
| BuildRequires:  pkgconfig(libosmogsm) >= 1.6.0 |  | ||||||
| BuildRequires:  pkgconfig(libosmovty) >= 1.6.0 |  | ||||||
| BuildRequires:  pkgconfig(talloc) |  | ||||||
| %{?systemd_requires} |  | ||||||
|  |  | ||||||
| %description |  | ||||||
| OsmoBSC: Osmocom's Base Station Controller for 2G circuit-switched mobile networks. |  | ||||||
|  |  | ||||||
| %prep |  | ||||||
| %setup -q |  | ||||||
|  |  | ||||||
| %build |  | ||||||
| echo "%{version}" >.tarball-version |  | ||||||
| autoreconf -fi |  | ||||||
| %configure \ |  | ||||||
|   --docdir=%{_docdir}/%{name} \ |  | ||||||
|   --with-systemdsystemunitdir=%{_unitdir} |  | ||||||
| make %{?_smp_mflags} |  | ||||||
|  |  | ||||||
| %install |  | ||||||
| %make_install |  | ||||||
|  |  | ||||||
| %if 0%{?suse_version} |  | ||||||
| %preun |  | ||||||
| %service_del_preun %{name}.service |  | ||||||
|  |  | ||||||
| %postun |  | ||||||
| %service_del_postun %{name}.service |  | ||||||
|  |  | ||||||
| %pre |  | ||||||
| %service_add_pre %{name}.service |  | ||||||
|  |  | ||||||
| %post |  | ||||||
| %service_add_post %{name}.service |  | ||||||
| %endif |  | ||||||
|  |  | ||||||
| %check |  | ||||||
| make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +) |  | ||||||
|  |  | ||||||
| %files |  | ||||||
| %license COPYING |  | ||||||
| %doc AUTHORS README |  | ||||||
| %{_bindir}/osmo-smlc |  | ||||||
| %dir %{_docdir}/%{name}/examples |  | ||||||
| %dir %{_docdir}/%{name}/examples/osmo-smlc |  | ||||||
| %{_docdir}/%{name}/examples/osmo-smlc/osmo-smlc.cfg |  | ||||||
| %dir %{_sysconfdir}/osmocom |  | ||||||
| %config(noreplace) %{_sysconfdir}/osmocom/osmo-smlc.cfg |  | ||||||
| %{_unitdir}/%{name}.service |  | ||||||
|  |  | ||||||
| %changelog |  | ||||||
| @@ -1,9 +1,15 @@ | |||||||
| [Unit] | [Unit] | ||||||
| Description=Osmocom Serving Mobile Location Center (SMLC) | Description=Osmocom Serving Mobile Location Center (SMLC) | ||||||
|  | After=network-online.target | ||||||
|  | Wants=network-online.target | ||||||
|  |  | ||||||
| [Service] | [Service] | ||||||
| Type=simple | Type=simple | ||||||
| Restart=always | Restart=always | ||||||
|  | StateDirectory=osmocom | ||||||
|  | WorkingDirectory=%S/osmocom | ||||||
|  | User=osmocom | ||||||
|  | Group=osmocom | ||||||
| ExecStart=/usr/bin/osmo-smlc -c /etc/osmocom/osmo-smlc.cfg | ExecStart=/usr/bin/osmo-smlc -c /etc/osmocom/osmo-smlc.cfg | ||||||
| RestartSec=2 | RestartSec=2 | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										96
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										96
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							| @@ -1,3 +1,99 @@ | |||||||
|  | osmo-smlc (0.3.2) unstable; urgency=medium | ||||||
|  |  | ||||||
|  |   [ Oliver Smith ] | ||||||
|  |   * contrib/jenkins: libosmo-abis after libosmo-netif | ||||||
|  |  | ||||||
|  |   [ Pau Espin Pedrol ] | ||||||
|  |   * jenkins.sh: Skip building unneeded libosmo-abis | ||||||
|  |   * jenkins.sh: No need to build libosmo-sigtran with doxygen | ||||||
|  |   * Add missing required vty go_parent_cb for libosmo-sigtran | ||||||
|  |  | ||||||
|  |  -- Oliver Smith <osmith@sysmocom.de>  Wed, 05 Mar 2025 11:35:11 +0100 | ||||||
|  |  | ||||||
|  | osmo-smlc (0.3.1) unstable; urgency=medium | ||||||
|  |  | ||||||
|  |   [ Harald Welte ] | ||||||
|  |   * remove libosmo-sccp dependency; depend on libosmo-sigtran only | ||||||
|  |  | ||||||
|  |   [ Oliver Smith ] | ||||||
|  |   * contrib/jenkins: libosmo-sccp -> libosmo-sigtran | ||||||
|  |  | ||||||
|  |  -- Oliver Smith <osmith@sysmocom.de>  Mon, 16 Sep 2024 12:26:33 +0200 | ||||||
|  |  | ||||||
|  | osmo-smlc (0.3.0) unstable; urgency=medium | ||||||
|  |  | ||||||
|  |   [ Andreas Eversberg ] | ||||||
|  |   * Use uniform log format for default config files | ||||||
|  |  | ||||||
|  |   [ Vadim Yanitskiy ] | ||||||
|  |   * build: include README.md into the release tarball | ||||||
|  |   * README.md: cosmetic: fix a typo | ||||||
|  |  | ||||||
|  |   [ Max ] | ||||||
|  |   * .deb/.rpm: add osmocom user during package install | ||||||
|  |  | ||||||
|  |   [ Oliver Smith ] | ||||||
|  |   * .deb/.rpm: various fixes related to non-root | ||||||
|  |   * contrib: remove rpm spec file | ||||||
|  |   * debian/postinst: add checks, be verbose | ||||||
|  |  | ||||||
|  |  -- Oliver Smith <osmith@sysmocom.de>  Thu, 25 Jul 2024 09:49:50 +0200 | ||||||
|  |  | ||||||
|  | osmo-smlc (0.2.4) unstable; urgency=medium | ||||||
|  |  | ||||||
|  |   [ arehbein ] | ||||||
|  |   * Transition to use of 'telnet_init_default' | ||||||
|  |  | ||||||
|  |   [ Vadim Yanitskiy ] | ||||||
|  |   * configure.ac: set -std=gnu11 | ||||||
|  |   * Makefile.am: remove $(COVERAGE_LDFLAGS) from osmo_smlc_LDADD | ||||||
|  |   * Makefile.am: remove unneeded AM_LDFLAGS with LIBS | ||||||
|  |   * tests: $(BUILT_SOURCES) is not defined, depend on osmo-smlc | ||||||
|  |   * tests: execute osmotest{vty,config}.py against osmo-smlc | ||||||
|  |   * copyright: fix typo: sysmocom s/s.m.f.c./s.f.m.c./ GmbH | ||||||
|  |   * configure.ac: migrate from python2 to python3 | ||||||
|  |  | ||||||
|  |   [ Oliver Smith ] | ||||||
|  |   * debian: set compat level to 10 | ||||||
|  |   * systemd: depend on networking-online.target | ||||||
|  |  | ||||||
|  |   [ Neels Janosch Hofmeyr ] | ||||||
|  |   * ctrl-test: drop bogus 'rm -f $(CTRL_TEST_DB)' | ||||||
|  |  | ||||||
|  |   [ Pau Espin Pedrol ] | ||||||
|  |   * Write explicit role & sctp-role fields in ASP configurations | ||||||
|  |  | ||||||
|  |  -- Pau Espin Pedrol <pespin@sysmocom.de>  Tue, 12 Sep 2023 17:14:41 +0200 | ||||||
|  |  | ||||||
|  | osmo-smlc (0.2.3) unstable; urgency=medium | ||||||
|  |  | ||||||
|  |   [ Vadim Yanitskiy ] | ||||||
|  |   * contrib/jenkins.sh: execute distcheck/maintainer-clean with $PARALLEL_MAKE | ||||||
|  |  | ||||||
|  |   [ Max ] | ||||||
|  |   * Add git-review config | ||||||
|  |   * Set working directory in systemd service file | ||||||
|  |   * ctrl: take both address and port from vty config | ||||||
|  |  | ||||||
|  |  -- Pau Espin Pedrol <pespin@sysmocom.de>  Tue, 07 Feb 2023 17:42:00 +0100 | ||||||
|  |  | ||||||
|  | osmo-smlc (0.2.2) unstable; urgency=medium | ||||||
|  |  | ||||||
|  |   [ Oliver Smith ] | ||||||
|  |   * treewide: remove FSF address | ||||||
|  |  | ||||||
|  |   [ Pau Espin Pedrol ] | ||||||
|  |   * deb/rpm packaging: Drop dependency on autoconf-archive | ||||||
|  |  | ||||||
|  |   [ Vadim Yanitskiy ] | ||||||
|  |   * tests: use 'check_PROGRAMS' instead of 'noinst_PROGRAMS' | ||||||
|  |  | ||||||
|  |   [ Harald Welte ] | ||||||
|  |   * update git URLs (git -> https; gitea) | ||||||
|  |   * Fill README with content; convert to markdown | ||||||
|  |  | ||||||
|  |  -- Pau Espin Pedrol <pespin@sysmocom.de>  Wed, 29 Jun 2022 12:21:06 +0200 | ||||||
|  |  | ||||||
| osmo-smlc (0.2.1) unstable; urgency=medium | osmo-smlc (0.2.1) unstable; urgency=medium | ||||||
|  |  | ||||||
|   [ Pau Espin Pedrol ] |   [ Pau Espin Pedrol ] | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								debian/compat
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								debian/compat
									
									
									
									
										vendored
									
									
								
							| @@ -1 +1 @@ | |||||||
| 9 | 10 | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							| @@ -2,23 +2,21 @@ Source: osmo-smlc | |||||||
| Section: net | Section: net | ||||||
| Priority: extra | Priority: extra | ||||||
| Maintainer: Osmocom team <openbsc@lists.osmocom.org> | Maintainer: Osmocom team <openbsc@lists.osmocom.org> | ||||||
| Build-Depends: debhelper (>=9), | Build-Depends: debhelper (>= 10), | ||||||
|                dh-autoreconf, |                dh-autoreconf, | ||||||
|                autotools-dev, |                autotools-dev, | ||||||
|                autoconf, |                autoconf, | ||||||
|                autoconf-archive, |  | ||||||
|                automake, |                automake, | ||||||
|                libtool, |                libtool, | ||||||
|                pkg-config, |                pkg-config, | ||||||
|                libsctp-dev, |                libsctp-dev, | ||||||
|                libtalloc-dev, |                libtalloc-dev, | ||||||
|                libosmocore-dev (>= 1.6.0), |                libosmocore-dev (>= 1.10.0), | ||||||
|                libosmo-sccp-dev (>= 1.5.0), |                libosmo-sigtran-dev (>= 2.0.0), | ||||||
|                libosmo-sigtran-dev (>= 1.5.0), |                osmo-gsm-manuals-dev (>= 1.6.0) | ||||||
|                osmo-gsm-manuals-dev (>= 1.2.0) |  | ||||||
| Standards-Version: 3.9.8 | Standards-Version: 3.9.8 | ||||||
| Vcs-Git: git://git.osmocom.org/osmo-smlc.git | Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-smlc | ||||||
| Vcs-Browser: https://git.osmocom.org/osmo-smlc/ | Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-smlc | ||||||
| Homepage: https://osmocom.org/projects/osmo-smlc | Homepage: https://osmocom.org/projects/osmo-smlc | ||||||
|  |  | ||||||
| Package: osmo-smlc | Package: osmo-smlc | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								debian/copyright
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								debian/copyright
									
									
									
									
										vendored
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||||||
| Upstream-Name: osmo-smlc | Upstream-Name: osmo-smlc | ||||||
| Source: git://git.osmocom.org/osmo-smlc | Source: https://gitea.osmocom.org/cellular-infrastructure/osmo-smlc | ||||||
|  |  | ||||||
| Files:     * | Files:     * | ||||||
| Copyright: 2020 Harald Welte <laforge@osmocom.org> | Copyright: 2020 Harald Welte <laforge@osmocom.org> | ||||||
|   | |||||||
							
								
								
									
										38
									
								
								debian/postinst
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										38
									
								
								debian/postinst
									
									
									
									
										vendored
									
									
										Executable file
									
								
							| @@ -0,0 +1,38 @@ | |||||||
|  | #!/bin/sh -e | ||||||
|  | case "$1" in | ||||||
|  | 	configure) | ||||||
|  | 		# Create the osmocom group and user (if it doesn't exist yet) | ||||||
|  | 		if ! getent group osmocom >/dev/null; then | ||||||
|  | 			groupadd --system osmocom | ||||||
|  | 		fi | ||||||
|  | 		if ! getent passwd osmocom >/dev/null; then | ||||||
|  | 			useradd \ | ||||||
|  | 				--system \ | ||||||
|  | 				--gid osmocom \ | ||||||
|  | 				--home-dir /var/lib/osmocom \ | ||||||
|  | 				--shell /sbin/nologin \ | ||||||
|  | 				--comment "Open Source Mobile Communications" \ | ||||||
|  | 				osmocom | ||||||
|  | 		fi | ||||||
|  |  | ||||||
|  | 		# Fix permissions of previous (root-owned) install (OS#4107) | ||||||
|  | 		if dpkg --compare-versions "$2" le "0.3.0"; then | ||||||
|  | 			if [ -e /etc/osmocom/osmo-smlc.cfg ]; then | ||||||
|  | 				chown -v osmocom:osmocom /etc/osmocom/osmo-smlc.cfg | ||||||
|  | 				chmod -v 0660 /etc/osmocom/osmo-smlc.cfg | ||||||
|  | 			fi | ||||||
|  |  | ||||||
|  | 			if [ -d /etc/osmocom ]; then | ||||||
|  | 				chown -v root:osmocom /etc/osmocom | ||||||
|  | 				chmod -v 2775 /etc/osmocom | ||||||
|  | 			fi | ||||||
|  |  | ||||||
|  | 			mkdir -p /var/lib/osmocom | ||||||
|  | 			chown -R -v osmocom:osmocom /var/lib/osmocom | ||||||
|  | 		fi | ||||||
|  | 		;; | ||||||
|  | esac | ||||||
|  |  | ||||||
|  | # dh_installdeb(1) will replace this with shell code automatically | ||||||
|  | # generated by other debhelper scripts. | ||||||
|  | #DEBHELPER# | ||||||
| @@ -1,3 +1,11 @@ | |||||||
|  | log stderr | ||||||
|  |  logging color 1 | ||||||
|  |  logging print category-hex 0 | ||||||
|  |  logging print category 1 | ||||||
|  |  logging timestamp 0 | ||||||
|  |  logging print file basename last | ||||||
|  |  logging print level 1 | ||||||
|  |  | ||||||
| cells | cells | ||||||
|  lac-ci 23 42 lat 12.34567 lon 34.56789 |  lac-ci 23 42 lat 12.34567 lon 34.56789 | ||||||
|  cgi 262 42 17 5 lat 12.34765 lon 34.56987 |  cgi 262 42 17 5 lat 12.34765 lon 34.56987 | ||||||
|   | |||||||
| @@ -74,6 +74,7 @@ cs7 instance 0 | |||||||
|  point-code 1.23.6 |  point-code 1.23.6 | ||||||
|  asp asp-clnt-msc-0 2905 0 m3ua |  asp asp-clnt-msc-0 2905 0 m3ua | ||||||
|   remote-ip 127.0.0.1 |   remote-ip 127.0.0.1 | ||||||
|  |   role asp | ||||||
|   sctp-role client |   sctp-role client | ||||||
| ---- | ---- | ||||||
|  |  | ||||||
|   | |||||||
| @@ -17,17 +17,13 @@ | |||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  * GNU General Public License for more details. |  * GNU General Public License for more details. | ||||||
|  * |  * | ||||||
|  * You should have received a copy of the GNU General Public License along |  | ||||||
|  * with this program; if not, write to the Free Software Foundation, Inc., |  | ||||||
|  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |  | ||||||
|  * |  | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
| #include <stdint.h> | #include <stdint.h> | ||||||
| #include <osmocom/core/linuxlist.h> | #include <osmocom/core/linuxlist.h> | ||||||
| #include <osmocom/sigtran/sccp_sap.h> | #include <osmocom/gsm/gsm0808_utils.h> | ||||||
|  |  | ||||||
| struct osmo_gad; | struct osmo_gad; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,7 @@ | |||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
|  | #include <stdint.h> | ||||||
|  |  | ||||||
| #include <osmocom/core/linuxlist.h> | #include <osmocom/core/linuxlist.h> | ||||||
| #include <osmocom/gsm/gsm0808.h> | #include <osmocom/gsm/gsm0808.h> | ||||||
| #include <osmocom/sigtran/sccp_sap.h> | #include <osmocom/sigtran/sccp_sap.h> | ||||||
| @@ -49,8 +51,8 @@ enum lb_peer_event { | |||||||
| 	LB_PEER_EV_MSG_DOWN_CO, | 	LB_PEER_EV_MSG_DOWN_CO, | ||||||
| 	LB_PEER_EV_RX_RESET, | 	LB_PEER_EV_RX_RESET, | ||||||
| 	LB_PEER_EV_RX_RESET_ACK, | 	LB_PEER_EV_RX_RESET_ACK, | ||||||
| 	LB_PEER_EV_CONNECTION_SUCCESS, | 	LB_PEER_EV_AVAILABLE, | ||||||
| 	LB_PEER_EV_CONNECTION_TIMEOUT, | 	LB_PEER_EV_UNAVAILABLE, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| struct lb_peer_ev_ctx { | struct lb_peer_ev_ctx { | ||||||
| @@ -60,8 +62,8 @@ struct lb_peer_ev_ctx { | |||||||
| }; | }; | ||||||
|  |  | ||||||
| struct lb_peer *lb_peer_find_or_create(struct sccp_lb_inst *sli, const struct osmo_sccp_addr *peer_addr); | struct lb_peer *lb_peer_find_or_create(struct sccp_lb_inst *sli, const struct osmo_sccp_addr *peer_addr); | ||||||
| struct lb_peer *lb_peer_find(struct sccp_lb_inst *sli, const struct osmo_sccp_addr *peer_addr); | struct lb_peer *lb_peer_find(const struct sccp_lb_inst *sli, const struct osmo_sccp_addr *peer_addr); | ||||||
|  | struct lb_peer *lb_peer_find_by_pc(const struct sccp_lb_inst *sli, uint32_t pc); | ||||||
|  |  | ||||||
| int lb_peer_up_l2(struct sccp_lb_inst *sli, const struct osmo_sccp_addr *calling_addr, bool co, uint32_t conn_id, | int lb_peer_up_l2(struct sccp_lb_inst *sli, const struct osmo_sccp_addr *calling_addr, bool co, uint32_t conn_id, | ||||||
| 		  struct msgb *l2); | 		  struct msgb *l2); | ||||||
| void lb_peer_disconnect(struct sccp_lb_inst *sli, uint32_t conn_id); |  | ||||||
|   | |||||||
| @@ -37,6 +37,7 @@ enum smlc_ctrl_node { | |||||||
| 	_LAST_CTRL_NODE_SMLC | 	_LAST_CTRL_NODE_SMLC | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | /* rate_ctr */ | ||||||
| enum { | enum { | ||||||
| 	SMLC_CTR_BSSMAP_LE_RX_UDT_RESET, | 	SMLC_CTR_BSSMAP_LE_RX_UDT_RESET, | ||||||
| 	SMLC_CTR_BSSMAP_LE_RX_UDT_RESET_ACK, | 	SMLC_CTR_BSSMAP_LE_RX_UDT_RESET_ACK, | ||||||
| @@ -58,3 +59,9 @@ enum { | |||||||
| 	SMLC_CTR_BSSMAP_LE_TX_DT1_PERFORM_LOCATION_RESPONSE, | 	SMLC_CTR_BSSMAP_LE_TX_DT1_PERFORM_LOCATION_RESPONSE, | ||||||
| 	SMLC_CTR_BSSMAP_LE_TX_DT1_BSSLAP_TA_REQUEST, | 	SMLC_CTR_BSSMAP_LE_TX_DT1_BSSLAP_TA_REQUEST, | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | /* osmo_stat */ | ||||||
|  | enum { | ||||||
|  | 	SMLC_STAT_LB_PEERS_TOTAL, | ||||||
|  | 	SMLC_STAT_LB_PEERS_ACTIVE, | ||||||
|  | }; | ||||||
|   | |||||||
| @@ -17,10 +17,6 @@ | |||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  * GNU General Public License for more details. |  * GNU General Public License for more details. | ||||||
|  * |  * | ||||||
|  * You should have received a copy of the GNU General Public License along |  | ||||||
|  * with this program; if not, write to the Free Software Foundation, Inc., |  | ||||||
|  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |  | ||||||
|  * |  | ||||||
|  */ |  */ | ||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,3 +5,5 @@ | |||||||
| enum smlc_vty_node { | enum smlc_vty_node { | ||||||
| 	CELLS_NODE = _LAST_OSMOVTY_NODE + 1, | 	CELLS_NODE = _LAST_OSMOVTY_NODE + 1, | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | void smlc_vty_init(struct vty_app_info *vty_app_info); | ||||||
|   | |||||||
| @@ -14,12 +14,6 @@ AM_CFLAGS = \ | |||||||
| 	$(COVERAGE_CFLAGS) \ | 	$(COVERAGE_CFLAGS) \ | ||||||
| 	$(NULL) | 	$(NULL) | ||||||
|  |  | ||||||
| AM_LDFLAGS = \ |  | ||||||
| 	$(LIBOSMOCORE_LIBS) \ |  | ||||||
| 	$(LIBOSMOGSM_LIBS) \ |  | ||||||
| 	$(COVERAGE_LDFLAGS) \ |  | ||||||
| 	$(NULL) |  | ||||||
|  |  | ||||||
| SUBDIRS = \ | SUBDIRS = \ | ||||||
| 	osmo-smlc \ | 	osmo-smlc \ | ||||||
| 	$(NULL) | 	$(NULL) | ||||||
|   | |||||||
| @@ -32,6 +32,7 @@ osmo_smlc_SOURCES = \ | |||||||
| 	smlc_loc_req.c \ | 	smlc_loc_req.c \ | ||||||
| 	smlc_main.c \ | 	smlc_main.c \ | ||||||
| 	smlc_subscr.c \ | 	smlc_subscr.c \ | ||||||
|  | 	smlc_vty.c \ | ||||||
| 	$(NULL) | 	$(NULL) | ||||||
|  |  | ||||||
| osmo_smlc_LDADD = \ | osmo_smlc_LDADD = \ | ||||||
| @@ -39,6 +40,5 @@ osmo_smlc_LDADD = \ | |||||||
| 	$(LIBOSMOGSM_LIBS) \ | 	$(LIBOSMOGSM_LIBS) \ | ||||||
| 	$(LIBOSMOVTY_LIBS) \ | 	$(LIBOSMOVTY_LIBS) \ | ||||||
| 	$(LIBOSMOCTRL_LIBS) \ | 	$(LIBOSMOCTRL_LIBS) \ | ||||||
| 	$(COVERAGE_LDFLAGS) \ |  | ||||||
| 	$(LIBOSMOSIGTRAN_LIBS) \ | 	$(LIBOSMOSIGTRAN_LIBS) \ | ||||||
| 	$(NULL) | 	$(NULL) | ||||||
|   | |||||||
| @@ -17,10 +17,6 @@ | |||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  * GNU General Public License for more details. |  * GNU General Public License for more details. | ||||||
|  * |  * | ||||||
|  * You should have received a copy of the GNU General Public License along |  | ||||||
|  * with this program; if not, write to the Free Software Foundation, Inc., |  | ||||||
|  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |  | ||||||
|  * |  | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include <limits.h> | #include <limits.h> | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| /* SMLC Lb connection implementation */ | /* SMLC Lb connection implementation */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * (C) 2020 by sysmocom s.m.f.c. <info@sysmocom.de> |  * (C) 2020 by sysmocom s.f.m.c. <info@sysmocom.de> | ||||||
|  * All Rights Reserved |  * All Rights Reserved | ||||||
|  * |  * | ||||||
|  * Author: Neels Hofmeyr |  * Author: Neels Hofmeyr | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| /* | /* | ||||||
|  * (C) 2019 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de> |  * (C) 2019-2025 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> | ||||||
|  * All Rights Reserved |  * All Rights Reserved | ||||||
|  * |  * | ||||||
|  * SPDX-License-Identifier: AGPL-3.0+ |  * SPDX-License-Identifier: AGPL-3.0+ | ||||||
| @@ -23,6 +23,7 @@ | |||||||
| #include <osmocom/core/linuxlist.h> | #include <osmocom/core/linuxlist.h> | ||||||
| #include <osmocom/core/logging.h> | #include <osmocom/core/logging.h> | ||||||
| #include <osmocom/core/fsm.h> | #include <osmocom/core/fsm.h> | ||||||
|  | #include <osmocom/core/stat_item.h> | ||||||
| #include <osmocom/gsm/bssmap_le.h> | #include <osmocom/gsm/bssmap_le.h> | ||||||
| #include <osmocom/sigtran/sccp_helpers.h> | #include <osmocom/sigtran/sccp_helpers.h> | ||||||
|  |  | ||||||
| @@ -57,6 +58,7 @@ static struct lb_peer *lb_peer_alloc(struct sccp_lb_inst *sli, const struct osmo | |||||||
| 	fi->priv = lbp; | 	fi->priv = lbp; | ||||||
|  |  | ||||||
| 	llist_add(&lbp->entry, &sli->lb_peers); | 	llist_add(&lbp->entry, &sli->lb_peers); | ||||||
|  | 	osmo_stat_item_inc(osmo_stat_item_group_get_item(g_smlc->statg, SMLC_STAT_LB_PEERS_TOTAL), 1); | ||||||
|  |  | ||||||
| 	return lbp; | 	return lbp; | ||||||
| } | } | ||||||
| @@ -69,7 +71,7 @@ struct lb_peer *lb_peer_find_or_create(struct sccp_lb_inst *sli, const struct os | |||||||
| 	return lb_peer_alloc(sli, peer_addr); | 	return lb_peer_alloc(sli, peer_addr); | ||||||
| } | } | ||||||
|  |  | ||||||
| struct lb_peer *lb_peer_find(struct sccp_lb_inst *sli, const struct osmo_sccp_addr *peer_addr) | struct lb_peer *lb_peer_find(const struct sccp_lb_inst *sli, const struct osmo_sccp_addr *peer_addr) | ||||||
| { | { | ||||||
| 	struct lb_peer *lbp; | 	struct lb_peer *lbp; | ||||||
| 	llist_for_each_entry(lbp, &sli->lb_peers, entry) { | 	llist_for_each_entry(lbp, &sli->lb_peers, entry) { | ||||||
| @@ -80,6 +82,15 @@ struct lb_peer *lb_peer_find(struct sccp_lb_inst *sli, const struct osmo_sccp_ad | |||||||
| 	return NULL; | 	return NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /* Find an lb_peer by its remote SCCP address */ | ||||||
|  | struct lb_peer *lb_peer_find_by_pc(const struct sccp_lb_inst *sli, uint32_t pc) | ||||||
|  | { | ||||||
|  | 	struct osmo_sccp_addr rem_addr; | ||||||
|  |  | ||||||
|  | 	osmo_sccp_make_addr_pc_ssn(&rem_addr, pc, OSMO_SCCP_SSN_BSC_BSSAP_LE); | ||||||
|  | 	return lb_peer_find(sli, &rem_addr); | ||||||
|  | } | ||||||
|  |  | ||||||
| static const struct osmo_tdef_state_timeout lb_peer_fsm_timeouts[32] = { | static const struct osmo_tdef_state_timeout lb_peer_fsm_timeouts[32] = { | ||||||
| 	[LB_PEER_ST_WAIT_RX_RESET_ACK] = { .T = -13 }, | 	[LB_PEER_ST_WAIT_RX_RESET_ACK] = { .T = -13 }, | ||||||
| 	[LB_PEER_ST_DISCARDING] = { .T = -14 }, | 	[LB_PEER_ST_DISCARDING] = { .T = -14 }, | ||||||
| @@ -88,7 +99,7 @@ static const struct osmo_tdef_state_timeout lb_peer_fsm_timeouts[32] = { | |||||||
| #define lb_peer_state_chg(LB_PEER, NEXT_STATE) \ | #define lb_peer_state_chg(LB_PEER, NEXT_STATE) \ | ||||||
| 	osmo_tdef_fsm_inst_state_chg((LB_PEER)->fi, NEXT_STATE, lb_peer_fsm_timeouts, g_smlc_tdefs, 5) | 	osmo_tdef_fsm_inst_state_chg((LB_PEER)->fi, NEXT_STATE, lb_peer_fsm_timeouts, g_smlc_tdefs, 5) | ||||||
|  |  | ||||||
| void lb_peer_discard_all_conns(struct lb_peer *lbp) | static void lb_peer_discard_all_conns(struct lb_peer *lbp) | ||||||
| { | { | ||||||
| 	struct lb_conn *lb_conn, *next; | 	struct lb_conn *lb_conn, *next; | ||||||
|  |  | ||||||
| @@ -137,7 +148,7 @@ static void lb_peer_rx_reset_ack(struct lb_peer *lbp, struct msgb* msg) | |||||||
| 	lb_peer_state_chg(lbp, LB_PEER_ST_READY); | 	lb_peer_state_chg(lbp, LB_PEER_ST_READY); | ||||||
| } | } | ||||||
|  |  | ||||||
| void lb_peer_reset(struct lb_peer *lbp) | static void lb_peer_reset(struct lb_peer *lbp) | ||||||
| { | { | ||||||
| 	struct bssap_le_pdu reset = { | 	struct bssap_le_pdu reset = { | ||||||
| 		.discr = BSSAP_LE_MSG_DISCR_BSSMAP_LE, | 		.discr = BSSAP_LE_MSG_DISCR_BSSMAP_LE, | ||||||
| @@ -167,7 +178,18 @@ void lb_peer_reset(struct lb_peer *lbp) | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| void lb_peer_allstate_action(struct osmo_fsm_inst *fi, uint32_t event, void *data) | static void lb_peer_disconnect(struct sccp_lb_inst *sli, uint32_t conn_id) | ||||||
|  | { | ||||||
|  | 	struct lb_conn *lb_conn; | ||||||
|  | 	llist_for_each_entry(lb_conn, &sli->lb_conns, entry) { | ||||||
|  | 		if (lb_conn->sccp_conn_id == conn_id) { | ||||||
|  | 			lb_conn_discard(lb_conn); | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static void lb_peer_allstate_action(struct osmo_fsm_inst *fi, uint32_t event, void *data) | ||||||
| { | { | ||||||
| 	struct lb_peer *lbp = fi->priv; | 	struct lb_peer *lbp = fi->priv; | ||||||
| 	struct lb_peer_ev_ctx *ctx = data; | 	struct lb_peer_ev_ctx *ctx = data; | ||||||
| @@ -196,7 +218,7 @@ void lb_peer_allstate_action(struct osmo_fsm_inst *fi, uint32_t event, void *dat | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| void lb_peer_st_wait_rx_reset(struct osmo_fsm_inst *fi, uint32_t event, void *data) | static void lb_peer_st_wait_rx_reset(struct osmo_fsm_inst *fi, uint32_t event, void *data) | ||||||
| { | { | ||||||
| 	struct lb_peer *lbp = fi->priv; | 	struct lb_peer *lbp = fi->priv; | ||||||
| 	struct lb_peer_ev_ctx *ctx; | 	struct lb_peer_ev_ctx *ctx; | ||||||
| @@ -224,13 +246,22 @@ void lb_peer_st_wait_rx_reset(struct osmo_fsm_inst *fi, uint32_t event, void *da | |||||||
| 		lb_peer_rx_reset(lbp, msg); | 		lb_peer_rx_reset(lbp, msg); | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
|  | 	case LB_PEER_EV_AVAILABLE: | ||||||
|  | 		/* Send a RESET to the peer. */ | ||||||
|  | 		lb_peer_reset(lbp); | ||||||
|  | 		return; | ||||||
|  |  | ||||||
|  | 	case LB_PEER_EV_UNAVAILABLE: | ||||||
|  | 		/* Do nothing, wait for peer to come up again. */ | ||||||
|  | 		return; | ||||||
|  |  | ||||||
| 	default: | 	default: | ||||||
| 		LOG_LB_PEER(lbp, LOGL_ERROR, "Unhandled event: %s\n", osmo_fsm_event_name(&lb_peer_fsm, event)); | 		LOG_LB_PEER(lbp, LOGL_ERROR, "Unhandled event: %s\n", osmo_fsm_event_name(&lb_peer_fsm, event)); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| void lb_peer_st_wait_rx_reset_ack(struct osmo_fsm_inst *fi, uint32_t event, void *data) | static void lb_peer_st_wait_rx_reset_ack(struct osmo_fsm_inst *fi, uint32_t event, void *data) | ||||||
| { | { | ||||||
| 	struct lb_peer *lbp = fi->priv; | 	struct lb_peer *lbp = fi->priv; | ||||||
| 	struct lb_peer_ev_ctx *ctx; | 	struct lb_peer_ev_ctx *ctx; | ||||||
| @@ -259,13 +290,28 @@ void lb_peer_st_wait_rx_reset_ack(struct osmo_fsm_inst *fi, uint32_t event, void | |||||||
| 		lb_peer_rx_reset(lbp, msg); | 		lb_peer_rx_reset(lbp, msg); | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
|  | 	case LB_PEER_EV_AVAILABLE: | ||||||
|  | 		/* Send a RESET to the peer. */ | ||||||
|  | 		lb_peer_reset(lbp); | ||||||
|  | 		return; | ||||||
|  |  | ||||||
|  | 	case LB_PEER_EV_UNAVAILABLE: | ||||||
|  | 		lb_peer_state_chg(lbp, LB_PEER_ST_WAIT_RX_RESET); | ||||||
|  | 		return; | ||||||
|  |  | ||||||
| 	default: | 	default: | ||||||
| 		LOG_LB_PEER(lbp, LOGL_ERROR, "Unhandled event: %s\n", osmo_fsm_event_name(&lb_peer_fsm, event)); | 		LOG_LB_PEER(lbp, LOGL_ERROR, "Unhandled event: %s\n", osmo_fsm_event_name(&lb_peer_fsm, event)); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| void lb_peer_st_ready(struct osmo_fsm_inst *fi, uint32_t event, void *data) | static void lb_peer_st_ready_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) | ||||||
|  | { | ||||||
|  | 	if (prev_state != LB_PEER_ST_READY) | ||||||
|  | 		osmo_stat_item_inc(osmo_stat_item_group_get_item(g_smlc->statg, SMLC_STAT_LB_PEERS_ACTIVE), 1); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static void lb_peer_st_ready(struct osmo_fsm_inst *fi, uint32_t event, void *data) | ||||||
| { | { | ||||||
| 	struct lb_peer *lbp = fi->priv; | 	struct lb_peer *lbp = fi->priv; | ||||||
| 	struct lb_peer_ev_ctx *ctx; | 	struct lb_peer_ev_ctx *ctx; | ||||||
| @@ -323,12 +369,28 @@ void lb_peer_st_ready(struct osmo_fsm_inst *fi, uint32_t event, void *data) | |||||||
| 		lb_peer_rx_reset(lbp, msg); | 		lb_peer_rx_reset(lbp, msg); | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
|  | 	case LB_PEER_EV_AVAILABLE: | ||||||
|  | 		/* Send a RESET to the peer. */ | ||||||
|  | 		lb_peer_reset(lbp); | ||||||
|  | 		return; | ||||||
|  |  | ||||||
|  | 	case LB_PEER_EV_UNAVAILABLE: | ||||||
|  | 		lb_peer_discard_all_conns(lbp); | ||||||
|  | 		lb_peer_state_chg(lbp, LB_PEER_ST_WAIT_RX_RESET); | ||||||
|  | 		return; | ||||||
|  |  | ||||||
| 	default: | 	default: | ||||||
| 		LOG_LB_PEER(lbp, LOGL_ERROR, "Unhandled event: %s\n", osmo_fsm_event_name(&lb_peer_fsm, event)); | 		LOG_LB_PEER(lbp, LOGL_ERROR, "Unhandled event: %s\n", osmo_fsm_event_name(&lb_peer_fsm, event)); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static void lb_peer_st_ready_onleave(struct osmo_fsm_inst *fi, uint32_t next_state) | ||||||
|  | { | ||||||
|  | 	if (next_state != LB_PEER_ST_READY) | ||||||
|  | 		osmo_stat_item_dec(osmo_stat_item_group_get_item(g_smlc->statg, SMLC_STAT_LB_PEERS_ACTIVE), 1); | ||||||
|  | } | ||||||
|  |  | ||||||
| static int lb_peer_fsm_timer_cb(struct osmo_fsm_inst *fi) | static int lb_peer_fsm_timer_cb(struct osmo_fsm_inst *fi) | ||||||
| { | { | ||||||
| 	struct lb_peer *lbp = fi->priv; | 	struct lb_peer *lbp = fi->priv; | ||||||
| @@ -336,10 +398,17 @@ static int lb_peer_fsm_timer_cb(struct osmo_fsm_inst *fi) | |||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| void lb_peer_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause) | /* struct lb_peer destructor: */ | ||||||
|  | static void lb_peer_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause) | ||||||
| { | { | ||||||
| 	struct lb_peer *lbp = fi->priv; | 	struct lb_peer *lbp = fi->priv; | ||||||
|  |  | ||||||
| 	lb_peer_discard_all_conns(lbp); | 	lb_peer_discard_all_conns(lbp); | ||||||
|  |  | ||||||
|  | 	if (lbp->fi->state == LB_PEER_ST_READY) | ||||||
|  | 		osmo_stat_item_dec(osmo_stat_item_group_get_item(g_smlc->statg, SMLC_STAT_LB_PEERS_ACTIVE), 1); | ||||||
|  | 	osmo_stat_item_dec(osmo_stat_item_group_get_item(g_smlc->statg, SMLC_STAT_LB_PEERS_TOTAL), 1); | ||||||
|  |  | ||||||
| 	llist_del(&lbp->entry); | 	llist_del(&lbp->entry); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -352,8 +421,8 @@ static const struct value_string lb_peer_fsm_event_names[] = { | |||||||
| 	OSMO_VALUE_STRING(LB_PEER_EV_MSG_DOWN_CO), | 	OSMO_VALUE_STRING(LB_PEER_EV_MSG_DOWN_CO), | ||||||
| 	OSMO_VALUE_STRING(LB_PEER_EV_RX_RESET), | 	OSMO_VALUE_STRING(LB_PEER_EV_RX_RESET), | ||||||
| 	OSMO_VALUE_STRING(LB_PEER_EV_RX_RESET_ACK), | 	OSMO_VALUE_STRING(LB_PEER_EV_RX_RESET_ACK), | ||||||
| 	OSMO_VALUE_STRING(LB_PEER_EV_CONNECTION_SUCCESS), | 	OSMO_VALUE_STRING(LB_PEER_EV_AVAILABLE), | ||||||
| 	OSMO_VALUE_STRING(LB_PEER_EV_CONNECTION_TIMEOUT), | 	OSMO_VALUE_STRING(LB_PEER_EV_UNAVAILABLE), | ||||||
| 	{} | 	{} | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -367,7 +436,8 @@ static const struct osmo_fsm_state lb_peer_fsm_states[] = { | |||||||
| 			| S(LB_PEER_EV_RX_RESET) | 			| S(LB_PEER_EV_RX_RESET) | ||||||
| 			| S(LB_PEER_EV_MSG_UP_CO_INITIAL) | 			| S(LB_PEER_EV_MSG_UP_CO_INITIAL) | ||||||
| 			| S(LB_PEER_EV_MSG_UP_CO) | 			| S(LB_PEER_EV_MSG_UP_CO) | ||||||
| 			| S(LB_PEER_EV_CONNECTION_TIMEOUT) | 			| S(LB_PEER_EV_AVAILABLE) | ||||||
|  | 			| S(LB_PEER_EV_UNAVAILABLE) | ||||||
| 			, | 			, | ||||||
| 		.out_state_mask = 0 | 		.out_state_mask = 0 | ||||||
| 			| S(LB_PEER_ST_WAIT_RX_RESET) | 			| S(LB_PEER_ST_WAIT_RX_RESET) | ||||||
| @@ -384,7 +454,8 @@ static const struct osmo_fsm_state lb_peer_fsm_states[] = { | |||||||
| 			| S(LB_PEER_EV_RX_RESET_ACK) | 			| S(LB_PEER_EV_RX_RESET_ACK) | ||||||
| 			| S(LB_PEER_EV_MSG_UP_CO_INITIAL) | 			| S(LB_PEER_EV_MSG_UP_CO_INITIAL) | ||||||
| 			| S(LB_PEER_EV_MSG_UP_CO) | 			| S(LB_PEER_EV_MSG_UP_CO) | ||||||
| 			| S(LB_PEER_EV_CONNECTION_TIMEOUT) | 			| S(LB_PEER_EV_AVAILABLE) | ||||||
|  | 			| S(LB_PEER_EV_UNAVAILABLE) | ||||||
| 			, | 			, | ||||||
| 		.out_state_mask = 0 | 		.out_state_mask = 0 | ||||||
| 			| S(LB_PEER_ST_WAIT_RX_RESET) | 			| S(LB_PEER_ST_WAIT_RX_RESET) | ||||||
| @@ -396,6 +467,8 @@ static const struct osmo_fsm_state lb_peer_fsm_states[] = { | |||||||
| 	[LB_PEER_ST_READY] = { | 	[LB_PEER_ST_READY] = { | ||||||
| 		.name = "READY", | 		.name = "READY", | ||||||
| 		.action = lb_peer_st_ready, | 		.action = lb_peer_st_ready, | ||||||
|  | 		.onenter = lb_peer_st_ready_onenter, | ||||||
|  | 		.onleave = lb_peer_st_ready_onleave, | ||||||
| 		.in_event_mask = 0 | 		.in_event_mask = 0 | ||||||
| 			| S(LB_PEER_EV_RX_RESET) | 			| S(LB_PEER_EV_RX_RESET) | ||||||
| 			| S(LB_PEER_EV_MSG_UP_CO_INITIAL) | 			| S(LB_PEER_EV_MSG_UP_CO_INITIAL) | ||||||
| @@ -403,6 +476,8 @@ static const struct osmo_fsm_state lb_peer_fsm_states[] = { | |||||||
| 			| S(LB_PEER_EV_MSG_DOWN_CO_INITIAL) | 			| S(LB_PEER_EV_MSG_DOWN_CO_INITIAL) | ||||||
| 			| S(LB_PEER_EV_MSG_DOWN_CO) | 			| S(LB_PEER_EV_MSG_DOWN_CO) | ||||||
| 			| S(LB_PEER_EV_MSG_DOWN_CL) | 			| S(LB_PEER_EV_MSG_DOWN_CL) | ||||||
|  | 			| S(LB_PEER_EV_AVAILABLE) | ||||||
|  | 			| S(LB_PEER_EV_UNAVAILABLE) | ||||||
| 			, | 			, | ||||||
| 		.out_state_mask = 0 | 		.out_state_mask = 0 | ||||||
| 			| S(LB_PEER_ST_WAIT_RX_RESET) | 			| S(LB_PEER_ST_WAIT_RX_RESET) | ||||||
| @@ -482,14 +557,3 @@ int lb_peer_up_l2(struct sccp_lb_inst *sli, const struct osmo_sccp_addr *calling | |||||||
|  |  | ||||||
| 	return osmo_fsm_inst_dispatch(lb_peer->fi, event, &ctx); | 	return osmo_fsm_inst_dispatch(lb_peer->fi, event, &ctx); | ||||||
| } | } | ||||||
|  |  | ||||||
| void lb_peer_disconnect(struct sccp_lb_inst *sli, uint32_t conn_id) |  | ||||||
| { |  | ||||||
| 	struct lb_conn *lb_conn; |  | ||||||
| 	llist_for_each_entry(lb_conn, &sli->lb_conns, entry) { |  | ||||||
| 		if (lb_conn->sccp_conn_id == conn_id) { |  | ||||||
| 			lb_conn_discard(lb_conn); |  | ||||||
| 			return; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| /* | /* | ||||||
|  * (C) 2020 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de> |  * (C) 2020-2025 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> | ||||||
|  * All Rights Reserved |  * All Rights Reserved | ||||||
|  * |  * | ||||||
|  * SPDX-License-Identifier: AGPL-3.0+ |  * SPDX-License-Identifier: AGPL-3.0+ | ||||||
| @@ -85,6 +85,126 @@ struct sccp_lb_inst *sccp_lb_init(void *talloc_ctx, struct osmo_sccp_instance *s | |||||||
| 	return sli; | 	return sli; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static void handle_notice_ind(struct sccp_lb_inst *sli, const struct osmo_scu_notice_param *ni) | ||||||
|  | { | ||||||
|  | 	struct lb_peer *lbp; | ||||||
|  |  | ||||||
|  | 	lbp = lb_peer_find(sli, &ni->calling_addr); | ||||||
|  | 	if (!lbp) { | ||||||
|  | 		LOG_SCCP_LB(sli, LOGL_DEBUG, "(calling_addr=%s) N-NOTICE.ind cause=%u='%s' importance=%u didn't match any lb_peer, ignoring\n", | ||||||
|  | 			    osmo_sccp_addr_dump(&ni->calling_addr), | ||||||
|  | 			    ni->cause, osmo_sccp_return_cause_name(ni->cause), | ||||||
|  | 			    ni->importance); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	LOG_LB_PEER(lbp, LOGL_NOTICE, "N-NOTICE.ind cause=%u='%s' importance=%u\n", | ||||||
|  | 		     ni->cause, osmo_sccp_return_cause_name(ni->cause), | ||||||
|  | 		     ni->importance); | ||||||
|  |  | ||||||
|  | 	switch (ni->cause) { | ||||||
|  | 	case SCCP_RETURN_CAUSE_SUBSYSTEM_CONGESTION: | ||||||
|  | 	case SCCP_RETURN_CAUSE_NETWORK_CONGESTION: | ||||||
|  | 		/* Transient failures (hopefully), keep going. */ | ||||||
|  | 		return; | ||||||
|  | 	default: | ||||||
|  | 		break; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/* Messages are not arriving to lb_peer. Signal it is unavailable to update local state. */ | ||||||
|  | 	osmo_fsm_inst_dispatch(lbp->fi, LB_PEER_EV_UNAVAILABLE, NULL); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static void handle_pcstate_ind(struct sccp_lb_inst *sli, const struct osmo_scu_pcstate_param *pcst) | ||||||
|  | { | ||||||
|  | 	struct osmo_ss7_instance *cs7 = osmo_sccp_get_ss7(sli->sccp); | ||||||
|  | 	struct lb_peer *lbp; | ||||||
|  | 	bool connected; | ||||||
|  | 	bool disconnected; | ||||||
|  |  | ||||||
|  | 	LOG_SCCP_LB(sli, LOGL_DEBUG, "N-PCSTATE ind: affected_pc=%u=%s sp_status=%s remote_sccp_status=%s\n", | ||||||
|  | 		    pcst->affected_pc, osmo_ss7_pointcode_print(cs7, pcst->affected_pc), | ||||||
|  | 		    osmo_sccp_sp_status_name(pcst->sp_status), | ||||||
|  | 		    osmo_sccp_rem_sccp_status_name(pcst->remote_sccp_status)); | ||||||
|  |  | ||||||
|  | 	/* If we don't care about that point-code, ignore PCSTATE. */ | ||||||
|  | 	lbp = lb_peer_find_by_pc(sli, pcst->affected_pc); | ||||||
|  | 	if (!lbp) { | ||||||
|  | 		LOG_SCCP_LB(sli, LOGL_DEBUG, "No lb_peer found under pc=%u=%s\n", | ||||||
|  | 			    pcst->affected_pc, osmo_ss7_pointcode_print(cs7, pcst->affected_pc)); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/* See if this marks the point code to have become available, or to have been lost. | ||||||
|  | 	 * | ||||||
|  | 	 * I want to detect two events: | ||||||
|  | 	 * - connection event (both indicators say PC is reachable). | ||||||
|  | 	 * - disconnection event (at least one indicator says the PC is not reachable). | ||||||
|  | 	 * | ||||||
|  | 	 * There are two separate incoming indicators with various possible values -- the incoming events can be: | ||||||
|  | 	 * | ||||||
|  | 	 * - neither connection nor disconnection indicated -- just indicating congestion | ||||||
|  | 	 *   connected == false, disconnected == false --> do nothing. | ||||||
|  | 	 * - both incoming values indicate that we are connected | ||||||
|  | 	 *   --> trigger connected | ||||||
|  | 	 * - both indicate we are disconnected | ||||||
|  | 	 *   --> trigger disconnected | ||||||
|  | 	 * - one value indicates 'connected', the other indicates 'disconnected' | ||||||
|  | 	 *   --> trigger disconnected | ||||||
|  | 	 * | ||||||
|  | 	 * Congestion could imply that we're connected, but it does not indicate that a PC's reachability changed, so no need to | ||||||
|  | 	 * trigger on that. | ||||||
|  | 	 */ | ||||||
|  | 	connected = false; | ||||||
|  | 	disconnected = false; | ||||||
|  |  | ||||||
|  | 	switch (pcst->sp_status) { | ||||||
|  | 	case OSMO_SCCP_SP_S_ACCESSIBLE: | ||||||
|  | 		connected = true; | ||||||
|  | 		break; | ||||||
|  | 	case OSMO_SCCP_SP_S_INACCESSIBLE: | ||||||
|  | 		disconnected = true; | ||||||
|  | 		break; | ||||||
|  | 	default: | ||||||
|  | 	case OSMO_SCCP_SP_S_CONGESTED: | ||||||
|  | 		/* Neither connecting nor disconnecting */ | ||||||
|  | 		break; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	switch (pcst->remote_sccp_status) { | ||||||
|  | 	case OSMO_SCCP_REM_SCCP_S_AVAILABLE: | ||||||
|  | 		if (!disconnected) | ||||||
|  | 			connected = true; | ||||||
|  | 		break; | ||||||
|  | 	case OSMO_SCCP_REM_SCCP_S_UNAVAILABLE_UNKNOWN: | ||||||
|  | 	case OSMO_SCCP_REM_SCCP_S_UNEQUIPPED: | ||||||
|  | 	case OSMO_SCCP_REM_SCCP_S_INACCESSIBLE: | ||||||
|  | 		disconnected = true; | ||||||
|  | 		connected = false; | ||||||
|  | 		break; | ||||||
|  | 	default: | ||||||
|  | 	case OSMO_SCCP_REM_SCCP_S_CONGESTED: | ||||||
|  | 		/* Neither connecting nor disconnecting */ | ||||||
|  | 		break; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if (disconnected) { | ||||||
|  | 		LOG_SCCP_LB(sli, LOGL_NOTICE, | ||||||
|  | 			    "now unreachable: N-PCSTATE ind: pc=%u=%s sp_status=%s remote_sccp_status=%s\n", | ||||||
|  | 			    pcst->affected_pc, osmo_ss7_pointcode_print(cs7, pcst->affected_pc), | ||||||
|  | 			    osmo_sccp_sp_status_name(pcst->sp_status), | ||||||
|  | 			    osmo_sccp_rem_sccp_status_name(pcst->remote_sccp_status)); | ||||||
|  | 		osmo_fsm_inst_dispatch(lbp->fi, LB_PEER_EV_UNAVAILABLE, NULL); | ||||||
|  | 	} else if (connected) { | ||||||
|  | 		LOG_SCCP_LB(sli, LOGL_NOTICE, | ||||||
|  | 			    "now available: N-PCSTATE ind: pc=%u=%s sp_status=%s remote_sccp_status=%s\n", | ||||||
|  | 			    pcst->affected_pc, osmo_ss7_pointcode_print(cs7, pcst->affected_pc), | ||||||
|  | 			    osmo_sccp_sp_status_name(pcst->sp_status), | ||||||
|  | 			    osmo_sccp_rem_sccp_status_name(pcst->remote_sccp_status)); | ||||||
|  | 		osmo_fsm_inst_dispatch(lbp->fi, LB_PEER_EV_AVAILABLE, NULL); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
| static int sccp_lb_sap_up(struct osmo_prim_hdr *oph, void *_scu) | static int sccp_lb_sap_up(struct osmo_prim_hdr *oph, void *_scu) | ||||||
| { | { | ||||||
| 	struct osmo_sccp_user *scu = _scu; | 	struct osmo_sccp_user *scu = _scu; | ||||||
| @@ -163,6 +283,24 @@ static int sccp_lb_sap_up(struct osmo_prim_hdr *oph, void *_scu) | |||||||
| 		rc = lb_peer_up_l2(sli, peer_addr, false, 0, oph->msg); | 		rc = lb_peer_up_l2(sli, peer_addr, false, 0, oph->msg); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
|  | 	case OSMO_PRIM(OSMO_SCU_PRIM_N_NOTICE, PRIM_OP_INDICATION): | ||||||
|  | 		handle_notice_ind(sli, &prim->u.notice); | ||||||
|  | 		rc = 0; | ||||||
|  | 		break; | ||||||
|  |  | ||||||
|  | 	case OSMO_PRIM(OSMO_SCU_PRIM_N_PCSTATE, PRIM_OP_INDICATION): | ||||||
|  | 		handle_pcstate_ind(sli, &prim->u.pcstate); | ||||||
|  | 		rc = 0; | ||||||
|  | 		break; | ||||||
|  |  | ||||||
|  | 	case OSMO_PRIM(OSMO_SCU_PRIM_N_STATE, PRIM_OP_INDICATION): | ||||||
|  | 		LOG_SCCP_LB(sli, LOGL_INFO, | ||||||
|  | 			    "SCCP-User-SAP: Ignoring %s.%s\n", | ||||||
|  | 			    osmo_scu_prim_type_name(oph->primitive), | ||||||
|  | 			    get_value_string(osmo_prim_op_names, oph->operation)); | ||||||
|  | 		rc = 0; | ||||||
|  | 		break; | ||||||
|  |  | ||||||
| 	default: | 	default: | ||||||
| 		LOG_SCCP_LB_CL(sli, NULL, LOGL_ERROR, "%s(%s) unsupported\n", __func__, osmo_scu_prim_name(oph)); | 		LOG_SCCP_LB_CL(sli, NULL, LOGL_ERROR, "%s(%s) unsupported\n", __func__, osmo_scu_prim_name(oph)); | ||||||
| 		rc = -1; | 		rc = -1; | ||||||
|   | |||||||
| @@ -54,6 +54,19 @@ static const struct rate_ctr_group_desc smlc_ctrg_desc = { | |||||||
| 	smlc_ctr_description, | 	smlc_ctr_description, | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | static const struct osmo_stat_item_desc smlc_stat_item_description[] = { | ||||||
|  | 	[SMLC_STAT_LB_PEERS_TOTAL]	= { "lb_peers.total", "Total Lb peers seen since startup", OSMO_STAT_ITEM_NO_UNIT, 4, 0}, | ||||||
|  | 	[SMLC_STAT_LB_PEERS_ACTIVE]	= { "lb_peers.active", "Currently active Lb peers", OSMO_STAT_ITEM_NO_UNIT, 4, 0}, | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | static const struct osmo_stat_item_group_desc smlc_statg_desc = { | ||||||
|  | 	"smlc", | ||||||
|  | 	"serving mobile location center", | ||||||
|  | 	OSMO_STATS_CLASS_GLOBAL, | ||||||
|  | 	ARRAY_SIZE(smlc_stat_item_description), | ||||||
|  | 	smlc_stat_item_description, | ||||||
|  | }; | ||||||
|  |  | ||||||
| struct smlc_state *smlc_state_alloc(void *ctx) | struct smlc_state *smlc_state_alloc(void *ctx) | ||||||
| { | { | ||||||
| 	struct smlc_state *smlc = talloc_zero(ctx, struct smlc_state); | 	struct smlc_state *smlc = talloc_zero(ctx, struct smlc_state); | ||||||
| @@ -61,5 +74,14 @@ struct smlc_state *smlc_state_alloc(void *ctx) | |||||||
| 	INIT_LLIST_HEAD(&smlc->subscribers); | 	INIT_LLIST_HEAD(&smlc->subscribers); | ||||||
| 	INIT_LLIST_HEAD(&smlc->cell_locations); | 	INIT_LLIST_HEAD(&smlc->cell_locations); | ||||||
| 	smlc->ctrs = rate_ctr_group_alloc(smlc, &smlc_ctrg_desc, 0); | 	smlc->ctrs = rate_ctr_group_alloc(smlc, &smlc_ctrg_desc, 0); | ||||||
|  |  | ||||||
|  | 	smlc->statg = osmo_stat_item_group_alloc(smlc, &smlc_statg_desc, 0); | ||||||
|  | 	if (!smlc->statg) | ||||||
|  | 		goto ret_free; | ||||||
| 	return smlc; | 	return smlc; | ||||||
|  |  | ||||||
|  | ret_free: | ||||||
|  | 	rate_ctr_group_free(smlc->ctrs); | ||||||
|  | 	talloc_free(smlc); | ||||||
|  | 	return NULL; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -17,10 +17,6 @@ | |||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  * GNU General Public License for more details. |  * GNU General Public License for more details. | ||||||
|  * |  * | ||||||
|  * You should have received a copy of the GNU General Public License along |  | ||||||
|  * with this program; if not, write to the Free Software Foundation, Inc., |  | ||||||
|  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |  | ||||||
|  * |  | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include <osmocom/smlc/smlc_data.h> | #include <osmocom/smlc/smlc_data.h> | ||||||
|   | |||||||
| @@ -19,7 +19,6 @@ | |||||||
| #include <osmocom/ctrl/control_cmd.h> | #include <osmocom/ctrl/control_cmd.h> | ||||||
| #include <osmocom/ctrl/control_if.h> | #include <osmocom/ctrl/control_if.h> | ||||||
| #include <osmocom/ctrl/ports.h> | #include <osmocom/ctrl/ports.h> | ||||||
| #include <osmocom/ctrl/control_vty.h> |  | ||||||
|  |  | ||||||
| #include <osmocom/core/application.h> | #include <osmocom/core/application.h> | ||||||
| #include <osmocom/core/linuxlist.h> | #include <osmocom/core/linuxlist.h> | ||||||
| @@ -29,17 +28,15 @@ | |||||||
| #include <osmocom/core/rate_ctr.h> | #include <osmocom/core/rate_ctr.h> | ||||||
| #include <osmocom/vty/telnet_interface.h> | #include <osmocom/vty/telnet_interface.h> | ||||||
| #include <osmocom/vty/ports.h> | #include <osmocom/vty/ports.h> | ||||||
| #include <osmocom/vty/logging.h> |  | ||||||
| #include <osmocom/vty/command.h> |  | ||||||
| #include <osmocom/vty/misc.h> |  | ||||||
|  |  | ||||||
| #include <osmocom/sigtran/xua_msg.h> | #include <osmocom/sigtran/xua_msg.h> | ||||||
| #include <osmocom/sigtran/sccp_sap.h> | #include <osmocom/sigtran/sccp_sap.h> | ||||||
|  | #include <osmocom/sigtran/osmo_ss7.h> | ||||||
|  |  | ||||||
| #include <osmocom/smlc/debug.h> | #include <osmocom/smlc/debug.h> | ||||||
| #include <osmocom/smlc/smlc_data.h> | #include <osmocom/smlc/smlc_data.h> | ||||||
| #include <osmocom/smlc/sccp_lb_inst.h> | #include <osmocom/smlc/sccp_lb_inst.h> | ||||||
| #include <osmocom/smlc/cell_locations.h> | #include <osmocom/smlc/smlc_vty.h> | ||||||
|  |  | ||||||
| #define _GNU_SOURCE | #define _GNU_SOURCE | ||||||
| #include <getopt.h> | #include <getopt.h> | ||||||
| @@ -170,6 +167,7 @@ static struct vty_app_info vty_info = { | |||||||
| 	"This is free software: you are free to change and redistribute it.\r\n" | 	"This is free software: you are free to change and redistribute it.\r\n" | ||||||
| 	"There is NO WARRANTY, to the extent permitted by law.\r\n", | 	"There is NO WARRANTY, to the extent permitted by law.\r\n", | ||||||
| 	.version	= PACKAGE_VERSION, | 	.version	= PACKAGE_VERSION, | ||||||
|  | 	.go_parent_cb	= osmo_ss7_vty_go_parent, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| static void signal_handler(int signal) | static void signal_handler(int signal) | ||||||
| @@ -239,17 +237,11 @@ int main(int argc, char **argv) | |||||||
|  |  | ||||||
| 	g_smlc = smlc_state_alloc(tall_smlc_ctx); | 	g_smlc = smlc_state_alloc(tall_smlc_ctx); | ||||||
|  |  | ||||||
| 	/* This needs to precede handle_options() */ |  | ||||||
| 	vty_init(&vty_info); |  | ||||||
| 	logging_vty_add_cmds(); |  | ||||||
| 	osmo_talloc_vty_add_cmds(); |  | ||||||
| 	ctrl_vty_init(tall_smlc_ctx); |  | ||||||
| 	cell_locations_vty_init(); |  | ||||||
|  |  | ||||||
| 	/* Initialize SS7 */ | 	/* Initialize SS7 */ | ||||||
| 	OSMO_ASSERT(osmo_ss7_init() == 0); | 	OSMO_ASSERT(osmo_ss7_init() == 0); | ||||||
| 	osmo_ss7_vty_init_asp(tall_smlc_ctx); |  | ||||||
| 	osmo_sccp_vty_init(); | 	/* This needs to precede handle_options() */ | ||||||
|  | 	smlc_vty_init(&vty_info); | ||||||
|  |  | ||||||
| 	/* parse options */ | 	/* parse options */ | ||||||
| 	handle_options(argc, argv); | 	handle_options(argc, argv); | ||||||
| @@ -262,14 +254,13 @@ int main(int argc, char **argv) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/* Start telnet interface after reading config for vty_get_bind_addr() */ | 	/* Start telnet interface after reading config for vty_get_bind_addr() */ | ||||||
| 	rc = telnet_init_dynif(tall_smlc_ctx, g_smlc, vty_get_bind_addr(), OSMO_VTY_PORT_SMLC); | 	rc = telnet_init_default(tall_smlc_ctx, g_smlc, OSMO_VTY_PORT_SMLC); | ||||||
| 	if (rc < 0) | 	if (rc < 0) | ||||||
| 		exit(1); | 		exit(1); | ||||||
|  |  | ||||||
| 	/* start control interface after reading config for | 	/* start control interface after reading config for | ||||||
| 	 * ctrl_vty_get_bind_addr() */ | 	 * ctrl_vty_get_bind_addr() */ | ||||||
| 	g_smlc->ctrl = ctrl_interface_setup_dynip2(g_smlc, ctrl_vty_get_bind_addr(), OSMO_CTRL_PORT_SMLC, | 	g_smlc->ctrl = ctrl_interface_setup2(g_smlc, OSMO_CTRL_PORT_SMLC, smlc_ctrl_node_lookup, _LAST_CTRL_NODE_SMLC); | ||||||
| 						   smlc_ctrl_node_lookup, _LAST_CTRL_NODE_SMLC); |  | ||||||
| 	if (!g_smlc->ctrl) { | 	if (!g_smlc->ctrl) { | ||||||
| 		fprintf(stderr, "Failed to init the control interface. Exiting.\n"); | 		fprintf(stderr, "Failed to init the control interface. Exiting.\n"); | ||||||
| 		exit(1); | 		exit(1); | ||||||
|   | |||||||
							
								
								
									
										48
									
								
								src/osmo-smlc/smlc_vty.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								src/osmo-smlc/smlc_vty.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,48 @@ | |||||||
|  | /* | ||||||
|  |  * (C) 2025 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> | ||||||
|  |  * All Rights Reserved | ||||||
|  |  * | ||||||
|  |  * SPDX-License-Identifier: AGPL-3.0+ | ||||||
|  |  * | ||||||
|  |  * Author: Pau Espin Pedrol | ||||||
|  |  * | ||||||
|  |  * This program is free software; you can redistribute it and/or modify | ||||||
|  |  * it under the terms of the GNU Affero General Public License as published by | ||||||
|  |  * the Free Software Foundation; either version 3 of the License, or | ||||||
|  |  * (at your option) any later version. | ||||||
|  |  * | ||||||
|  |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU Affero General Public License for more details. | ||||||
|  |  * | ||||||
|  |  * You should have received a copy of the GNU Affero General Public License | ||||||
|  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include <osmocom/ctrl/control_vty.h> | ||||||
|  | #include <osmocom/vty/logging.h> | ||||||
|  | #include <osmocom/vty/misc.h> | ||||||
|  | #include <osmocom/vty/stats.h> | ||||||
|  | #include <osmocom/vty/vty.h> | ||||||
|  |  | ||||||
|  | #include <osmocom/sigtran/osmo_ss7.h> | ||||||
|  | #include <osmocom/sigtran/sccp_sap.h> | ||||||
|  |  | ||||||
|  | #include <osmocom/smlc/cell_locations.h> | ||||||
|  |  | ||||||
|  | void smlc_vty_init(struct vty_app_info *vty_app_info) | ||||||
|  | { | ||||||
|  | 	vty_init(vty_app_info); | ||||||
|  |  | ||||||
|  | 	logging_vty_add_cmds(); | ||||||
|  | 	osmo_talloc_vty_add_cmds(); | ||||||
|  | 	ctrl_vty_init(vty_app_info->tall_ctx); | ||||||
|  | 	osmo_fsm_vty_add_cmds(); | ||||||
|  | 	osmo_stats_vty_add_cmds(); | ||||||
|  |  | ||||||
|  | 	osmo_ss7_vty_init_asp(vty_app_info->tall_ctx); | ||||||
|  | 	osmo_sccp_vty_init(); | ||||||
|  |  | ||||||
|  | 	cell_locations_vty_init(); | ||||||
|  | } | ||||||
| @@ -37,11 +37,13 @@ DISTCLEANFILES = \ | |||||||
| 	$(NULL) | 	$(NULL) | ||||||
|  |  | ||||||
| if ENABLE_EXT_TESTS | if ENABLE_EXT_TESTS | ||||||
| python-tests: $(BUILT_SOURCES) | python-tests: $(top_builddir)/src/osmo-smlc/osmo-smlc | ||||||
| 	$(MAKE) vty-test | 	$(MAKE) vty-test | ||||||
| 	$(MAKE) ctrl-test | 	$(MAKE) ctrl-test | ||||||
|  | 	osmotestvty.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v | ||||||
|  | 	osmotestconfig.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v | ||||||
| else | else | ||||||
| python-tests: $(BUILT_SOURCES) | python-tests: | ||||||
| 	echo "Not running python-based tests (determined at configure-time)" | 	echo "Not running python-based tests (determined at configure-time)" | ||||||
| endif | endif | ||||||
|  |  | ||||||
| @@ -51,7 +53,7 @@ VTY_TEST ?= *.vty | |||||||
| # To update the VTY script from current application behavior, | # To update the VTY script from current application behavior, | ||||||
| # pass -u to vty_script_runner.py by doing: | # pass -u to vty_script_runner.py by doing: | ||||||
| #   make vty-test U=-u | #   make vty-test U=-u | ||||||
| vty-test: | vty-test: $(top_builddir)/src/osmo-smlc/osmo-smlc | ||||||
| 	osmo_verify_transcript_vty.py -v \ | 	osmo_verify_transcript_vty.py -v \ | ||||||
| 		-n OsmoSMLC -p 4271 \ | 		-n OsmoSMLC -p 4271 \ | ||||||
| 		-r "$(top_builddir)/src/osmo-smlc/osmo-smlc -c $(top_srcdir)/tests/osmo-smlc.cfg" \ | 		-r "$(top_builddir)/src/osmo-smlc/osmo-smlc -c $(top_srcdir)/tests/osmo-smlc.cfg" \ | ||||||
| @@ -60,14 +62,11 @@ vty-test: | |||||||
| # To update the CTRL script from current application behavior, | # To update the CTRL script from current application behavior, | ||||||
| # pass -u to ctrl_script_runner.py by doing: | # pass -u to ctrl_script_runner.py by doing: | ||||||
| #   make ctrl-test U=-u | #   make ctrl-test U=-u | ||||||
| ctrl-test: | ctrl-test: $(top_builddir)/src/osmo-smlc/osmo-smlc | ||||||
| 	-rm -f $(CTRL_TEST_DB) |  | ||||||
| 	osmo_verify_transcript_ctrl.py -v \ | 	osmo_verify_transcript_ctrl.py -v \ | ||||||
| 		-p 4272 \ | 		-p 4272 \ | ||||||
| 		-r "$(top_builddir)/src/osmo-smlc/osmo-smlc -c $(top_srcdir)/tests/osmo-smlc.cfg" \ | 		-r "$(top_builddir)/src/osmo-smlc/osmo-smlc -c $(top_srcdir)/tests/osmo-smlc.cfg" \ | ||||||
| 		$(U) $(srcdir)/*.ctrl | 		$(U) $(srcdir)/*.ctrl | ||||||
| 	-rm -f $(CTRL_TEST_DB) |  | ||||||
| 	-rm $(CTRL_TEST_DB)-* |  | ||||||
|  |  | ||||||
| check-local: atconfig $(TESTSUITE) | check-local: atconfig $(TESTSUITE) | ||||||
| 	$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS) | 	$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS) | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ EXTRA_DIST = \ | |||||||
| 	smlc_subscr_test.err \ | 	smlc_subscr_test.err \ | ||||||
| 	$(NULL) | 	$(NULL) | ||||||
|  |  | ||||||
| noinst_PROGRAMS = \ | check_PROGRAMS = \ | ||||||
| 	smlc_subscr_test \ | 	smlc_subscr_test \ | ||||||
| 	$(NULL) | 	$(NULL) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user