diff options
-rw-r--r-- | TODO-RELEASE | 3 | ||||
-rw-r--r-- | configure.ac | 22 | ||||
-rw-r--r-- | contrib/osmo-sgsn.spec.in | 22 | ||||
-rw-r--r-- | debian/changelog | 181 | ||||
-rw-r--r-- | debian/control | 18 | ||||
-rwxr-xr-x | doc/manuals/regen_doc.sh | 76 | ||||
-rw-r--r-- | include/osmocom/sgsn/debug.h | 1 | ||||
-rw-r--r-- | include/osmocom/sgsn/gprs_mm_state_gb_fsm.h | 5 | ||||
-rw-r--r-- | include/osmocom/sgsn/gprs_mm_state_iu_fsm.h | 7 | ||||
-rw-r--r-- | src/sgsn/gprs_gmm.c | 56 | ||||
-rw-r--r-- | src/sgsn/gprs_gmm_attach.c | 9 | ||||
-rw-r--r-- | src/sgsn/gprs_gmm_fsm.c | 11 | ||||
-rw-r--r-- | src/sgsn/gprs_mm_state_gb_fsm.c | 32 | ||||
-rw-r--r-- | src/sgsn/gprs_mm_state_iu_fsm.c | 69 | ||||
-rw-r--r-- | src/sgsn/gprs_ranap.c | 10 | ||||
-rw-r--r-- | src/sgsn/sgsn_main.c | 6 | ||||
-rw-r--r-- | src/sgsn/sgsn_vty.c | 1 | ||||
-rw-r--r-- | tests/osmo-sgsn_test-nodes.vty | 1 | ||||
-rw-r--r-- | tests/sgsn/sgsn_test.c | 5 |
19 files changed, 341 insertions, 194 deletions
diff --git a/TODO-RELEASE b/TODO-RELEASE index 5514897b..1c5d61f5 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -1,4 +1 @@ #component what description / commit summary line -manual needs common chapter cs7-config.adoc, vty_cpu_sched.adoc from osmo-gsm-manuals > 0.3.0 -configure.ac libosmocore depend on next released libosmocore after 1.4.x with hashtable support -sgsn vty/config change the configuration of the vty config. old configuration are invalid. diff --git a/configure.ac b/configure.ac index 947ecf15..c29bacb5 100644 --- a/configure.ac +++ b/configure.ac @@ -50,29 +50,29 @@ AC_SEARCH_LIBS([dlsym], [dl dld], [LIBRARY_DLSYM="$LIBS";LIBS=""]) AC_SUBST(LIBRARY_DLSYM) -PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.4.0) -PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.4.0) -PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.4.0) -PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.4.0) -PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 1.4.0) -PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.6.0) -PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.4.0) -PKG_CHECK_MODULES(LIBOSMOGSUPCLIENT, libosmo-gsup-client >= 1.0.0) +PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.5.0) +PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.5.0) +PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.5.0) +PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.5.0) +PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 1.5.0) +PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.1.0) +PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.1.0) +PKG_CHECK_MODULES(LIBOSMOGSUPCLIENT, libosmo-gsup-client >= 1.3.0) # Enable/disable 3G aka IuPS + IuCS support? AC_ARG_ENABLE([iu], [AS_HELP_STRING([--enable-iu], [Build 3G support, aka IuPS and IuCS interfaces])], [osmo_ac_iu="$enableval"],[osmo_ac_iu="no"]) if test "x$osmo_ac_iu" = "xyes" ; then - PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 1.0.0) + PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 1.4.0) PKG_CHECK_MODULES(LIBASN1C, libasn1c >= 0.9.30) - PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap >= 0.6.0) + PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap >= 0.7.0) AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support]) fi AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes") AC_SUBST(osmo_ac_iu) -PKG_CHECK_MODULES(LIBGTP, libgtp >= 1.5.0) +PKG_CHECK_MODULES(LIBGTP, libgtp >= 1.7.0) PKG_CHECK_MODULES(LIBCARES, libcares) dnl checks for header files diff --git a/contrib/osmo-sgsn.spec.in b/contrib/osmo-sgsn.spec.in index cd3b5b7b..f661fa0c 100644 --- a/contrib/osmo-sgsn.spec.in +++ b/contrib/osmo-sgsn.spec.in @@ -34,20 +34,20 @@ BuildRequires: systemd-rpm-macros %endif BuildRequires: pkgconfig(libcares) BuildRequires: pkgconfig(libcrypto) >= 0.9.5 -BuildRequires: pkgconfig(libgtp) >= 1.4.0 -BuildRequires: pkgconfig(libosmo-gsup-client) >= 1.0.0 -BuildRequires: pkgconfig(libosmo-netif) >= 0.4.0 -BuildRequires: pkgconfig(libosmoabis) >= 0.6.0 -BuildRequires: pkgconfig(libosmocore) >= 1.2.0 -BuildRequires: pkgconfig(libosmoctrl) >= 1.2.0 -BuildRequires: pkgconfig(libosmogb) >= 1.2.0 -BuildRequires: pkgconfig(libosmogsm) >= 1.2.0 -BuildRequires: pkgconfig(libosmovty) >= 1.2.0 +BuildRequires: pkgconfig(libgtp) >= 1.7.0 +BuildRequires: pkgconfig(libosmo-gsup-client) >= 1.3.0 +BuildRequires: pkgconfig(libosmo-netif) >= 1.1.0 +BuildRequires: pkgconfig(libosmoabis) >= 1.1.0 +BuildRequires: pkgconfig(libosmocore) >= 1.5.0 +BuildRequires: pkgconfig(libosmoctrl) >= 1.5.0 +BuildRequires: pkgconfig(libosmogb) >= 1.5.0 +BuildRequires: pkgconfig(libosmogsm) >= 1.5.0 +BuildRequires: pkgconfig(libosmovty) >= 1.5.0 %{?systemd_requires} %if %{with_iu} BuildRequires: pkgconfig(libasn1c) -BuildRequires: pkgconfig(libosmo-ranap) >= 0.4.0 -BuildRequires: pkgconfig(libosmo-sigtran) >= 1.0.0 +BuildRequires: pkgconfig(libosmo-ranap) >= 0.7.0 +BuildRequires: pkgconfig(libosmo-sigtran) >= 1.4.0 %endif %description diff --git a/debian/changelog b/debian/changelog index 2827f43b..2edc6e66 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,184 @@ +osmo-sgsn (1.7.0) unstable; urgency=medium + + [ Daniel Willmann ] + * gprs_gmm: Check for RAT change and ensure this only happens for RAU/ATT + * gbproxy-usermanual: Explain BSSGP/BVC handling + * gbproxy: Whitespace fixes + * gbproxy: Add todo for BVC RESET logic + * gbproxy: Get the peer if paging by BVCI on SIG_BVC + * Let libosmocore handle VTY parent node tracking + * osmo-gbproxy: Free msgb in ns2 prim callback + * configure.ac: Require python3 for ext_tests + * osmo-gbproxy: Implement nsvc-state ctrl command + * gbproxy: Remove test testing NSVCI change + * gbproxy: Add NSE peer that can have multiple gbproxy_peers + * gbproxy: Ensure BVC0 is reset before handling PtP BVCs + * gbproxy: Only send paging to each matching NSE once + * gbproxy: Separate function to move gbproxy_peer to different nse + * gbproxy: Add logging macros for NSE and BVC + * gbproxy: Use LOG macros for NSE/BVC + * gbproxy: Change generic LOG messages so BVCI/NSEI fmt is consistent + * gbproxy: Add todos encountered while going through the code + * gbproxy: Add BVC log filters + * gbproxy: Add newline to log message + * gbproxy: Allow gbproxy_nse_free(NULL) + * gbproxy: Delete gbproxy_nse in delete-gbproxy-peer VTY command + * mm_state_gb_fsm: Handle implicit detach from mm_standby + * gbproxy: Fix bvci check in gbprox_rx_ptp_from_* + * osmo-gbproxy: Initialize all hash_maps + * gbproxy: Fix confusing log message in gbprox_relay2nse + * gbproxy: Add SGSN NRI configuration + * gbproxy: Add SGSN pooling support + * gbproxy: Add comments to sgsn functions + * gbproxy: Add config option to name an SGSN + * gbproxy: Add VTY command to override the node selection function + * Fix gbproxy_sgsn_by_tlli wraparound + * gbproxy: Implement TLLI cache and use it for SUSPEND/RESUME + * gbproxy: Increase TLLI cache timeout to 10s + * gbproxy: Implement IMSI cache + * gbproxy: Use IMSI cache to handle PAGING_PS_REJECT + * gbproxy: Use C-style comments + * gbproxy: Move helper function to a more logical place + * gbproxy: Remove unused variable assignment + * gbproxy: Fix VTY cmd name + * gbproxy: Define and use help string for gbproxy + * gbproxy: Add VTY commands to query the TLLI/IMSI cache + * gbproxy: Use IMSI cache for PTP paging and implement DUMMY_PAGING_PS + * gbproxy: Print the correct message type for dummy paging/paging reject + * gbproxy: Improve log messages in gbproxy_select_sgsn + * gbproxy: Fix radio status routing by TMSI + * manual/gbproxy: Update overview chapter + * Rename OsmoGbPROXY -> *Proxy + * manuals/gbproxy: Update configuration chapter + * manuals/gbproxy: Add osmo-bsc MSC pooling chapter from Neels as a base + * manuals/gbproxy: MSC -> SGSN for pooling chapter + * manuals/gbproxy: Move pooling to separate chapter + + [ Alexander Couzens ] + * gprs_gmm_fsm.c: Implement RAT change between 2g and 3g + * gtphub: rename sgsn's oww osmo_sockaddr into sgsn_sockaddr + * gprs_llc: _bssgp_tx_dl_ud: ensure the LLME is valid before using it + * gmm: on invalid RA id reject the MS with an implicit detach + * gtphub_test: fix compilation error on gcc 10.2.0 + * gtphub: fix compilation with gcc 10.2.0 + * Port gbproxy to NS2 + * sgsn: check for NULL of gprs_subscr_get_or_create() + * sgsn: Use the new NS2 api + * gbproxy: use ns2 vty2 + * configure.ac: define a c standard instead of using the compilers default + * follow libosmocore/gprs_ns2 API changes of GPRS enums + * gbproxy: follow gprs_ns2 API vty changes + * sgsn: migrate to the new gprs_ns2_vty configuration + * follow libosmocore/gprs_ns2 API changes (gprs_ns2_dynamic_create_nse) + + [ Neels Hofmeyr ] + * manual: explain IuPS, add SCCP/M3UA section from common chapters + * fix nullpointer: in gsm48_rx_gmm_ra_upd_req() + * gsup: send RAT type on LU + * gbproxy_test.c: fix mobile identity test data + * use new osmo_mobile_identity API everywhere + + [ Eric ] + * tests: dlopen does not imply availability of dlsym.. + * configure.ac: fix libtool issue with clang and sanitizer + + [ Harald Welte ] + * gtphub_test: Fix compilation with gcc-10 + * Fix memory leak when SNDCP de-fragmentation is used + * Treat RAU as implicit RESUME if GMM is suspended + * *.spec.in: Use %config(noreplace) to retain current config file + * Send a BVC-RESET to all persistent Gb interfaces at start-up + * Use osmo_fd_setup() whenever applicable + * Use osmo_fd_*_{disable,enable} + * gbproxy: Properly implement paging to LAC/RAC + * gbproxy: Implement paging to entire BSS area + * gprs_gb_parse: Add function to determine TLLI from encoded BSSGP + * gbproxy: Pass TLLI as LSP towards NS to facilitate load sharing + * gb_proxy_peer: Add some FIXMEs regarding invalid assumptions + * gb_proxy: More precise + readable log messages + * gb_proxy: Broadcast SGSN-INVOKE-TRACE and OVERLOAD + * gbproxy: Move BSS-side BVC-RESET processing to its own function + * gb_proxy: Slightly restructure processing of BSS-originated BVC-RESET + * gbproxy: Cosmetics: use longer lines + * gbproxy: Send BVC-STATUS if BSS sends us BVC-RESET without mandatory IEs + * gb_proxy: Use TLVP_PRES_LEN instead of TLVP_PRESENT + * gb_proxy: Rename gbproxy_peer to gbproxy_bvc + * gbproxy: Rename gbproxy_cfg.nses to gbproxy_cfg.bss_nses + * gbproxy: convert bss_nses from llist_head to hashtable + * gbproxy: convert nse->bvcs from llist_head to hashtable + * gbproxy: Remove patching, TLLI-tracking and SGSN2 support + * gb_proxy: cosmetic: Use function rather than open-coding is_sgsn + * gbproxy: Delete gbproxy_test + * gb_proxy: Introduce more validation / constraint checks + * gbproxy: use gbprox_relay2peer() whenever possible + * gb_proxy: Use osmo_tlv_prot_parse() to validate mandatory IEs + * gbproxy: Log FSM timeouts + * migrate to DLBSSGP as log sub-system for BSSGP + * gbproxy major rewrite for SGSN pool support + * gbproxy: Use "(nsei << 16) | bvci" as rate_ctr_group index + * gbproxy: Introduce new DOBJ log category; log object allocation/release + * gbproxy: Don't create an extra msgb copy for SGSN DL SIG + * gbproxy: Implement handling of BVC Flow Control + * gbproxy: Copy RA-ID from BSS side BVC to CELL and SGSN-side BVC + * gbproxy: (Re)allocate SGSN-side PTP BVC even if CELL already exists + * gbproxy: Fix segfault when receiving PAGING for unknown destination + * gbproxy: Add FSM related VTY commands + * gbproxy: Implement scaling of BVC flow control in SGSN pool + * gbproxy: Improve VTY state introspection + * gbproxy: rename vty command "show gbproxy ..." to "show gbproxy bvc ..." + * gbproxy: Add "show gbproxy cell ..." VTY command + * gbproxy: Fix build on Deiban 8 + * gb_proxy: Don't use orphan log subsystem DPCU + * gbproxy: Avoid depending on any of the SGSN code + * main: add --vty-ref-mode, use vty_dump_xml_ref_mode() + * manuals: generate vty reference xml at build time + + [ Pau Espin Pedrol ] + * Use OSMO_FD_* instead of deprecated BSC_FD_* + * sgsn_libgtp: Improve ps-paging logging + * gprs_gmm_fsm.c: Add missing license header + * sgsn_libgtp: Avoid ps-paging MS on GMM Suspended state + * configure.ac: Fix trailing whitespace + * doc: Update VTY reference xml file + * Support setting rt-prio and cpu-affinity mask through VTY + * Change default SCTP conn NULL->127.0.0.1 to localhost->localhost + * contrib/jenkins: Enable parallel make in make distcheck + * Log error if pdp ctx is freed while holding an active timer + * Fix crash rx DeactPdpReq while waiting for DeactPdpAck after gtp side is freed + * sgsn_delete_pdp_ctx: Add documentation and assert assumptions + * process_ms_ctx_status: refactor to avoid code duplication + * process_ms_ctx_status: Fix crash deleting PDP Ctx if GTP side was already released + * gbproxy: generate coredump and exit upon SIGABRT received + * gtphub: generate coredump and exit upon SIGABRT received + * sgsn: generate coredump and exit upon SIGABRT received + * gmm: fix build without define PTMSI_ALLOC + * gmm: Introduce comment to ease addition of Network feature support IE later + * .gitignore: Ignore new autofoo tmp files + * sndcp: Fix struct bit fields on big endian + * Fix nsei+bvci not updated on rx UL SNDCP data + + [ Oliver Smith ] + * contrib: import RPM spec + * contrib: integrate RPM spec + * Makefile.am: EXTRA_DIST: debian, contrib/*.spec.in + * contrib/jenkins: don't build osmo-gsm-manuals + * gbproxy: remove (moved to own repository) + + [ Vadim Yanitskiy ] + * debian/control: change maintainer to the Osmocom team / mailing list + * gb_proxy_peer: sgsn can never be NULL in gbproxy_sgsn_by_nri() + * gb_proxy_peer: fix NULL pointer dereference in gbproxy_sgsn_alloc() + + [ Keith ] + * Fix Radio Priority in MM Attach and PDP Context Activation + * VTY: Add gtp state-dir command + + [ Philipp Maier ] + * gprs_sndcp: fix use after free + * sgsn_rim: Add routing for (GERAN) BSSGP RIM messages + + -- Pau Espin Pedrol <pespin@sysmocom.de> Tue, 23 Feb 2021 20:29:33 +0100 + osmo-sgsn (1.6.0) unstable; urgency=medium [ Pau Espin Pedrol ] diff --git a/debian/control b/debian/control index fe2f1e63..abc75950 100644 --- a/debian/control +++ b/debian/control @@ -12,16 +12,16 @@ Build-Depends: debhelper (>=9), pkg-config, libtalloc-dev, libc-ares-dev, - libgtp-dev (>= 1.5.0), - libosmocore-dev (>= 1.4.0), - libosmo-abis-dev (>= 0.6.0), - libosmo-netif-dev (>= 0.4.0), - libosmo-gsup-client-dev (>= 1.0.0), + libgtp-dev (>= 1.7.0), + libosmocore-dev (>= 1.5.0), + libosmo-abis-dev (>= 1.1.0), + libosmo-netif-dev (>= 1.1.0), + libosmo-gsup-client-dev (>= 1.3.0), libasn1c-dev (>= 0.9.30), - libosmo-ranap-dev (>= 0.6.0), - libosmo-sigtran-dev (>= 1.0.0), - libosmo-sccp-dev (>= 1.0.0), - osmo-gsm-manuals-dev + libosmo-ranap-dev (>= 0.7.0), + libosmo-sigtran-dev (>= 1.4.0), + libosmo-sccp-dev (>= 1.4.0), + osmo-gsm-manuals-dev (>= 1.1.0) Standards-Version: 3.9.8 Vcs-Git: git://git.osmocom.org/osmo-sgsn.git Vcs-Browser: https://git.osmocom.org/osmo-sgsn diff --git a/doc/manuals/regen_doc.sh b/doc/manuals/regen_doc.sh index 9fcebb8b..5c84a232 100755 --- a/doc/manuals/regen_doc.sh +++ b/doc/manuals/regen_doc.sh @@ -1,71 +1,17 @@ -#!/bin/sh -e +#!/bin/sh -x -require_osmo_interact_vty() { - if command -v osmo_interact_vty.py >/dev/null 2>&1; then - return - fi - echo "ERROR: osmo_interact_vty.py not found. Are osmo-python-tests in PATH?" +if [ -z "$DOCKER_PLAYGROUND" ]; then + echo "You need to set DOCKER_PLAYGROUND" exit 1 -} +fi -# $1: "update_vty_reference" or "update_counters" -# $2: output file -# $3: port -# $4-$n: command -interact_vty() { - action="$1" - output="$2" - port="$3" - log="/tmp/$4.log" - shift 3 +SCRIPT=$(realpath "$0") +MANUAL_DIR=$(dirname "$SCRIPT") - echo "Starting in background: $@" - "$@" > "$log" 2>&1 & - pid="$!" +COMMIT=${COMMIT:-$(git log -1 --format=format:%H)} - sleep 0.5 - if ! kill -0 "$pid" 2>/dev/null; then - echo "ERROR: start failed!" - cat "$log" - exit 1 - fi +cd "$DOCKER_PLAYGROUND/scripts" || exit 1 - case "$action" in - "update_vty_reference") - echo "Updating VTY reference: $output" - osmo_interact_vty.py -X -p "$port" -H 127.0.0.1 -O "$output" - ;; - "update_counters") - echo "Updating asciidoc counters: $output" - osmo_interact_vty.py -c "enable;show asciidoc counters" -p "$port" -H 127.0.0.1 -O "$output" - ;; - *) - echo "ERROR: invalid argument: $action" - exit 1 - ;; - esac - - kill "$pid" - echo "Done (killed $1)" - echo -} - -DIR="$(cd "$(dirname "$0")"; pwd)" -cd "$DIR" - -require_osmo_interact_vty - -interact_vty \ - "update_vty_reference" \ - "vty/sgsn_vty_reference.xml" \ - 4245 \ - osmo-sgsn -c "../examples/osmo-sgsn/osmo-sgsn.cfg" - -interact_vty \ - "update_counters" \ - "chapters/counters_generated.adoc" \ - 4245 \ - osmo-sgsn -c "../examples/osmo-sgsn/osmo-sgsn.cfg" - - -echo "Done with all" +OSMO_BSC_BRANCH=$COMMIT ./regen_doc.sh osmo-sgsn 4245 \ + "$MANUAL_DIR/chapters/counters_generated.adoc" \ + "$MANUAL_DIR/vty/sgsn_vty_reference.xml" diff --git a/include/osmocom/sgsn/debug.h b/include/osmocom/sgsn/debug.h index 37e4a097..80c5d9fc 100644 --- a/include/osmocom/sgsn/debug.h +++ b/include/osmocom/sgsn/debug.h @@ -13,7 +13,6 @@ enum { DMEAS, DREF, DGPRS, - DNS, DLLC, DSNDCP, DSLHC, diff --git a/include/osmocom/sgsn/gprs_mm_state_gb_fsm.h b/include/osmocom/sgsn/gprs_mm_state_gb_fsm.h index e69e1e11..4237c2f9 100644 --- a/include/osmocom/sgsn/gprs_mm_state_gb_fsm.h +++ b/include/osmocom/sgsn/gprs_mm_state_gb_fsm.h @@ -5,7 +5,7 @@ struct sgsn_mm_ctx; -/* TS 23.060 6.1.1 Mobility Management States (A/Gb mode) */ +/* TS 23.060 § 6.1.1 Mobility Management States (A/Gb mode) */ enum mm_state_gb_fsm_states { ST_MM_IDLE, ST_MM_READY, @@ -14,9 +14,8 @@ enum mm_state_gb_fsm_states { enum mm_state_gb_fsm_events { E_MM_GPRS_ATTACH, - /* E_GPRS_DETACH, TODO: not used */ + E_MM_GPRS_DETACH, /* MS becomes detached: due to Detach Req, RAU reject, implicit detach, etc. */ E_MM_PDU_RECEPTION, - E_MM_IMPLICIT_DETACH, /* = E_MM_CANCEL_LOCATION */ E_MM_READY_TIMER_EXPIRY, /* E_FORCE_TO_STANDBY, TODO: not used */ /* E_ABNSORMAL_RLC_CONDITION, TODO: not used */ diff --git a/include/osmocom/sgsn/gprs_mm_state_iu_fsm.h b/include/osmocom/sgsn/gprs_mm_state_iu_fsm.h index 05342f9f..6dae759b 100644 --- a/include/osmocom/sgsn/gprs_mm_state_iu_fsm.h +++ b/include/osmocom/sgsn/gprs_mm_state_iu_fsm.h @@ -4,8 +4,7 @@ struct sgsn_mm_ctx; - -/* TS 23.060 6.1.1 Mobility Management States (A/Gb mode) */ +/* TS 23.060 § 6.1.2 Mobility Management States (Iu mode) */ enum mm_state_iu_fsm_states { ST_PMM_DETACHED, ST_PMM_CONNECTED, @@ -14,12 +13,10 @@ enum mm_state_iu_fsm_states { enum mm_state_iu_fsm_events { E_PMM_PS_ATTACH, - /* E_PS_DETACH, TODO: not used */ + E_PMM_PS_DETACH, /* UE becomes detached: due to Detach Req, RAU reject, implicit detach, etc. */ E_PMM_PS_CONN_RELEASE, E_PMM_PS_CONN_ESTABLISH, - E_PMM_IMPLICIT_DETACH, /* = E_PS_ATTACH_REJECT, E_RAU_REJECT */ E_PMM_RA_UPDATE, /* = Serving RNC relocation */ - E_PMM_USER_INACTIVITY, /* when the inactivity timer runs out */ }; extern struct osmo_fsm mm_state_iu_fsm; diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c index 2367338a..edddd2d8 100644 --- a/src/sgsn/gprs_gmm.c +++ b/src/sgsn/gprs_gmm.c @@ -197,10 +197,10 @@ static void mm_ctx_cleanup_free(struct sgsn_mm_ctx *ctx, const char *log_text) switch(ctx->ran_type) { case MM_CTX_T_UTRAN_Iu: - osmo_fsm_inst_dispatch(ctx->iu.mm_state_fsm, E_PMM_IMPLICIT_DETACH, NULL); + osmo_fsm_inst_dispatch(ctx->iu.mm_state_fsm, E_PMM_PS_DETACH, NULL); break; case MM_CTX_T_GERAN_Gb: - osmo_fsm_inst_dispatch(ctx->gb.mm_state_fsm, E_MM_IMPLICIT_DETACH, NULL); + osmo_fsm_inst_dispatch(ctx->gb.mm_state_fsm, E_MM_GPRS_DETACH, NULL); break; } @@ -215,7 +215,7 @@ static int _tx_status(struct msgb *msg, uint8_t cause, /* MMCTX might be NULL! */ - DEBUGP(DMM, "<- GPRS MM STATUS (cause: %s)\n", + DEBUGP(DMM, "<- GMM STATUS (cause: %s)\n", get_value_string(gsm48_gmm_cause_names, cause)); gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1); @@ -241,7 +241,7 @@ static int _tx_detach_req(struct msgb *msg, uint8_t detach_type, uint8_t cause, /* MMCTX might be NULL! */ - DEBUGP(DMM, "<- GPRS MM DETACH REQ (type: %s, cause: %s)\n", + DEBUGP(DMM, "<- GMM DETACH REQ (type: %s, cause: %s)\n", get_value_string(gprs_det_t_mt_strs, detach_type), get_value_string(gsm48_gmm_cause_names, cause)); @@ -290,7 +290,7 @@ int gsm48_tx_gmm_att_ack(struct sgsn_mm_ctx *mm) uint8_t *ptsig; #endif - LOGMMCTXP(LOGL_INFO, mm, "<- GPRS ATTACH ACCEPT (new P-TMSI=0x%08x)\n", mm->p_tmsi); + LOGMMCTXP(LOGL_INFO, mm, "<- GMM ATTACH ACCEPT (new P-TMSI=0x%08x)\n", mm->p_tmsi); rate_ctr_inc(&sgsn->rate_ctrs->ctr[CTR_GPRS_ATTACH_ACKED]); mmctx2msgid(msg, mm); @@ -354,7 +354,7 @@ static int _tx_gmm_att_rej(struct msgb *msg, uint8_t gmm_cause, { struct gsm48_hdr *gh; - LOGMMCTXP(LOGL_NOTICE, mm, "<- GPRS ATTACH REJECT: %s\n", + LOGMMCTXP(LOGL_NOTICE, mm, "<- GMM ATTACH REJECT: %s\n", get_value_string(gsm48_gmm_cause_names, gmm_cause)); rate_ctr_inc(&sgsn->rate_ctrs->ctr[CTR_GPRS_ATTACH_REJECTED]); @@ -388,7 +388,7 @@ static int _tx_detach_ack(struct msgb *msg, uint8_t force_stby, /* MMCTX might be NULL! */ - DEBUGP(DMM, "<- GPRS MM DETACH ACC (force-standby: %d)\n", force_stby); + DEBUGP(DMM, "<- GMM DETACH ACC (force-standby: %d)\n", force_stby); rate_ctr_inc(&sgsn->rate_ctrs->ctr[CTR_GPRS_DETACH_ACKED]); gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1); @@ -421,7 +421,7 @@ int gsm48_tx_gmm_id_req(struct sgsn_mm_ctx *mm, uint8_t id_type) struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 ID REQ"); struct gsm48_hdr *gh; - LOGMMCTXP(LOGL_DEBUG, mm, "<- GPRS IDENTITY REQUEST: mi_type=%s\n", + LOGMMCTXP(LOGL_DEBUG, mm, "<- GMM IDENTITY REQUEST: mi_type=%s\n", gsm48_mi_type_name(id_type)); mmctx2msgid(msg, mm); @@ -456,7 +456,7 @@ int gsm48_tx_gmm_auth_ciph_req(struct sgsn_mm_ctx *mm, uint8_t *m_rand, *m_cksn, rbyte; int rc; - LOGMMCTXP(LOGL_INFO, mm, "<- GPRS AUTH AND CIPHERING REQ (rand = %s," + LOGMMCTXP(LOGL_INFO, mm, "<- GMM AUTH AND CIPHERING REQ (rand = %s," " mmctx_is_r99=%d, vec->auth_types=0x%x", osmo_hexdump(vec->rand, sizeof(vec->rand)), mmctx_is_r99(mm), vec->auth_types); @@ -519,7 +519,7 @@ static int gsm48_tx_gmm_auth_ciph_rej(struct sgsn_mm_ctx *mm) struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 AUTH CIPH REJ"); struct gsm48_hdr *gh; - LOGMMCTXP(LOGL_NOTICE, mm, "<- GPRS AUTH AND CIPH REJECT\n"); + LOGMMCTXP(LOGL_NOTICE, mm, "<- GMM AUTH AND CIPH REJECT\n"); mmctx2msgid(msg, mm); @@ -599,7 +599,7 @@ static int gsm48_rx_gmm_auth_ciph_resp(struct sgsn_mm_ctx *ctx, uint8_t res_len; int rc; - LOGMMCTXP(LOGL_INFO, ctx, "-> GPRS AUTH AND CIPH RESPONSE\n"); + LOGMMCTXP(LOGL_INFO, ctx, "-> GMM AUTH AND CIPH RESPONSE\n"); if (ctx->auth_triplet.key_seq == GSM_KEY_SEQ_INVAL) { LOGMMCTXP(LOGL_NOTICE, ctx, @@ -650,7 +650,7 @@ static int gsm48_rx_gmm_auth_ciph_resp(struct sgsn_mm_ctx *ctx, ctx->sec_ctx = check_auth_resp(ctx, false, &at->vec, res, res_len); if (!sgsn_mm_ctx_is_authenticated(ctx)) { rc = gsm48_tx_gmm_auth_ciph_rej(ctx); - mm_ctx_cleanup_free(ctx, "GPRS AUTH AND CIPH REJECT"); + mm_ctx_cleanup_free(ctx, "GMM AUTH AND CIPH REJECT"); return rc; } @@ -673,7 +673,7 @@ static int gsm48_rx_gmm_auth_ciph_fail(struct sgsn_mm_ctx *ctx, const uint8_t *auts; int rc; - LOGMMCTXP(LOGL_INFO, ctx, "-> GPRS AUTH AND CIPH FAILURE (cause = %s)\n", + LOGMMCTXP(LOGL_INFO, ctx, "-> GMM AUTH AND CIPH FAILURE (cause = %s)\n", get_value_string(gsm48_gmm_cause_names, gmm_cause)); tlv_parse(&tp, &gsm48_gmm_att_tlvdef, gh->data+1, msg->len - 1, 0, 0); @@ -713,7 +713,7 @@ static int gsm48_rx_gmm_auth_ciph_fail(struct sgsn_mm_ctx *ctx, LOGMMCTXP(LOGL_NOTICE, ctx, "Authentication failed\n"); rc = gsm48_tx_gmm_auth_ciph_rej(ctx); - mm_ctx_cleanup_free(ctx, "GPRS AUTH FAILURE"); + mm_ctx_cleanup_free(ctx, "GMM AUTH FAILURE"); return rc; } @@ -792,7 +792,7 @@ static int gsm48_tx_gmm_service_ack(struct sgsn_mm_ctx *mm) struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 SERVICE ACK"); struct gsm48_hdr *gh; - LOGMMCTXP(LOGL_INFO, mm, "<- GPRS SERVICE ACCEPT (P-TMSI=0x%08x)\n", mm->p_tmsi); + LOGMMCTXP(LOGL_INFO, mm, "<- GMM SERVICE ACCEPT (P-TMSI=0x%08x)\n", mm->p_tmsi); mmctx2msgid(msg, mm); @@ -813,7 +813,7 @@ static int _tx_gmm_service_rej(struct msgb *msg, uint8_t gmm_cause, { struct gsm48_hdr *gh; - LOGMMCTXP(LOGL_NOTICE, mm, "<- GPRS SERVICE REJECT: %s\n", + LOGMMCTXP(LOGL_NOTICE, mm, "<- GMM SERVICE REJECT: %s\n", get_value_string(gsm48_gmm_cause_names, gmm_cause)); gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1); @@ -936,7 +936,7 @@ int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx) #ifdef BUILD_IU case GSM48_MT_GMM_SERVICE_REQ: ctx->pending_req = 0; - osmo_fsm_inst_dispatch(ctx->iu.mm_state_fsm, E_PMM_PS_ATTACH, NULL); + osmo_fsm_inst_dispatch(ctx->iu.mm_state_fsm, E_PMM_PS_CONN_ESTABLISH, NULL); rc = gsm48_tx_gmm_service_ack(ctx); if (ctx->iu.service.type != GPRS_SERVICE_T_SIGNALLING) @@ -1087,7 +1087,7 @@ static int gsm48_rx_gmm_id_resp(struct sgsn_mm_ctx *ctx, struct msgb *msg) "p_tmsi_old=0x%08x\n", ictx->p_tmsi); - mm_ctx_cleanup_free(ictx, "GPRS IMSI re-use"); + mm_ctx_cleanup_free(ictx, "GMM IMSI re-use"); } } OSMO_STRLCPY_ARRAY(ctx->imsi, mi.imsi); @@ -1330,7 +1330,7 @@ rejected: get_value_string(gsm48_gmm_cause_names, reject_cause), reject_cause); rc = gsm48_tx_gmm_att_rej_oldmsg(msg, reject_cause); if (ctx) - mm_ctx_cleanup_free(ctx, "GPRS ATTACH REJ"); + mm_ctx_cleanup_free(ctx, "GMM ATTACH REJ"); else if (llme) gprs_llgmm_unassign(llme); @@ -1343,7 +1343,7 @@ static int gsm48_rx_gmm_att_compl(struct sgsn_mm_ctx *mmctx) { struct sgsn_signal_data sig_data; /* only in case SGSN offered new P-TMSI */ - LOGMMCTXP(LOGL_INFO, mmctx, "-> ATTACH COMPLETE\n"); + LOGMMCTXP(LOGL_INFO, mmctx, "-> GMM ATTACH COMPLETE\n"); #ifdef BUILD_IU if (mmctx->iu.ue_ctx) { @@ -1430,7 +1430,7 @@ static int gsm48_rx_gmm_det_req(struct sgsn_mm_ctx *ctx, struct msgb *msg) memset(&sig_data, 0, sizeof(sig_data)); sig_data.mm = ctx; osmo_signal_dispatch(SS_SGSN, S_SGSN_DETACH, &sig_data); - mm_ctx_cleanup_free(ctx, "GPRS DETACH REQUEST"); + mm_ctx_cleanup_free(ctx, "GMM DETACH REQUEST"); } return rc; @@ -1450,7 +1450,7 @@ static int gsm48_tx_gmm_ra_upd_ack(struct sgsn_mm_ctx *mm) #endif rate_ctr_inc(&sgsn->rate_ctrs->ctr[CTR_GPRS_ROUTING_AREA_ACKED]); - LOGMMCTXP(LOGL_INFO, mm, "<- ROUTING AREA UPDATE ACCEPT\n"); + LOGMMCTXP(LOGL_INFO, mm, "<- GMM ROUTING AREA UPDATE ACCEPT\n"); mmctx2msgid(msg, mm); @@ -1770,7 +1770,7 @@ rejected: get_value_string(gsm48_gmm_cause_names, reject_cause), reject_cause); rc = gsm48_tx_gmm_ra_upd_rej(msg, reject_cause); if (mmctx) - mm_ctx_cleanup_free(mmctx, "GPRS RA UPDATE REJ"); + mm_ctx_cleanup_free(mmctx, "GMM RA UPDATE REJ"); else if (llme) gprs_llgmm_unassign(llme); #ifdef BUILD_IU @@ -1952,7 +1952,7 @@ static int gsm48_rx_gmm_status(struct sgsn_mm_ctx *mmctx, struct msgb *msg) { struct gsm48_hdr *gh = msgb_l3(msg); - LOGMMCTXP(LOGL_INFO, mmctx, "-> GPRS MM STATUS (cause: %s)\n", + LOGMMCTXP(LOGL_INFO, mmctx, "-> GMM STATUS (cause: %s)\n", get_value_string(gsm48_gmm_cause_names, gh->data[0])); return 0; @@ -2071,7 +2071,7 @@ int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg, if (!mmctx) goto null_mmctx; LOGMMCTXP(LOGL_INFO, mmctx, "-> DETACH ACK\n"); - mm_ctx_cleanup_free(mmctx, "GPRS DETACH ACK"); + mm_ctx_cleanup_free(mmctx, "GMM DETACH ACK"); rc = 0; break; case GSM48_MT_GMM_ATTACH_COMPL: @@ -2111,9 +2111,9 @@ int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg, null_mmctx: LOGGBIUP(llme, msg, LOGL_ERROR, - "Received GSM 04.08 message type 0x%02x," + "Received GSM 04.08 message type %s," " but no MM context available\n", - gh->msg_type); + get_value_string(gprs_msgt_gmm_names, gh->msg_type)); return -EINVAL; } @@ -2180,7 +2180,7 @@ static void mmctx_timer_cb(void *_mm) if (mm->num_T_exp >= 5) { LOGMMCTXP(LOGL_NOTICE, mm, "T3370 expired >= 5 times\n"); gsm48_tx_gmm_att_rej(mm, GMM_CAUSE_MS_ID_NOT_DERIVED); - mm_ctx_cleanup_free(mm, "GPRS ATTACH REJECT (T3370)"); + mm_ctx_cleanup_free(mm, "GMM ATTACH REJECT (T3370)"); break; } /* re-tranmit IDENTITY REQUEST and re-start timer */ diff --git a/src/sgsn/gprs_gmm_attach.c b/src/sgsn/gprs_gmm_attach.c index c903a016..629cc53f 100644 --- a/src/sgsn/gprs_gmm_attach.c +++ b/src/sgsn/gprs_gmm_attach.c @@ -272,6 +272,13 @@ static void st_iu_security_cmd_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_ static void st_iu_security_cmd(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch(event) { + case E_VLR_ANSWERED: + /* We may receive an event due to rx + * OSMO_GSUP_MSGT_INSERT_DATA_REQUEST here. Do nothing, update of + * subscriber is done by lower layers before event is signalled. + * In this state we simply wait for E_IU_SECURITY_CMD_COMPLETE + */ + break; case E_IU_SECURITY_CMD_COMPLETE: gmm_attach_fsm_state_chg(fi, ST_ACCEPT); break; @@ -308,7 +315,7 @@ static struct osmo_fsm_state gmm_attach_req_fsm_states[] = { .action = st_auth, }, [ST_IU_SECURITY_CMD] = { - .in_event_mask = X(E_IU_SECURITY_CMD_COMPLETE), + .in_event_mask = X(E_IU_SECURITY_CMD_COMPLETE) | X(E_VLR_ANSWERED), .out_state_mask = X(ST_INIT) | X(ST_AUTH) | X(ST_ACCEPT) | X(ST_REJECT), .name = "IuSecurityCommand", .onenter = st_iu_security_cmd_on_enter, diff --git a/src/sgsn/gprs_gmm_fsm.c b/src/sgsn/gprs_gmm_fsm.c index 886726c6..78946b5b 100644 --- a/src/sgsn/gprs_gmm_fsm.c +++ b/src/sgsn/gprs_gmm_fsm.c @@ -57,6 +57,10 @@ static void st_gmm_deregistered(struct osmo_fsm_inst *fi, uint32_t event, void * static void st_gmm_common_proc_init(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch(event) { + case E_GMM_COMMON_PROC_INIT_REQ: + /* MS may retransmit GPRS Attach Request if for some reason + * CommonProcedure didn't go forward correctly */ + break; /* TODO: events not used case E_GMM_LOWER_LAYER_FAILED: case E_GMM_COMMON_PROC_FAILED: @@ -126,7 +130,8 @@ static struct osmo_fsm_state gmm_fsm_states[] = { /* X(E_GMM_LOWER_LAYER_FAILED) | */ /* X(E_GMM_COMMON_PROC_FAILED) | */ X(E_GMM_COMMON_PROC_SUCCESS) | - X(E_GMM_ATTACH_SUCCESS), + X(E_GMM_ATTACH_SUCCESS) | + X(E_GMM_COMMON_PROC_INIT_REQ), .out_state_mask = X(ST_GMM_DEREGISTERED) | X(ST_GMM_REGISTERED_NORMAL), @@ -194,9 +199,9 @@ void gmm_fsm_allstate_action(struct osmo_fsm_inst *fi, uint32_t event, void *dat gmm_fsm_state_chg(fi, ST_GMM_DEREGISTERED); default: if (mmctx->ran_type == MM_CTX_T_GERAN_Gb) - osmo_fsm_inst_dispatch(mmctx->gb.mm_state_fsm, E_MM_IMPLICIT_DETACH, NULL); + osmo_fsm_inst_dispatch(mmctx->gb.mm_state_fsm, E_MM_GPRS_DETACH, NULL); else if (mmctx->ran_type == MM_CTX_T_UTRAN_Iu) { - osmo_fsm_inst_dispatch(mmctx->iu.mm_state_fsm, E_PMM_IMPLICIT_DETACH, NULL); + osmo_fsm_inst_dispatch(mmctx->iu.mm_state_fsm, E_PMM_PS_DETACH, NULL); mmctx->gb.llme = rat_chg->llme; } diff --git a/src/sgsn/gprs_mm_state_gb_fsm.c b/src/sgsn/gprs_mm_state_gb_fsm.c index d3f2ea32..6e812d31 100644 --- a/src/sgsn/gprs_mm_state_gb_fsm.c +++ b/src/sgsn/gprs_mm_state_gb_fsm.c @@ -1,3 +1,25 @@ +/* TS 23.060 § 6.1.1 Mobility Management States (A/Gb mode) */ +/* + * (C) 2019 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de> + * All Rights Reserved + * + * SPDX-License-Identifier: AGPL-3.0+ + * + * Author: Pau Espin Pedrol <pespin@sysmocom.de> + * + * 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/core/tdef.h> #include <osmocom/sgsn/gprs_mm_state_gb_fsm.h> @@ -49,7 +71,7 @@ static void st_mm_ready(struct osmo_fsm_inst *fi, uint32_t event, void *data) case E_MM_READY_TIMER_EXPIRY: mm_state_gb_fsm_state_chg(fi, ST_MM_STANDBY); break; - case E_MM_IMPLICIT_DETACH: + case E_MM_GPRS_DETACH: mm_state_gb_fsm_state_chg(fi, ST_MM_IDLE); break; case E_MM_PDU_RECEPTION: @@ -68,7 +90,7 @@ static void st_mm_standby(struct osmo_fsm_inst *fi, uint32_t event, void *data) case E_MM_PDU_RECEPTION: mm_state_gb_fsm_state_chg(fi, ST_MM_READY); break; - case E_MM_IMPLICIT_DETACH: + case E_MM_GPRS_DETACH: mm_state_gb_fsm_state_chg(fi, ST_MM_IDLE); break; } @@ -83,13 +105,13 @@ static struct osmo_fsm_state mm_state_gb_fsm_states[] = { .action = st_mm_idle, }, [ST_MM_READY] = { - .in_event_mask = X(E_MM_READY_TIMER_EXPIRY) | X(E_MM_RA_UPDATE) | X(E_MM_IMPLICIT_DETACH) | X(E_MM_PDU_RECEPTION), + .in_event_mask = X(E_MM_READY_TIMER_EXPIRY) | X(E_MM_RA_UPDATE) | X(E_MM_GPRS_DETACH) | X(E_MM_PDU_RECEPTION), .out_state_mask = X(ST_MM_IDLE) | X(ST_MM_STANDBY), .name = "Ready", .action = st_mm_ready, }, [ST_MM_STANDBY] = { - .in_event_mask = X(E_MM_PDU_RECEPTION) | X(E_MM_IMPLICIT_DETACH), + .in_event_mask = X(E_MM_PDU_RECEPTION) | X(E_MM_GPRS_DETACH), .out_state_mask = X(ST_MM_IDLE) | X(ST_MM_READY), .name = "Standby", .action = st_mm_standby, @@ -99,7 +121,7 @@ static struct osmo_fsm_state mm_state_gb_fsm_states[] = { const struct value_string mm_state_gb_fsm_event_names[] = { OSMO_VALUE_STRING(E_MM_GPRS_ATTACH), OSMO_VALUE_STRING(E_MM_PDU_RECEPTION), - OSMO_VALUE_STRING(E_MM_IMPLICIT_DETACH), + OSMO_VALUE_STRING(E_MM_GPRS_DETACH), OSMO_VALUE_STRING(E_MM_READY_TIMER_EXPIRY), OSMO_VALUE_STRING(E_MM_RA_UPDATE), { 0, NULL } diff --git a/src/sgsn/gprs_mm_state_iu_fsm.c b/src/sgsn/gprs_mm_state_iu_fsm.c index e571026c..b1604f83 100644 --- a/src/sgsn/gprs_mm_state_iu_fsm.c +++ b/src/sgsn/gprs_mm_state_iu_fsm.c @@ -1,3 +1,25 @@ +/* TS 23.060 § 6.1.2 Mobility Management States (Iu mode) */ +/* + * (C) 2019 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de> + * All Rights Reserved + * + * SPDX-License-Identifier: AGPL-3.0+ + * + * Author: Pau Espin Pedrol <pespin@sysmocom.de> + * + * 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 <arpa/inet.h> #include <osmocom/core/tdef.h> @@ -12,8 +34,7 @@ static const struct osmo_tdef_state_timeout mm_state_iu_fsm_timeouts[32] = { [ST_PMM_DETACHED] = { }, - /* non-spec -T3314 (User inactivity timer) */ - [ST_PMM_CONNECTED] = { .T=-3314 }, + [ST_PMM_CONNECTED] = { }, [ST_PMM_IDLE] = { }, }; @@ -40,7 +61,7 @@ static void st_pmm_detached(struct osmo_fsm_inst *fi, uint32_t event, void *data case E_PMM_PS_ATTACH: mm_state_iu_fsm_state_chg(fi, ST_PMM_CONNECTED); break; - case E_PMM_IMPLICIT_DETACH: + case E_PMM_PS_DETACH: break; } } @@ -48,24 +69,16 @@ static void st_pmm_detached(struct osmo_fsm_inst *fi, uint32_t event, void *data static void st_pmm_connected(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct sgsn_mm_ctx *ctx = fi->priv; - const struct RANAP_Cause user_inactive_cause = { - .present = RANAP_Cause_PR_radioNetwork, - .choice.radioNetwork = RANAP_CauseRadioNetwork_user_inactivity, - }; switch(event) { case E_PMM_PS_CONN_RELEASE: sgsn_ranap_iu_free(ctx); mm_state_iu_fsm_state_chg(fi, ST_PMM_IDLE); break; - case E_PMM_IMPLICIT_DETACH: + case E_PMM_PS_DETACH: sgsn_ranap_iu_release_free(ctx, NULL); mm_state_iu_fsm_state_chg(fi, ST_PMM_DETACHED); break; - case E_PMM_USER_INACTIVITY: - sgsn_ranap_iu_release_free(ctx, &user_inactive_cause); - mm_state_iu_fsm_state_chg(fi, ST_PMM_DETACHED); - break; case E_PMM_RA_UPDATE: break; } @@ -81,43 +94,37 @@ static void st_pmm_idle_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) static void st_pmm_idle(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch(event) { + case E_PMM_PS_ATTACH: case E_PMM_PS_CONN_ESTABLISH: mm_state_iu_fsm_state_chg(fi, ST_PMM_CONNECTED); break; - case E_PMM_IMPLICIT_DETACH: + case E_PMM_PS_DETACH: mm_state_iu_fsm_state_chg(fi, ST_PMM_DETACHED); break; } } -static int pmm_state_fsm_timer_cb(struct osmo_fsm_inst *fi) -{ - switch(fi->state) { - case ST_PMM_CONNECTED: - /* timer for pmm state. state=CONNECTED: -T3314 (User inactivity timer) */ - osmo_fsm_inst_dispatch(fi, E_PMM_USER_INACTIVITY, NULL); - break; - } - - return 0; -} - static struct osmo_fsm_state mm_state_iu_fsm_states[] = { [ST_PMM_DETACHED] = { - .in_event_mask = X(E_PMM_PS_ATTACH) | X(E_PMM_IMPLICIT_DETACH), + .in_event_mask = X(E_PMM_PS_ATTACH) | X(E_PMM_PS_DETACH), .out_state_mask = X(ST_PMM_CONNECTED), .name = "Detached", .action = st_pmm_detached, }, [ST_PMM_CONNECTED] = { - .in_event_mask = X(E_PMM_PS_CONN_RELEASE) | X(E_PMM_RA_UPDATE) - | X(E_PMM_IMPLICIT_DETACH) | X(E_PMM_USER_INACTIVITY), + .in_event_mask = + X(E_PMM_PS_CONN_RELEASE) | + X(E_PMM_RA_UPDATE) | + X(E_PMM_PS_DETACH), .out_state_mask = X(ST_PMM_DETACHED) | X(ST_PMM_IDLE), .name = "Connected", .action = st_pmm_connected, }, [ST_PMM_IDLE] = { - .in_event_mask = X(E_PMM_IMPLICIT_DETACH) | X(E_PMM_PS_CONN_ESTABLISH), + .in_event_mask = + X(E_PMM_PS_DETACH) | + X(E_PMM_PS_CONN_ESTABLISH) | + X(E_PMM_PS_ATTACH), .out_state_mask = X(ST_PMM_DETACHED) | X(ST_PMM_CONNECTED), .name = "Idle", .onenter = st_pmm_idle_on_enter, @@ -129,9 +136,8 @@ const struct value_string mm_state_iu_fsm_event_names[] = { OSMO_VALUE_STRING(E_PMM_PS_ATTACH), OSMO_VALUE_STRING(E_PMM_PS_CONN_RELEASE), OSMO_VALUE_STRING(E_PMM_PS_CONN_ESTABLISH), - OSMO_VALUE_STRING(E_PMM_IMPLICIT_DETACH), + OSMO_VALUE_STRING(E_PMM_PS_DETACH), OSMO_VALUE_STRING(E_PMM_RA_UPDATE), - OSMO_VALUE_STRING(E_PMM_USER_INACTIVITY), { 0, NULL } }; @@ -140,7 +146,6 @@ struct osmo_fsm mm_state_iu_fsm = { .states = mm_state_iu_fsm_states, .num_states = ARRAY_SIZE(mm_state_iu_fsm_states), .event_names = mm_state_iu_fsm_event_names, - .timer_cb = pmm_state_fsm_timer_cb, .log_subsys = DMM, }; diff --git a/src/sgsn/gprs_ranap.c b/src/sgsn/gprs_ranap.c index 1f8ed97d..e8addd7e 100644 --- a/src/sgsn/gprs_ranap.c +++ b/src/sgsn/gprs_ranap.c @@ -120,7 +120,8 @@ int sgsn_ranap_iu_event(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type mm = sgsn_mm_ctx_by_ue_ctx(ctx); if (!mm) { - LOGIUP(ctx, LOGL_NOTICE, "Cannot find mm ctx for IU event %d\n", type); + LOGIUP(ctx, LOGL_NOTICE, "Cannot find mm ctx for IU event %s\n", + ranap_iu_event_type_str(type)); ranap_iu_free_ue(ctx); return rc; } @@ -133,10 +134,9 @@ int sgsn_ranap_iu_event(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type /* fall thru */ case RANAP_IU_EVENT_LINK_INVALIDATED: /* Clean up ranap_ue_conn_ctx here */ - LOGMMCTXP(LOGL_INFO, mm, "IU release for imsi %s\n", mm->imsi); - if (mm->iu.mm_state_fsm->state == ST_PMM_CONNECTED) - osmo_fsm_inst_dispatch(mm->iu.mm_state_fsm, E_PMM_PS_CONN_RELEASE, NULL); - else + LOGMMCTXP(LOGL_INFO, mm, "IU release (cause=%s)\n", ranap_iu_event_type_str(type)); + rc = osmo_fsm_inst_dispatch(mm->iu.mm_state_fsm, E_PMM_PS_CONN_RELEASE, NULL); + if (rc < 0) sgsn_ranap_iu_free(mm); /* TODO: move this into FSM */ diff --git a/src/sgsn/sgsn_main.c b/src/sgsn/sgsn_main.c index 2cabbf3c..71f2efad 100644 --- a/src/sgsn/sgsn_main.c +++ b/src/sgsn/sgsn_main.c @@ -310,11 +310,6 @@ static struct log_info_cat gprs_categories[] = { .description = "GPRS Packet Service", .enabled = 1, .loglevel = LOGL_NOTICE, }, - [DNS] = { - .name = "DNS", - .description = "GPRS Network Service (NS)", - .enabled = 1, .loglevel = LOGL_NOTICE, - }, [DLLC] = { .name = "DLLC", .description = "GPRS Logical Link Control Protocol (LLC)", @@ -410,6 +405,7 @@ int main(int argc, char **argv) rate_ctr_init(tall_sgsn_ctx); logging_vty_add_deprecated_subsys(tall_sgsn_ctx, "bssgp"); + logging_vty_add_deprecated_subsys(tall_sgsn_ctx, "ns"); sgsn_nsi = gprs_ns2_instantiate(tall_sgsn_ctx, &gprs_ns_prim_cb, NULL); if (!sgsn_nsi) { diff --git a/src/sgsn/sgsn_vty.c b/src/sgsn/sgsn_vty.c index d7584bcb..042bad5f 100644 --- a/src/sgsn/sgsn_vty.c +++ b/src/sgsn/sgsn_vty.c @@ -110,7 +110,6 @@ static struct osmo_tdef sgsn_T_defs[] = { /* non spec timers */ { .T=-1001, .default_val=NONSPEC_X1001_SECS, .desc="RANAP Release timeout. Wait for RANAP Release Complete." "On expiry release Iu connection (s)" }, - { .T=-3314, .default_val=GSM0408_T3314_SECS, .desc="Iu User inactivity timer. On expiry release Iu connection (s)" }, {} }; diff --git a/tests/osmo-sgsn_test-nodes.vty b/tests/osmo-sgsn_test-nodes.vty index 109e2ece..953a30ec 100644 --- a/tests/osmo-sgsn_test-nodes.vty +++ b/tests/osmo-sgsn_test-nodes.vty @@ -13,7 +13,6 @@ T3386 = 8 s Wait for MODIFY PDP CTX ACK timer (s) (default: 8 s) T3395 = 8 s Wait for DEACT PDP CTX ACK timer (s) (default: 8 s) T3397 = 8 s Wait for DEACT AA PDP CTX ACK timer (s) (default: 8 s) X1001 = 5 s RANAP Release timeout. Wait for RANAP Release Complete.On expiry release Iu connection (s) (default: 5 s) -X3314 = 44 s Iu User inactivity timer. On expiry release Iu connection (s) (default: 44 s) OsmoSGSN# configure terminal OsmoSGSN(config)# list ... diff --git a/tests/sgsn/sgsn_test.c b/tests/sgsn/sgsn_test.c index 05746206..63a7f3ee 100644 --- a/tests/sgsn/sgsn_test.c +++ b/tests/sgsn/sgsn_test.c @@ -1620,11 +1620,6 @@ static struct log_info_cat gprs_categories[] = { .description = "GPRS Packet Service", .enabled = 1, .loglevel = LOGL_DEBUG, }, - [DNS] = { - .name = "DNS", - .description = "GPRS Network Service (NS)", - .enabled = 1, .loglevel = LOGL_INFO, - }, [DLLC] = { .name = "DLLC", .description = "GPRS Logical Link Control Protocol (LLC)", |