lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

June 2023

  • 1 participants
  • 2480 discussions
[L] Change in osmo-hnbgw[master]: cnpool: extract Mobile Identity from RANAP payload
by Jenkins Builder 01 Jun '23

01 Jun '23
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/33133 ) Change subject: cnpool: extract Mobile Identity from RANAP payload ...................................................................... Patch Set 1: (6 comments) File include/osmocom/hnbgw/context_map.h: Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7706): https://gerrit.osmocom.org/c/osmo-hnbgw/+/33133/comment/51c571de_06fed8d8 PS1, Line 13: ( (HNB_CTX_MAP)->cnlink ? (HNB_CTX_MAP)->cnlink->name \ space prohibited after that open parenthesis '(' Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7706): https://gerrit.osmocom.org/c/osmo-hnbgw/+/33133/comment/0187e235_f6d2cf7c PS1, Line 14: : ((HNB_CTX_MAP)->is_ps ? "PS" : "CS") ) \ space prohibited before that close parenthesis ')' File src/osmo-hnbgw/hnbgw_l3.c: Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7706): https://gerrit.osmocom.org/c/osmo-hnbgw/+/33133/comment/10c39cf3_40e08b45 PS1, Line 105: ra_id = (void*)cur; "(foo*)" should be "(foo *)" Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7706): https://gerrit.osmocom.org/c/osmo-hnbgw/+/33133/comment/bb32e155_21948b69 PS1, Line 133: ra_id = (void*)cur; "(foo*)" should be "(foo *)" Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7706): https://gerrit.osmocom.org/c/osmo-hnbgw/+/33133/comment/a1221e5c_5b231359 PS1, Line 174: gh = (void*)nas_pdu; "(foo*)" should be "(foo *)" Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7706): https://gerrit.osmocom.org/c/osmo-hnbgw/+/33133/comment/aa0aaf4e_0fc64bdb PS1, Line 192: lu = (struct gsm48_loc_upd_req*)gh->data; "(foo*)" should be "(foo *)" -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/33133 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I373d665c9684b607207f68094188eab63209db51 Gerrit-Change-Number: 33133 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Thu, 01 Jun 2023 02:43:28 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-hnbgw[master]: tdefs; combine timer groups 'ps' and 'cmap' to 'hnbgw'
by neels 01 Jun '23

01 Jun '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/33131 ) Change subject: tdefs; combine timer groups 'ps' and 'cmap' to 'hnbgw' ...................................................................... tdefs; combine timer groups 'ps' and 'cmap' to 'hnbgw' Makes no sense to have groups with one member each. Soon I will add a new timer that matches neither 'cmap' nor 'ps', and I would have to open a third group with a single member. Add a shim that redirects 'ps' to 'hnbgw'. The group 'cmap' has not yet been released, so just drop that one without a shim. Change-Id: Ica6063fae4588b51897e5574d975b3185fa9ae80 --- M include/osmocom/hnbgw/tdefs.h M src/osmo-hnbgw/context_map_rua.c M src/osmo-hnbgw/context_map_sccp.c M src/osmo-hnbgw/hnbgw_vty.c M src/osmo-hnbgw/ps_rab_ass_fsm.c M src/osmo-hnbgw/ps_rab_fsm.c M src/osmo-hnbgw/tdefs.c 7 files changed, 35 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/31/33131/1 diff --git a/include/osmocom/hnbgw/tdefs.h b/include/osmocom/hnbgw/tdefs.h index 6fee79b..6a27e36 100644 --- a/include/osmocom/hnbgw/tdefs.h +++ b/include/osmocom/hnbgw/tdefs.h @@ -3,6 +3,5 @@ #include <osmocom/core/tdef.h> extern struct osmo_tdef mgw_fsm_T_defs[]; -extern struct osmo_tdef ps_T_defs[]; -extern struct osmo_tdef cmap_T_defs[]; +extern struct osmo_tdef hnbgw_T_defs[]; extern struct osmo_tdef_group hnbgw_tdef_group[]; diff --git a/src/osmo-hnbgw/context_map_rua.c b/src/osmo-hnbgw/context_map_rua.c index 9e8f028..9cb45b0 100644 --- a/src/osmo-hnbgw/context_map_rua.c +++ b/src/osmo-hnbgw/context_map_rua.c @@ -67,7 +67,7 @@ #define map_rua_fsm_state_chg(state) \ OSMO_ASSERT(osmo_tdef_fsm_inst_state_chg(fi, state, \ map_rua_fsm_timeouts, \ - cmap_T_defs, \ + hnbgw_T_defs, \ 5) == 0) void map_rua_fsm_alloc(struct hnbgw_context_map *map) diff --git a/src/osmo-hnbgw/context_map_sccp.c b/src/osmo-hnbgw/context_map_sccp.c index 0e3d2b0..3bdec8c 100644 --- a/src/osmo-hnbgw/context_map_sccp.c +++ b/src/osmo-hnbgw/context_map_sccp.c @@ -73,7 +73,7 @@ #define map_sccp_fsm_state_chg(state) \ OSMO_ASSERT(osmo_tdef_fsm_inst_state_chg(fi, state, \ map_sccp_fsm_timeouts, \ - cmap_T_defs, \ + hnbgw_T_defs, \ 5) == 0) void map_sccp_fsm_alloc(struct hnbgw_context_map *map) diff --git a/src/osmo-hnbgw/hnbgw_vty.c b/src/osmo-hnbgw/hnbgw_vty.c index 3404a3f..a84fc25 100644 --- a/src/osmo-hnbgw/hnbgw_vty.c +++ b/src/osmo-hnbgw/hnbgw_vty.c @@ -794,6 +794,15 @@ #endif /* ENABLE_PFCP */ +DEFUN_DEPRECATED(cfg_hnbgw_timer_ps, cfg_hnbgw_timer_ps_cmd, + "timer ps " OSMO_TDEF_VTY_ARG_SET, + "Configure or show timers\n" + "Deprecated: 'ps' timers are now in 'hnbgw'\n" + OSMO_TDEF_VTY_DOC_SET) +{ + return osmo_tdef_vty_set_cmd(vty, hnbgw_T_defs, argv); +} + /* hnbgw * iucs } this part * foo } @@ -955,6 +964,7 @@ #endif osmo_tdef_vty_groups_init(HNBGW_NODE, hnbgw_tdef_group); + install_element(HNBGW_NODE, &cfg_hnbgw_timer_ps_cmd); install_element(CONFIG_NODE, &cfg_msc_nr_cmd); install_node(&msc_node, config_write_msc); diff --git a/src/osmo-hnbgw/ps_rab_ass_fsm.c b/src/osmo-hnbgw/ps_rab_ass_fsm.c index aa1fe74..4dff7c6 100644 --- a/src/osmo-hnbgw/ps_rab_ass_fsm.c +++ b/src/osmo-hnbgw/ps_rab_ass_fsm.c @@ -119,7 +119,7 @@ }; #define ps_rab_ass_fsm_state_chg(state) \ - osmo_tdef_fsm_inst_state_chg(fi, state, ps_rab_ass_fsm_timeouts, ps_T_defs, -1) + osmo_tdef_fsm_inst_state_chg(fi, state, ps_rab_ass_fsm_timeouts, hnbgw_T_defs, -1) static struct osmo_fsm ps_rab_ass_fsm; diff --git a/src/osmo-hnbgw/ps_rab_fsm.c b/src/osmo-hnbgw/ps_rab_fsm.c index bcf097d..df98826 100644 --- a/src/osmo-hnbgw/ps_rab_fsm.c +++ b/src/osmo-hnbgw/ps_rab_fsm.c @@ -72,7 +72,7 @@ #define ps_rab_fsm_state_chg(state) \ - osmo_tdef_fsm_inst_state_chg(fi, state, ps_rab_fsm_timeouts, ps_T_defs, -1) + osmo_tdef_fsm_inst_state_chg(fi, state, ps_rab_fsm_timeouts, hnbgw_T_defs, -1) #define PS_RAB_USE_ACTIVE "active" diff --git a/src/osmo-hnbgw/tdefs.c b/src/osmo-hnbgw/tdefs.c index 7af292d..645cdbf 100644 --- a/src/osmo-hnbgw/tdefs.c +++ b/src/osmo-hnbgw/tdefs.c @@ -31,20 +31,15 @@ { } }; -struct osmo_tdef ps_T_defs[] = { - {.T = -1002, .default_val = 10, .desc = "Timeout for the HNB to respond to PS RAB Assignment Request" }, - { } -}; - -struct osmo_tdef cmap_T_defs[] = { +struct osmo_tdef hnbgw_T_defs[] = { {.T = -31, .default_val = 5, .desc = "Timeout for discarding a partially released context map (RUA <-> SCCP)" }, + {.T = -1002, .default_val = 10, .desc = "Timeout for the HNB to respond to PS RAB Assignment Request" }, { } }; struct osmo_tdef_group hnbgw_tdef_group[] = { {.name = "mgw", .tdefs = mgw_fsm_T_defs, .desc = "MGW (Media Gateway) interface" }, - {.name = "ps", .tdefs = ps_T_defs, .desc = "timers for Packet Switched domain" }, - {.name = "cmap", .tdefs = cmap_T_defs, .desc = "timers for context maps (RUA <-> SCCP)" }, + {.name = "hnbgw", .tdefs = hnbgw_T_defs, .desc = "Timers" }, #if ENABLE_PFCP {.name = "pfcp", .tdefs = osmo_pfcp_tdefs, .desc = "PFCP timers" }, #endif -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/33131 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Ica6063fae4588b51897e5574d975b3185fa9ae80 Gerrit-Change-Number: 33131 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-hnbgw[master]: add hnbgw_decode_ranap_co()
by neels 01 Jun '23

01 Jun '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/33132 ) Change subject: add hnbgw_decode_ranap_co() ...................................................................... add hnbgw_decode_ranap_co() An upcoming patch will re-use this pattern of decoding RANAP and attaching a talloc destructor to the result for the third time. The caller will be in hnbgw_rua.c, so make this a "public" function. Change-Id: I3695babfb083ed1f5fff700dcb7646fa95496a52 --- M include/osmocom/hnbgw/hnbgw_rua.h M src/osmo-hnbgw/context_map_rua.c 2 files changed, 40 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/32/33132/1 diff --git a/include/osmocom/hnbgw/hnbgw_rua.h b/include/osmocom/hnbgw/hnbgw_rua.h index 1526f11..0bf2de8 100644 --- a/include/osmocom/hnbgw/hnbgw_rua.h +++ b/include/osmocom/hnbgw/hnbgw_rua.h @@ -2,6 +2,7 @@ #include <osmocom/hnbgw/hnbgw.h> #include <osmocom/rua/RUA_Cause.h> +#include <osmocom/ranap/ranap_ies_defs.h> int hnbgw_rua_rx(struct hnb_context *hnb, struct msgb *msg); @@ -10,3 +11,5 @@ const uint8_t *data, unsigned int len); int rua_tx_disc(struct hnb_context *hnb, int is_ps, uint32_t context_id, const RUA_Cause_t *cause, const uint8_t *data, unsigned int len); + +ranap_message *hnbgw_decode_ranap_co(struct msgb *ranap_msg); diff --git a/src/osmo-hnbgw/context_map_rua.c b/src/osmo-hnbgw/context_map_rua.c index 9cb45b0..09c275d 100644 --- a/src/osmo-hnbgw/context_map_rua.c +++ b/src/osmo-hnbgw/context_map_rua.c @@ -133,22 +133,38 @@ return 0; } +/* Decode RANAP message with convenient memory freeing: just talloc_free() the returned pointer.. + * Allocate a ranap_message from OTC_SELECT, decode RANAP msgb into it, attach a talloc destructor that calls + * ranap_cn_rx_co_free() upon talloc_free(), and return the decoded ranap_message. */ +ranap_message *hnbgw_decode_ranap_co(struct msgb *ranap_msg) +{ + int rc; + ranap_message *message; + + if (!msg_has_l2_data(ranap_msg)) + return NULL; + message = talloc_zero(OTC_SELECT, ranap_message); + rc = ranap_cn_rx_co_decode2(message, msgb_l2(ranap_msg), msgb_l2len(ranap_msg)); + if (rc != 0) { + talloc_free(message); + return NULL; + } + talloc_set_destructor(message, destruct_ranap_cn_rx_co_ies); + return message; +} + /* Dispatch RANAP message to SCCP, if any. */ static int handle_rx_rua(struct osmo_fsm_inst *fi, struct msgb *ranap_msg) { struct hnbgw_context_map *map = fi->priv; - int rc; if (!msg_has_l2_data(ranap_msg)) return 0; /* See if it is a RAB Assignment Response message from RUA to SCCP, where we need to change the user plane * information, for RTP mapping via MGW, or GTP mapping via UPF. */ if (!map->is_ps) { - ranap_message *message = talloc_zero(OTC_SELECT, ranap_message); - rc = ranap_cn_rx_co_decode2(message, msgb_l2(ranap_msg), msgb_l2len(ranap_msg)); - if (rc == 0) { - talloc_set_destructor(message, destruct_ranap_cn_rx_co_ies); - + ranap_message *message = hnbgw_decode_ranap_co(ranap_msg); + if (message) { LOGPFSML(fi, LOGL_DEBUG, "rx from RUA: RANAP %s\n", get_value_string(ranap_procedure_code_vals, message->procedureCode)); @@ -161,11 +177,8 @@ #if ENABLE_PFCP } else if (hnb_gw_is_gtp_mapping_enabled()) { /* map->is_ps == true and PFCP is enabled in osmo-hnbgw.cfg */ - ranap_message *message = talloc_zero(OTC_SELECT, ranap_message); - rc = ranap_cn_rx_co_decode2(message, msgb_l2(ranap_msg), msgb_l2len(ranap_msg)); - if (rc == 0) { - talloc_set_destructor(message, destruct_ranap_cn_rx_co_ies); - + ranap_message *message = hnbgw_decode_ranap_co(ranap_msg); + if (message) { LOGPFSML(fi, LOGL_DEBUG, "rx from RUA: RANAP %s\n", get_value_string(ranap_procedure_code_vals, message->procedureCode)); -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/33132 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I3695babfb083ed1f5fff700dcb7646fa95496a52 Gerrit-Change-Number: 33132 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in osmo-hnbgw[master]: cnpool: extract Mobile Identity from RANAP payload
by neels 01 Jun '23

01 Jun '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/33133 ) Change subject: cnpool: extract Mobile Identity from RANAP payload ...................................................................... cnpool: extract Mobile Identity from RANAP payload For InitialUE messages, decode the RANAP and NAS PDU to obtain the Mobile Identity. Store it in map->l3. A following patch will use this mobile identity to decide on which CN links to pick from the CN pools for this subscriber. Add the new information to LOG_MAP() as ubiquitous logging context. Related: SYS#6412 Change-Id: I373d665c9684b607207f68094188eab63209db51 --- M include/osmocom/hnbgw/context_map.h M include/osmocom/hnbgw/hnbgw.h M src/osmo-hnbgw/Makefile.am A src/osmo-hnbgw/hnbgw_l3.c M src/osmo-hnbgw/hnbgw_rua.c 5 files changed, 353 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/33/33133/1 diff --git a/include/osmocom/hnbgw/context_map.h b/include/osmocom/hnbgw/context_map.h index bcc3238..2920438 100644 --- a/include/osmocom/hnbgw/context_map.h +++ b/include/osmocom/hnbgw/context_map.h @@ -3,12 +3,19 @@ #include <stdint.h> #include <osmocom/core/linuxlist.h> #include <osmocom/hnbgw/hnbgw.h> +#include <osmocom/gsm/gsm48.h> #define LOG_MAP(HNB_CTX_MAP, SUBSYS, LEVEL, FMT, ARGS...) \ LOGHNB((HNB_CTX_MAP) ? (HNB_CTX_MAP)->hnb_ctx : NULL, \ - SUBSYS, LEVEL, "RUA-%u %s: " FMT, \ + SUBSYS, LEVEL, "RUA-%u %s MI=%s%s%s: " FMT, \ (HNB_CTX_MAP) ? (HNB_CTX_MAP)->rua_ctx_id : 0, \ - (HNB_CTX_MAP) ? ((HNB_CTX_MAP)->is_ps ? "PS" : "CS") : "NULL", \ + (HNB_CTX_MAP) ? \ + ( (HNB_CTX_MAP)->cnlink ? (HNB_CTX_MAP)->cnlink->name \ + : ((HNB_CTX_MAP)->is_ps ? "PS" : "CS") ) \ + : "NULL", \ + (HNB_CTX_MAP) ? osmo_mobile_identity_to_str_c(OTC_SELECT, &(HNB_CTX_MAP)->l3.mi) : "null", \ + (HNB_CTX_MAP) && (HNB_CTX_MAP)->l3.from_other_plmn ? " (from other PLMN)" : "", \ + (HNB_CTX_MAP) && (HNB_CTX_MAP)->l3.is_emerg ? " EMERGENCY" : "", \ ##ARGS) /* All these events' data argument may either be NULL, or point to a RANAP msgb. @@ -75,6 +82,21 @@ struct hnb_context; struct hnbgw_cnlink; +struct hnbgw_l3_peek { + /* L3 message type, like GSM48_PDISC_MM+GSM48_MT_MM_LOC_UPD_REQUEST... / GSM48_PDISC_MM_GPRS+GSM48_MT_GMM_ATTACH_REQ... */ + uint8_t gsm48_pdisc; + uint8_t gsm48_msg_type; + /* The Mobile Identity from MM and GMM messages */ + struct osmo_mobile_identity mi; + /* On PS, the "TMSI Based NRI Container", 10 bit integer, or -1 if not present. + * This is only for PS -- for CS, the NRI is in the TMSI obtained from 'mi' above. */ + int gmm_nri_container; + /* For a CM Service Request for voice call, true if this is for an Emergency Call, false otherwise. */ + bool is_emerg; + /* True if the NAS PDU indicates that the UE was previously attached to a different PLMN than the local PLMN. */ + bool from_other_plmn; +}; + struct hnbgw_context_map { /* entry in the per-CN list of mappings */ struct llist_head hnbgw_cnlink_entry; @@ -103,6 +125,9 @@ /* False for CS, true for PS */ bool is_ps; + /* Information extracted from RUA Connect's RANAP InitialUE message */ + struct hnbgw_l3_peek l3; + /* When an FSM is asked to disconnect but must still wait for a response, it may set this flag, to continue to * disconnect once the response is in. In particular, when SCCP is asked to disconnect after an SCCP Connection * Request was already sent and while waiting for a Connection Confirmed, we should still wait for the SCCP CC diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h index cc32f93..8183cbc 100644 --- a/include/osmocom/hnbgw/hnbgw.h +++ b/include/osmocom/hnbgw/hnbgw.h @@ -312,3 +312,5 @@ } struct msgb *hnbgw_ranap_msg_alloc(const char *name); + +int hnbgw_peek_l3(struct hnbgw_context_map *map, struct msgb *ranap_msg); diff --git a/src/osmo-hnbgw/Makefile.am b/src/osmo-hnbgw/Makefile.am index e8b4966..5fbdf74 100644 --- a/src/osmo-hnbgw/Makefile.am +++ b/src/osmo-hnbgw/Makefile.am @@ -33,6 +33,7 @@ libhnbgw_la_SOURCES = \ hnbgw.c \ hnbgw_hnbap.c \ + hnbgw_l3.c \ hnbgw_rua.c \ hnbgw_ranap.c \ hnbgw_vty.c \ diff --git a/src/osmo-hnbgw/hnbgw_l3.c b/src/osmo-hnbgw/hnbgw_l3.c new file mode 100644 index 0000000..97d958e --- /dev/null +++ b/src/osmo-hnbgw/hnbgw_l3.c @@ -0,0 +1,296 @@ +/* OsmoHNBGW implementation of CS and PS Level3 message decoding (NAS PDU */ + +/* Copyright 2023 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * All Rights Reserved + * + * Author: Neels Janosch Hofmeyr <nhofmeyr(a)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 "config.h" + +#include "asn1helpers.h" + +#include <osmocom/gsm/gsm48.h> +#include <osmocom/gsm/protocol/gsm_04_08_gprs.h> + +#include <osmocom/hnbgw/hnbgw.h> +#include <osmocom/hnbgw/hnbgw_rua.h> +#include <osmocom/hnbgw/context_map.h> +#include <osmocom/ranap/ranap_ies_defs.h> + +static const struct tlv_definition gsm48_gmm_att_tlvdef = { + .def = { + [GSM48_IE_GMM_CIPH_CKSN] = { TLV_TYPE_FIXED, 1 }, + [GSM48_IE_GMM_TIMER_READY] = { TLV_TYPE_TV, 1 }, + [GSM48_IE_GMM_TMSI_BASED_NRI_C] = { TLV_TYPE_TLV }, + [GSM48_IE_GMM_ALLOC_PTMSI] = { TLV_TYPE_TLV, 0 }, + [GSM48_IE_GMM_PTMSI_SIG] = { TLV_TYPE_FIXED, 3 }, + [GSM48_IE_GMM_AUTH_RAND] = { TLV_TYPE_FIXED, 16 }, + [GSM48_IE_GMM_AUTH_SRES] = { TLV_TYPE_FIXED, 4 }, + [GSM48_IE_GMM_IMEISV] = { TLV_TYPE_TLV, 0 }, + [GSM48_IE_GMM_DRX_PARAM] = { TLV_TYPE_FIXED, 2 }, + [GSM48_IE_GMM_MS_NET_CAPA] = { TLV_TYPE_TLV, 0 }, + [GSM48_IE_GMM_PDP_CTX_STATUS] = { TLV_TYPE_TLV, 0 }, + [GSM48_IE_GMM_PS_LCS_CAPA] = { TLV_TYPE_TLV, 0 }, + [GSM48_IE_GMM_GMM_MBMS_CTX_ST] = { TLV_TYPE_TLV, 0 }, + }, +}; + +static void decode_gmm_tlv(struct osmo_mobile_identity *mi, + struct osmo_routing_area_id *old_ra, + int *nri, + const uint8_t *tlv_data, size_t tlv_len, bool allow_hex) +{ + struct tlv_parsed tp; + struct tlv_p_entry *e; + + tlv_parse(&tp, &gsm48_gmm_att_tlvdef, tlv_data, tlv_len, 0, 0); + + e = TLVP_GET(&tp, GSM48_IE_GMM_TMSI_BASED_NRI_C); + if (e) { + *nri = e->val[0]; + *nri <<= 2; + *nri |= e->val[1] >> 6; + } +} + +static int mobile_identity_decode_from_gmm_att_req(struct osmo_mobile_identity *mi, + struct osmo_routing_area_id *old_ra, + int *nri, + const uint8_t *l3_data, size_t l3_len, bool allow_hex) +{ + const struct gsm48_hdr *gh = (void *)l3_data; + const uint8_t *cur = gh->data; + const uint8_t *mi_data; + uint8_t mi_len; + uint8_t msnc_len; + uint8_t ms_ra_acc_cap_len; + const struct gsm48_ra_id *ra_id; + int rc; + + /* MS network capability 10.5.5.12 */ + msnc_len = *cur++; + cur += msnc_len; + + /* aTTACH Type 10.5.5.2 */ + cur++; + + /* DRX parameter 10.5.5.6 */ + cur += 2; + + /* Mobile Identity (P-TMSI or IMSI) 10.5.1.4 */ + mi_len = *cur++; + mi_data = cur; + cur += mi_len; + + rc = osmo_mobile_identity_decode(mi, mi_data, mi_len, allow_hex); + if (rc) + return rc; + + /* Old routing area identification 10.5.5.15. */ + ra_id = (void*)cur; + osmo_plmn_from_bcd(ra_id->digits, &old_ra->lac.plmn); + old_ra->lac.lac = osmo_load16be(&ra_id->lac); + old_ra->rac = ra_id->rac; + cur += sizeof(*ra_id); + + /* MS Radio Access Capability 10.5.5.12a */ + ms_ra_acc_cap_len = *cur++; + cur += ms_ra_acc_cap_len; + + decode_gmm_tlv(mi, old_ra, nri, cur, (l3_data + l3_len) - cur, allow_hex); + return 0; +} + +static int mobile_identity_decode_from_gmm_rau_req(struct osmo_mobile_identity *mi, + struct osmo_routing_area_id *old_ra, + int *nri, + const uint8_t *l3_data, size_t l3_len, bool allow_hex) +{ + const struct gsm48_hdr *gh = (void *)l3_data; + const uint8_t *cur = gh->data; + uint8_t ms_ra_acc_cap_len; + const struct gsm48_ra_id *ra_id; + + /* Update Type 10.5.5.18 */ + cur++; + + /* Old routing area identification 10.5.5.15 */ + ra_id = (void*)cur; + osmo_plmn_from_bcd(ra_id->digits, &old_ra->lac.plmn); + old_ra->lac.lac = osmo_load16be(&ra_id->lac); + old_ra->rac = ra_id->rac; + cur += sizeof(*ra_id); + + /* MS Radio Access Capability 10.5.5.12a */ + ms_ra_acc_cap_len = *cur++; + cur += ms_ra_acc_cap_len; + + decode_gmm_tlv(mi, old_ra, nri, cur, (l3_data + l3_len) - cur, allow_hex); + return 0; +} + +static int peek_l3_nas(struct hnbgw_context_map *map, const uint8_t *nas_pdu, size_t len, + const struct osmo_plmn_id *local_plmn) +{ + const struct gsm48_hdr *gh; + int8_t pdisc; + uint8_t mtype; + const struct gsm48_loc_upd_req *lu; + struct gsm48_service_request *cm; + struct osmo_location_area_id old_lai; + struct osmo_routing_area_id old_ra = {}; + int nri = -1; + + map->l3 = (struct hnbgw_l3_peek){ + .gmm_nri_container = -1, + }; + + /* Get the mobile identity from CS MM -- the PS GMM happens further down. + * This will return an error for GMM messages, ignore that. */ + if (!map->is_ps) + osmo_mobile_identity_decode_from_l3_buf(&map->l3.mi, nas_pdu, len, false); + + /* Get is_emerg and from_other_plmn */ + if (len < sizeof(*gh)) { + LOGP(DCN, LOGL_ERROR, "Layer 3 message too short for header\n"); + return -EINVAL; + } + + gh = (void*)nas_pdu; + pdisc = gsm48_hdr_pdisc(gh); + mtype = gsm48_hdr_msg_type(gh); + + map->l3.gsm48_pdisc = pdisc; + map->l3.gsm48_msg_type = mtype; + + /* Determine from_other_plmn and is_emerg */ + switch (pdisc) { + case GSM48_PDISC_MM: + + switch (mtype) { + case GSM48_MT_MM_LOC_UPD_REQUEST: + if (len < sizeof(*gh) + sizeof(*lu)) { + LOGP(DCN, LOGL_ERROR, "LU Req message too short\n"); + break; + } + + lu = (struct gsm48_loc_upd_req*)gh->data; + gsm48_decode_lai2(&lu->lai, &old_lai); + + map->l3.from_other_plmn = (osmo_plmn_cmp(&old_lai.plmn, local_plmn) != 0); + LOGP(DCN, LOGL_DEBUG, "LU from_other_plmn=%d\n", map->l3.from_other_plmn); + break; + + case GSM48_MT_MM_CM_SERV_REQ: + if (len < sizeof(*gh) + sizeof(*cm)) { + LOGP(DCN, LOGL_ERROR, "CM Service Req message too short\n"); + break; + } + cm = (struct gsm48_service_request *)&gh->data[0]; + map->l3.is_emerg = (cm->cm_service_type == GSM48_CMSERV_EMERGENCY); + LOGP(DCN, LOGL_DEBUG, "CM Service is_emerg=%d\n", map->l3.is_emerg); + break; + + default: + break; + } + break; + + case GSM48_PDISC_MM_GPRS: + switch (mtype) { + case GSM48_MT_GMM_ATTACH_REQ: + mobile_identity_decode_from_gmm_att_req(&map->l3.mi, &old_ra, &nri, nas_pdu, len, false); + + LOGP(DRUA, LOGL_DEBUG, "GMM Attach Req mi=%s old_ra=%s nri:%d=0x%x\n", + osmo_mobile_identity_to_str_c(OTC_SELECT, &map->l3.mi), + osmo_rai_name2_c(OTC_SELECT, &old_ra), + nri, nri); + + if (old_ra.lac.plmn.mcc && osmo_plmn_cmp(&old_ra.lac.plmn, local_plmn)) { + map->l3.from_other_plmn = true; + LOGP(DRUA, LOGL_INFO, "GMM Attach Req from other PLMN: old RAI=%s my PLMN=%s\n", + osmo_rai_name2_c(OTC_SELECT, &old_ra), + osmo_plmn_name_c(OTC_SELECT, local_plmn)); + } + + if (nri >= 0) + map->l3.gmm_nri_container = nri; + + break; + + case GSM48_MT_GMM_RA_UPD_REQ: + mobile_identity_decode_from_gmm_rau_req(&map->l3.mi, &old_ra, &nri, nas_pdu, len, false); + + LOGP(DRUA, LOGL_DEBUG, "GMM Routing Area Upd Req mi=%s old_ra=%s nri:%d=0x%x\n", + osmo_mobile_identity_to_str_c(OTC_SELECT, &map->l3.mi), + osmo_rai_name2_c(OTC_SELECT, &old_ra), + nri, nri); + + if (old_ra.lac.plmn.mcc && osmo_plmn_cmp(&old_ra.lac.plmn, local_plmn)) { + map->l3.from_other_plmn = true; + LOGP(DRUA, LOGL_INFO, "GMM Routing Area Upd Req from other PLMN: old RAI=%s my PLMN=%s\n", + osmo_rai_name2_c(OTC_SELECT, &old_ra), + osmo_plmn_name_c(OTC_SELECT, local_plmn)); + } + + if (nri >= 0) + map->l3.gmm_nri_container = nri; + + break; + } + break; + + default: + break; + } + + return 0; +} + +static int peek_l3_initial_ue(struct hnbgw_context_map *map, const RANAP_InitialUE_MessageIEs_t *ies) +{ + struct osmo_plmn_id plmn; + + if (ies->lai.pLMNidentity.size < 3) { + LOGP(DCN, LOGL_ERROR, "Missing PLMN in RANAP InitialUE message\n"); + return -EINVAL; + } + osmo_plmn_from_bcd(ies->lai.pLMNidentity.buf, &plmn); + + return peek_l3_nas(map, ies->nas_pdu.buf, ies->nas_pdu.size, &plmn); +} + +/* Extract a Layer 3 message (NAS PDU) from the RANAP message, and put the info obtained in map->l3. This is relevant + * for CN pooling, to decide which CN link to map the RUA context to. */ +int hnbgw_peek_l3(struct hnbgw_context_map *map, struct msgb *ranap_msg) +{ + ranap_message *message = hnbgw_decode_ranap_co(ranap_msg); + if (!message) { + LOGP(DCN, LOGL_ERROR, "Failed to decode RANAP PDU\n"); + return -EINVAL; + } + + switch (message->procedureCode) { + case RANAP_ProcedureCode_id_InitialUE_Message: + return peek_l3_initial_ue(map, &message->msg.initialUE_MessageIEs); + default: + LOGP(DCN, LOGL_ERROR, "unexpected RANAP PDU in RUA Connect message: %s\n", + get_value_string(ranap_procedure_code_vals, message->procedureCode)); + return -ENOTSUP; + } +} diff --git a/src/osmo-hnbgw/hnbgw_rua.c b/src/osmo-hnbgw/hnbgw_rua.c index abda5ea..2a7dc20 100644 --- a/src/osmo-hnbgw/hnbgw_rua.c +++ b/src/osmo-hnbgw/hnbgw_rua.c @@ -38,7 +38,9 @@ #include <osmocom/rua/rua_common.h> #include <osmocom/rua/rua_ies_defs.h> #include <osmocom/hnbgw/context_map.h> +#include <osmocom/hnbgw/hnbgw_rua.h> #include <osmocom/hnbap/HNBAP_CN-DomainIndicator.h> +#include <osmocom/ranap/ranap_ies_defs.h> static const char *cn_domain_indicator_to_str(RUA_CN_DomainIndicator_t cN_DomainIndicator) { @@ -208,7 +210,13 @@ map = context_map_alloc(hnb, rua_ctx_id, is_ps); OSMO_ASSERT(map); - /* FUTURE: extract mobile identity and store in map-> */ + if (hnbgw_peek_l3(map, ranap_msg)) { + LOGP(DCN, LOGL_NOTICE, "Failed to extract Mobile Identity from RUA Connect message's RANAP payload\n"); + LOGP(DCN, LOGL_DEBUG, "Connect message's RANAP payload: %s\n", + osmo_hexdump_nospc_c(OTC_SELECT, ranap_msg->data, ranap_msg->len)); + /* still continue to select a hopefully adequate link */ + } + /* map->l3 now contains all the interesting information from the NAS PDU */ cnlink = hnbgw_cnlink_select(map); if (!cnlink) { -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/33133 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I373d665c9684b607207f68094188eab63209db51 Gerrit-Change-Number: 33133 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-hnbgw[master]: add CTRL transcript tests for cnpool rate ctrs
by neels 01 Jun '23

01 Jun '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/33135 ) Change subject: add CTRL transcript tests for cnpool rate ctrs ...................................................................... add CTRL transcript tests for cnpool rate ctrs Related: SYS#6412 Change-Id: I5a9a23c10e3ac85dabbb1d367351bb7c5dfe2526 --- M tests/Makefile.am A tests/test_nodes.ctrl 2 files changed, 34 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/35/33135/1 diff --git a/tests/Makefile.am b/tests/Makefile.am index f34d9a0..63ce3fe 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -26,6 +26,7 @@ $(TESTSUITE) \ osmo-hnbgw-vty-test.cfg \ $(srcdir)/*.vty \ + $(srcdir)/*.ctrl \ $(srcdir)/config/*.cfg \ $(srcdir)/config/*.vty \ $(srcdir)/config/run_tests.sh \ @@ -68,6 +69,18 @@ config-tests: $(srcdir)/config/run_tests.sh "$(top_builddir)/src/osmo-hnbgw/osmo-hnbgw" "$(srcdir)/config/" $U +# Run a specific test with: 'make ctrl-test CTRL_TEST=osmo-hnbgw.ctrl' +CTRL_TEST ?= *.ctrl + +# To update the CTRL script from current application behavior, +# pass -u to ctrl_script_runner.py by doing: +# make ctrl-test U=-u +ctrl-test: $(top_builddir)/src/osmo-hnbgw/osmo-hnbgw + osmo_verify_transcript_ctrl.py -v \ + -p 4262 \ + -r "$(top_builddir)/src/osmo-hnbgw/osmo-hnbgw -c $(top_srcdir)/doc/examples/osmo-hnbgw/osmo-hnbgw.cfg" \ + $(U) $(srcdir)/$(CTRL_TEST) + check-local: atconfig $(TESTSUITE) $(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS) $(MAKE) $(AM_MAKEFLAGS) python-tests diff --git a/tests/test_nodes.ctrl b/tests/test_nodes.ctrl new file mode 100644 index 0000000..2ce5428 --- /dev/null +++ b/tests/test_nodes.ctrl @@ -0,0 +1,11 @@ +GET 1 rate_ctr.abs.iucs.0.cnpool:subscr:no_cnlink +GET_REPLY 1 rate_ctr.abs.iucs.0.cnpool:subscr:no_cnlink 0 + +GET 2 rate_ctr.abs.iups.0.cnpool:emerg:lost +GET_REPLY 2 rate_ctr.abs.iups.0.cnpool:emerg:lost 0 + +GET 3 rate_ctr.abs.msc.0.cnpool:subscr:new +GET_REPLY 3 rate_ctr.abs.msc.0.cnpool:subscr:new 0 + +GET 4 rate_ctr.abs.sgsn.0.cnpool:emerg:forwarded +GET_REPLY 4 rate_ctr.abs.sgsn.0.cnpool:emerg:forwarded 0 -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/33135 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I5a9a23c10e3ac85dabbb1d367351bb7c5dfe2526 Gerrit-Change-Number: 33135 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-hnbgw[master]: cnpool: select CN link from pool by NRI or round robin
by neels 01 Jun '23

01 Jun '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/33136 ) Change subject: cnpool: select CN link from pool by NRI or round robin ...................................................................... cnpool: select CN link from pool by NRI or round robin This is the bulk of the CN pooling logic but is not working properly without these future patches: - detect in/active CN links by RANAP RESET Id3eefdea889a736fd5957b80280fa45b9547b792 - return Paging Resp to the exact CN link that Paged I907dbcaeb442ca5630146f8cad40601c448fc40e Change-Id: I66fba27cfbe6e2b27ee3443718846ecfbbd8a974 --- M src/osmo-hnbgw/hnbgw_cn.c 1 file changed, 162 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/36/33136/1 diff --git a/src/osmo-hnbgw/hnbgw_cn.c b/src/osmo-hnbgw/hnbgw_cn.c index 486d30a..f33023e 100644 --- a/src/osmo-hnbgw/hnbgw_cn.c +++ b/src/osmo-hnbgw/hnbgw_cn.c @@ -702,21 +702,155 @@ return NULL; } +static bool is_cnlink_usable(struct hnbgw_cnlink *cnlink, bool is_emerg) +{ + if (is_emerg && !cnlink->allow_emerg) + return false; + if (!cnlink->hnbgw_sccp_user || !cnlink->hnbgw_sccp_user->sccp_user) + return false; + // TODO indicator whether the CN link is actually active, akin to bssmap_reset_is_conn_ready() + return true; +} + +/* Decide which MSC/SGSN to forward this Complete Layer 3 request to. The current Layer 3 Info is passed in map->l3. + * a) If the subscriber was previously paged from a particular CN link, that CN link shall receive the Paging Response. + * b) If the message contains an NRI indicating a particular CN link that is currently connected, that CN link shall + * handle this conn. + * c) All other cases distribute the messages across connected CN links in a round-robin fashion. + */ struct hnbgw_cnlink *hnbgw_cnlink_select(struct hnbgw_context_map *map) { struct hnbgw_cnpool *cnpool = map->is_ps ? &g_hnbgw->sccp.cnpool_iups : &g_hnbgw->sccp.cnpool_iucs; struct hnbgw_cnlink *cnlink; - /* FUTURE: soon we will pick one of many configurable CN peers from a pool. There will be more input arguments - * (MI, or TMSI, or NRI decoded from RANAP) and this function will do round robin for new subscribers. */ - llist_for_each_entry(cnlink, &cnpool->cnlinks, entry) { - if (!cnlink->hnbgw_sccp_user || !cnlink->hnbgw_sccp_user->sccp_user) - continue; - LOG_MAP(map, DCN, LOGL_INFO, "Selected %s / %s\n", - cnlink->name, - cnlink->hnbgw_sccp_user->name); - return cnlink; + struct hnbgw_cnlink *round_robin_next = NULL; + struct hnbgw_cnlink *round_robin_first = NULL; + unsigned int round_robin_next_nr; + int16_t nri_v = -1; + bool is_null_nri = false; + uint8_t nri_bitlen = cnpool->use.nri_bitlen; + +#define LOG_NRI(LOGLEVEL, FORMAT, ARGS...) \ + LOG_MAP(map, DCN, LOGLEVEL, "%s NRI(%dbit)=0x%x=%d: " FORMAT, osmo_mobile_identity_to_str_c(OTC_SELECT, &map->l3.mi), \ + nri_bitlen, nri_v, nri_v, ##ARGS) + + /* Get the NRI bits either from map->l3.nri, or extract NRI bits from TMSI. + * The NRI possibly indicates which MSC is responsible. */ + if (map->l3.gmm_nri_container >= 0) { + nri_v = map->l3.gmm_nri_container; + /* The 'TMSI based NRI container' is always 10 bits long. If the relevant NRI length is configured to be + * less than that, ignore the lower bits. */ + if (nri_bitlen < 10) + nri_v >>= 10 - nri_bitlen; + } else if (map->l3.mi.type == GSM_MI_TYPE_TMSI) { + if (osmo_tmsi_nri_v_get(&nri_v, map->l3.mi.tmsi, nri_bitlen)) { + LOG_NRI(LOGL_ERROR, "Unable to retrieve NRI from TMSI 0x%x, nri_bitlen == %u\n", map->l3.mi.tmsi, + nri_bitlen); + nri_v = -1; + } } - return NULL; + + if (map->l3.from_other_plmn && nri_v >= 0) { + /* If a subscriber was previously attached to a different PLMN, it might still send the other + * PLMN's TMSI identity in an IMSI Attach. The LU sends a LAI indicating the previous PLMN. If + * it mismatches our PLMN, ignore the NRI. */ + LOG_NRI(LOGL_DEBUG, + "This Complete Layer 3 message indicates a switch from another PLMN. Ignoring the NRI.\n"); + nri_v = -1; + } + + if (nri_v >= 0) + is_null_nri = osmo_nri_v_matches_ranges(nri_v, cnpool->use.null_nri_ranges); + if (is_null_nri) + LOG_NRI(LOGL_DEBUG, "this is a NULL-NRI\n"); + + /* Iterate CN links to find one that matches the extracted NRI, and the next round-robin target for the case no + * NRI match is found. */ + round_robin_next_nr = (map->l3.is_emerg ? cnpool->round_robin_next_emerg_nr : cnpool->round_robin_next_nr); + llist_for_each_entry(cnlink, &cnpool->cnlinks, entry) { + bool nri_matches_cnlink = (nri_v >= 0 && osmo_nri_v_matches_ranges(nri_v, cnlink->use.nri_ranges)); + + if (!is_cnlink_usable(cnlink, map->l3.is_emerg)) { + if (nri_matches_cnlink) { + LOG_NRI(LOGL_DEBUG, "NRI matches %s %d, but this %s is currently not connected\n", + cnpool->peer_name, cnlink->nr, cnpool->peer_name); + rate_ctr_inc(rate_ctr_group_get_ctr(cnlink->ctrs, CNLINK_CTR_CNPOOL_SUBSCR_ATTACH_LOST)); + } + continue; + } + + /* Return CN link if it matches this NRI, with some debug logging. */ + if (nri_matches_cnlink) { + if (is_null_nri) { + LOG_NRI(LOGL_DEBUG, "NRI matches %s %d, but this NRI is also configured as NULL-NRI\n", + cnpool->peer_name, cnlink->nr); + } else { + LOG_NRI(LOGL_INFO, "NRI match selects %s %d\n", cnpool->peer_name, cnlink->nr); + rate_ctr_inc(rate_ctr_group_get_ctr(cnlink->ctrs, CNLINK_CTR_CNPOOL_SUBSCR_KNOWN)); + if (map->l3.is_emerg) { + rate_ctr_inc(rate_ctr_group_get_ctr(cnlink->ctrs, CNLINK_CTR_CNPOOL_EMERG_FORWARDED)); + rate_ctr_inc(rate_ctr_group_get_ctr(cnpool->ctrs, CNPOOL_CTR_EMERG_FORWARDED)); + } + return cnlink; + } + } + + /* Figure out the next round-robin MSC. The MSCs may appear unsorted in net->mscs. Make sure to linearly + * round robin the MSCs by number: pick the lowest msc->nr >= round_robin_next_nr, and also remember the + * lowest available msc->nr to wrap back to that in case no next MSC is left. + * + * MSCs configured with `no allow-attach` do not accept new subscribers and hence must not be picked by + * round-robin. Such an MSC still provides service for already attached subscribers: those that + * successfully performed IMSI-Attach and have a TMSI with an NRI pointing at that MSC. We only avoid + * adding IMSI-Attach of new subscribers. The idea is that the MSC is in a mode of off-loading + * subscribers, and the MSC decides when each subscriber is off-loaded, by assigning the NULL-NRI in a + * new TMSI (at the next periodical LU). So until the MSC decides to offload, an attached subscriber + * remains attached to that MSC and is free to use its services. + */ + if (!cnlink->allow_attach) + continue; + /* Find the allowed cnlink with the lowest nr */ + if (!round_robin_first || cnlink->nr < round_robin_first->nr) + round_robin_first = cnlink; + /* Find the allowed cnlink with the lowest nr >= round_robin_next_nr */ + if (cnlink->nr >= round_robin_next_nr + && (!round_robin_next || cnlink->nr < round_robin_next->nr)) + round_robin_next = cnlink; + } + + if (nri_v >= 0 && !is_null_nri) + LOG_NRI(LOGL_DEBUG, "No %s found for this NRI, doing round-robin\n", cnpool->peer_name); + + /* No dedicated CN link found. Choose by round-robin. + * If round_robin_next is NULL, there are either no more CN links at/after round_robin_next_nr, or none of + * them are usable -- wrap to the start. */ + cnlink = round_robin_next ? : round_robin_first; + if (!cnlink) { + rate_ctr_inc(rate_ctr_group_get_ctr(cnpool->ctrs, CNPOOL_CTR_SUBSCR_NO_CNLINK)); + if (map->l3.is_emerg) + rate_ctr_inc(rate_ctr_group_get_ctr(cnpool->ctrs, CNPOOL_CTR_EMERG_LOST)); + return NULL; + } + + LOGP(DCN, LOGL_DEBUG, "New subscriber MI=%s: CN link round-robin selects %s %d\n", + osmo_mobile_identity_to_str_c(OTC_SELECT, &map->l3.mi), cnpool->peer_name, cnlink->nr); + + if (is_null_nri) + rate_ctr_inc(rate_ctr_group_get_ctr(cnlink->ctrs, CNLINK_CTR_CNPOOL_SUBSCR_REATTACH)); + else + rate_ctr_inc(rate_ctr_group_get_ctr(cnlink->ctrs, CNLINK_CTR_CNPOOL_SUBSCR_NEW)); + + if (map->l3.is_emerg) { + rate_ctr_inc(rate_ctr_group_get_ctr(cnlink->ctrs, CNLINK_CTR_CNPOOL_EMERG_FORWARDED)); + rate_ctr_inc(rate_ctr_group_get_ctr(cnpool->ctrs, CNPOOL_CTR_EMERG_FORWARDED)); + } + + /* A CN link was picked by round-robin, so update the next round-robin nr to pick */ + if (map->l3.is_emerg) + cnpool->round_robin_next_emerg_nr = cnlink->nr + 1; + else + cnpool->round_robin_next_nr = cnlink->nr + 1; + return cnlink; +#undef LOG_NRI } char *cnlink_sccp_addr_to_str(struct hnbgw_cnlink *cnlink, const struct osmo_sccp_addr *addr) -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/33136 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I66fba27cfbe6e2b27ee3443718846ecfbbd8a974 Gerrit-Change-Number: 33136 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-hnbgw[master]: add rate_ctr infra; add rate_ctrs for cnpool
by neels 01 Jun '23

01 Jun '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/33134 ) Change subject: add rate_ctr infra; add rate_ctrs for cnpool ...................................................................... add rate_ctr infra; add rate_ctrs for cnpool Introduce rate counter stats to osmo-hnbgw. Add the first rate counters -- they will be fed in upcoming commit "cnpool: select CN link from pool by NRI or round robin" I66fba27cfbe6e2b27ee3443718846ecfbbd8a974 Related: SYS#6412 Change-Id: I0132d053223a38e5756cede74106019c47ddcd94 --- M include/osmocom/hnbgw/hnbgw.h M include/osmocom/hnbgw/hnbgw_cn.h M src/osmo-hnbgw/hnbgw.c M src/osmo-hnbgw/hnbgw_cn.c M src/osmo-hnbgw/osmo_hnbgw_main.c 5 files changed, 153 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/34/33134/1 diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h index 8183cbc..62e5392 100644 --- a/include/osmocom/hnbgw/hnbgw.h +++ b/include/osmocom/hnbgw/hnbgw.h @@ -5,6 +5,7 @@ #include <osmocom/core/hashtable.h> #include <osmocom/core/write_queue.h> #include <osmocom/core/timer.h> +#include <osmocom/core/rate_ctr.h> #include <osmocom/sigtran/sccp_sap.h> #include <osmocom/sigtran/osmo_ss7.h> #include <osmocom/ctrl/control_if.h> @@ -135,6 +136,12 @@ /* Emergency calls potentially select a different set of MSCs, so to not mess up the normal round-robin * behavior, emergency calls need a separate round-robin counter. */ unsigned int round_robin_next_emerg_nr; + + /* rate counter group that child hnbgw_cnlinks should use (points to msc_ctrg_desc or sgsn_ctrg_desc) */ + const struct rate_ctr_group_desc *cnlink_ctrg_desc; + + /* Running counters for this pool */ + struct rate_ctr_group *ctrs; }; /* A CN peer, like 'msc 0' or 'sgsn 23' */ @@ -164,6 +171,8 @@ bool allow_attach; bool allow_emerg; + + struct rate_ctr_group *ctrs; }; #define LOG_CNLINK(CNLINK, SUBSYS, LEVEL, FMT, ARGS...) \ diff --git a/include/osmocom/hnbgw/hnbgw_cn.h b/include/osmocom/hnbgw/hnbgw_cn.h index 79d3c27..bd54a1f 100644 --- a/include/osmocom/hnbgw/hnbgw_cn.h +++ b/include/osmocom/hnbgw/hnbgw_cn.h @@ -1,5 +1,6 @@ #pragma once +#include <osmocom/core/rate_ctr.h> #include <osmocom/hnbgw/hnbgw.h> struct hnbgw_cnlink *hnbgw_cnlink_find_by_addr(const struct hnbgw_sccp_user *hsu, @@ -13,3 +14,33 @@ char *cnlink_sccp_addr_to_str(struct hnbgw_cnlink *cnlink, const struct osmo_sccp_addr *addr); +enum hnbgw_cnpool_ctr { + /* TODO: basic counters completely missing + * ... + */ + + /* Counters related to link selection from a CN pool. */ + CNPOOL_CTR_SUBSCR_NO_CNLINK, + CNPOOL_CTR_EMERG_FORWARDED, + CNPOOL_CTR_EMERG_LOST, +}; + +extern const struct rate_ctr_group_desc iucs_ctrg_desc; +extern const struct rate_ctr_group_desc iups_ctrg_desc; + +enum hnbgw_cnlink_ctr { + /* TODO: basic counters completely missing + * ... + */ + + /* Counters related to link selection from a CN pool. */ + CNLINK_CTR_CNPOOL_SUBSCR_NEW, + CNLINK_CTR_CNPOOL_SUBSCR_REATTACH, + CNLINK_CTR_CNPOOL_SUBSCR_KNOWN, + CNLINK_CTR_CNPOOL_SUBSCR_PAGED, + CNLINK_CTR_CNPOOL_SUBSCR_ATTACH_LOST, + CNLINK_CTR_CNPOOL_EMERG_FORWARDED, +}; + +extern const struct rate_ctr_group_desc msc_ctrg_desc; +extern const struct rate_ctr_group_desc sgsn_ctrg_desc; diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c index 0d64adf..1fd04e1 100644 --- a/src/osmo-hnbgw/hnbgw.c +++ b/src/osmo-hnbgw/hnbgw.c @@ -36,6 +36,7 @@ #include <osmocom/hnbgw/hnbgw.h> #include <osmocom/hnbgw/hnbgw_hnbap.h> #include <osmocom/hnbgw/hnbgw_rua.h> +#include <osmocom/hnbgw/hnbgw_cn.h> #include <osmocom/hnbgw/context_map.h> struct hnbgw *g_hnbgw = NULL; @@ -72,6 +73,9 @@ .nri_bitlen = OSMO_NRI_BITLEN_DEFAULT, .null_nri_ranges = osmo_nri_ranges_alloc(g_hnbgw), }, + .cnlink_ctrg_desc = &msc_ctrg_desc, + + .ctrs = rate_ctr_group_alloc(g_hnbgw, &iucs_ctrg_desc, 0), }; INIT_LLIST_HEAD(&g_hnbgw->sccp.cnpool_iucs.cnlinks); @@ -84,6 +88,9 @@ .nri_bitlen = OSMO_NRI_BITLEN_DEFAULT, .null_nri_ranges = osmo_nri_ranges_alloc(g_hnbgw), }, + .cnlink_ctrg_desc = &sgsn_ctrg_desc, + + .ctrs = rate_ctr_group_alloc(g_hnbgw, &iups_ctrg_desc, 0), }; INIT_LLIST_HEAD(&g_hnbgw->sccp.cnpool_iups.cnlinks); } diff --git a/src/osmo-hnbgw/hnbgw_cn.c b/src/osmo-hnbgw/hnbgw_cn.c index 9dc2016..486d30a 100644 --- a/src/osmo-hnbgw/hnbgw_cn.c +++ b/src/osmo-hnbgw/hnbgw_cn.c @@ -26,6 +26,7 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/utils.h> #include <osmocom/core/timer.h> +#include <osmocom/core/stats.h> #include <osmocom/gsm/gsm23236.h> @@ -655,6 +656,7 @@ .nri_ranges = osmo_nri_ranges_alloc(cnlink), }, .allow_attach = true, + .ctrs = rate_ctr_group_alloc(g_hnbgw, cnpool->cnlink_ctrg_desc, nr), }; INIT_LLIST_HEAD(&cnlink->map_list); @@ -724,3 +726,81 @@ return osmo_sccp_addr_dump(addr); return osmo_sccp_inst_addr_to_str_c(OTC_SELECT, sccp, addr); } + +static const struct rate_ctr_desc cnlink_ctr_description[] = { + + /* Indicators for CN pool usage */ + [CNLINK_CTR_CNPOOL_SUBSCR_NEW] = { + "cnpool:subscr:new", + "Complete Layer 3 requests assigned to this CN link by round-robin (no NRI was assigned yet).", + }, + [CNLINK_CTR_CNPOOL_SUBSCR_REATTACH] = { + "cnpool:subscr:reattach", + "Complete Layer 3 requests assigned to this CN link by round-robin because the subscriber indicates a" + " NULL-NRI (previously assigned by another CN link).", + }, + [CNLINK_CTR_CNPOOL_SUBSCR_KNOWN] = { + "cnpool:subscr:known", + "Complete Layer 3 requests directed to this CN link because the subscriber indicates an NRI of this CN link.", + }, + [CNLINK_CTR_CNPOOL_SUBSCR_PAGED] = { + "cnpool:subscr:paged", + "Paging Response directed to this CN link because the subscriber was recently paged by this CN link.", + }, + [CNLINK_CTR_CNPOOL_SUBSCR_ATTACH_LOST] = { + "cnpool:subscr:attach_lost", + "A subscriber indicates an NRI value matching this CN link, but the CN link is not connected:" + " a re-attach to another CN link (if available) was forced, with possible service failure.", + }, + [CNLINK_CTR_CNPOOL_EMERG_FORWARDED] = { + "cnpool:emerg:forwarded", + "Emergency call requests forwarded to this CN link.", + }, +}; + +const struct rate_ctr_group_desc msc_ctrg_desc = { + "msc", + "MSC", + OSMO_STATS_CLASS_GLOBAL, + ARRAY_SIZE(cnlink_ctr_description), + cnlink_ctr_description, +}; + +const struct rate_ctr_group_desc sgsn_ctrg_desc = { + "sgsn", + "SGSN", + OSMO_STATS_CLASS_GLOBAL, + ARRAY_SIZE(cnlink_ctr_description), + cnlink_ctr_description, +}; + +static const struct rate_ctr_desc cnpool_ctr_description[] = { + [CNPOOL_CTR_SUBSCR_NO_CNLINK] = { + "cnpool:subscr:no_cnlink", + "Complete Layer 3 requests lost because no connected CN link is found available", + }, + [CNPOOL_CTR_EMERG_FORWARDED] = { + "cnpool:emerg:forwarded", + "Emergency call requests forwarded to a CN link (see also per-CN-link counters)", + }, + [CNPOOL_CTR_EMERG_LOST] = { + "cnpool:emerg:lost", + "Emergency call requests lost because no CN link was found available", + }, +}; + +const struct rate_ctr_group_desc iucs_ctrg_desc = { + "iucs", + "IuCS", + OSMO_STATS_CLASS_GLOBAL, + ARRAY_SIZE(cnpool_ctr_description), + cnpool_ctr_description, +}; + +const struct rate_ctr_group_desc iups_ctrg_desc = { + "iups", + "IuPS", + OSMO_STATS_CLASS_GLOBAL, + ARRAY_SIZE(cnpool_ctr_description), + cnpool_ctr_description, +}; diff --git a/src/osmo-hnbgw/osmo_hnbgw_main.c b/src/osmo-hnbgw/osmo_hnbgw_main.c index 30f3de9..d371914 100644 --- a/src/osmo-hnbgw/osmo_hnbgw_main.c +++ b/src/osmo-hnbgw/osmo_hnbgw_main.c @@ -25,6 +25,7 @@ #include <osmocom/core/application.h> #include <osmocom/core/logging.h> +#include <osmocom/core/stats.h> #include <osmocom/vty/vty.h> #include <osmocom/vty/command.h> @@ -32,6 +33,7 @@ #include <osmocom/vty/misc.h> #include <osmocom/vty/telnet_interface.h> #include <osmocom/vty/ports.h> +#include <osmocom/vty/stats.h> #include <osmocom/ctrl/control_vty.h> #include <osmocom/ctrl/ports.h> @@ -194,6 +196,13 @@ if (rc < 0) exit(1); + osmo_stats_init(g_hnbgw); + rc = rate_ctr_init(g_hnbgw); + if (rc) { + LOGP(DMAIN, LOGL_FATAL, "rate_ctr_init() failed with rc=%d\n", rc); + exit(1); + } + osmo_fsm_log_timeouts(true); rc = osmo_ss7_init(); @@ -211,6 +220,7 @@ ctrl_vty_init(g_hnbgw); logging_vty_add_cmds(); osmo_talloc_vty_add_cmds(); + osmo_stats_vty_add_cmds(); /* Handle options after vty_init(), for --version */ handle_options(argc, argv); -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/33134 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I0132d053223a38e5756cede74106019c47ddcd94 Gerrit-Change-Number: 33134 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in osmo-hnbgw[master]: cnpool: make NRI mappings VTY configurable
by Jenkins Builder 01 Jun '23

01 Jun '23
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/33130 ) Change subject: cnpool: make NRI mappings VTY configurable ...................................................................... Patch Set 1: (6 comments) File src/osmo-hnbgw/hnbgw_vty.c: Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7702): https://gerrit.osmocom.org/c/osmo-hnbgw/+/33130/comment/d7a5cf79_b5dec2f7 PS1, Line 357: #define NRI_ARGS_TO_STR_ARGS(ARGC, ARGV) ARGV[0], (ARGC>1)? ".." : "", (ARGC>1)? ARGV[1] : "" spaces required around that '>' (ctx:VxV) Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7702): https://gerrit.osmocom.org/c/osmo-hnbgw/+/33130/comment/112bce24_6df75d80 PS1, Line 357: #define NRI_ARGS_TO_STR_ARGS(ARGC, ARGV) ARGV[0], (ARGC>1)? ".." : "", (ARGC>1)? ARGV[1] : "" spaces required around that '?' (ctx:VxW) Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7702): https://gerrit.osmocom.org/c/osmo-hnbgw/+/33130/comment/5c6cd2eb_4a6f9cd9 PS1, Line 357: #define NRI_ARGS_TO_STR_ARGS(ARGC, ARGV) ARGV[0], (ARGC>1)? ".." : "", (ARGC>1)? ARGV[1] : "" spaces required around that '>' (ctx:VxV) Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7702): https://gerrit.osmocom.org/c/osmo-hnbgw/+/33130/comment/9811da44_2752ca42 PS1, Line 357: #define NRI_ARGS_TO_STR_ARGS(ARGC, ARGV) ARGV[0], (ARGC>1)? ".." : "", (ARGC>1)? ARGV[1] : "" spaces required around that '?' (ctx:VxW) Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7702): https://gerrit.osmocom.org/c/osmo-hnbgw/+/33130/comment/86fa6295_23be62a4 PS1, Line 518: if (message) { braces {} are not necessary for single statement blocks Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7702): https://gerrit.osmocom.org/c/osmo-hnbgw/+/33130/comment/235f054c_728cc61b PS1, Line 558: if (message) { braces {} are not necessary for single statement blocks -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/33130 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Ifb87e01e5971962e5cfe5e127871af4a67806de1 Gerrit-Change-Number: 33130 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Thu, 01 Jun 2023 02:42:27 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-hnbgw[master]: cnpool: examples and config tests: use 'msc 0'/'sgsn 0' syntax
by neels 01 Jun '23

01 Jun '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/33129 ) Change subject: cnpool: examples and config tests: use 'msc 0'/'sgsn 0' syntax ...................................................................... cnpool: examples and config tests: use 'msc 0'/'sgsn 0' syntax After recent introduction of multiple 'msc' and 'sgsn' nodes in the VTY config, switch cfg files to the new syntax: - in doc/examples - for 'make config-tests' - have one test in old config syntax to test backwards compat: 'legacy', an exact copy of 'one_cs7_with_addrs'. Related: SYS#6412 Change-Id: If999b71a8a8237699f6ccfcaa31d1885e66c0518 --- M doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg A tests/config/legacy.cfg A tests/config/legacy.vty M tests/config/one_cs7_with_addrs.cfg M tests/config/one_cs7_with_iucs_addr.cfg M tests/config/one_cs7_with_iups_addr.cfg M tests/config/two_cs7_with_addrs.cfg 7 files changed, 92 insertions(+), 20 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/29/33129/1 diff --git a/doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg b/doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg index 5e78947..daf0668 100644 --- a/doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg +++ b/doc/examples/osmo-hnbgw/osmo-hnbgw-cs7.cfg @@ -11,10 +11,10 @@ iuh local-ip 0.0.0.0 hnbap-allow-tmsi 1 - iucs - remote-addr my-msc - iups - remote-addr my-sgsn +msc 0 + remote-addr my-msc +sgsn 0 + remote-addr my-sgsn log stderr logging filter all 1 diff --git a/tests/config/legacy.cfg b/tests/config/legacy.cfg new file mode 100644 index 0000000..0369bd4 --- /dev/null +++ b/tests/config/legacy.cfg @@ -0,0 +1,12 @@ +# explicitly point at cs7 instance 0 via two address book entries for CS and PS. Leave ASP and AS to auto-configuration. +cs7 instance 0 + point-code 1.1.1 + sccp-address my-msc + point-code 1.2.3 + sccp-address my-sgsn + point-code 1.4.2 +hnbgw + iucs + remote-addr my-msc + iups + remote-addr my-sgsn diff --git a/tests/config/legacy.vty b/tests/config/legacy.vty new file mode 100644 index 0000000..4df44a5 --- /dev/null +++ b/tests/config/legacy.vty @@ -0,0 +1,47 @@ +OsmoHNBGW> enable + +OsmoHNBGW# ### ASP and AS were auto-configured +OsmoHNBGW# show cs7 config +cs7 instance 0 + point-code 1.1.1 + asp asp-clnt-msc-0 2905 0 m3ua + local-ip localhost + remote-ip localhost + sctp-role client + as as-clnt-msc-0 m3ua + asp asp-clnt-msc-0 + routing-key 0 1.1.1 + sccp-address my-msc + routing-indicator PC + point-code 1.2.3 + sccp-address my-sgsn + routing-indicator PC + point-code 1.4.2 + +OsmoHNBGW# ### IuCS and IuPS were explicitly pointed to specific remote point-codes, using cs7 instance 0 addresses +OsmoHNBGW# show cnlink +IuCS: OsmoHNBGW:RI=SSN_PC,PC=1.1.1,SSN=RANAP <-> my-msc=RI=SSN_PC,PC=1.2.3,SSN=RANAP + SS7 route: pc=0=0.0.0 mask=0x0=0.0.0 via AS as-clnt-msc-0 proto=m3ua ASP asp-clnt-msc-0 +IuPS: OsmoHNBGW:RI=SSN_PC,PC=1.1.1,SSN=RANAP <-> my-sgsn=RI=SSN_PC,PC=1.4.2,SSN=RANAP + SS7 route: pc=0=0.0.0 mask=0x0=0.0.0 via AS as-clnt-msc-0 proto=m3ua ASP asp-clnt-msc-0 + +OsmoHNBGW# show running-config +... +cs7 instance 0 + point-code 1.1.1 + sccp-address my-msc + routing-indicator PC + point-code 1.2.3 + sccp-address my-sgsn + routing-indicator PC + point-code 1.4.2 +hnbgw + rnc-id 23 + log-prefix hnb-id + iuh +... +msc 0 + remote-addr my-msc +sgsn 0 + remote-addr my-sgsn +... diff --git a/tests/config/one_cs7_with_addrs.cfg b/tests/config/one_cs7_with_addrs.cfg index 0369bd4..5075bfd 100644 --- a/tests/config/one_cs7_with_addrs.cfg +++ b/tests/config/one_cs7_with_addrs.cfg @@ -5,8 +5,7 @@ point-code 1.2.3 sccp-address my-sgsn point-code 1.4.2 -hnbgw - iucs - remote-addr my-msc - iups - remote-addr my-sgsn +msc 0 + remote-addr my-msc +sgsn 0 + remote-addr my-sgsn diff --git a/tests/config/one_cs7_with_iucs_addr.cfg b/tests/config/one_cs7_with_iucs_addr.cfg index 9e0207e..406243f 100644 --- a/tests/config/one_cs7_with_iucs_addr.cfg +++ b/tests/config/one_cs7_with_iucs_addr.cfg @@ -3,6 +3,5 @@ point-code 1.1.1 sccp-address my-msc point-code 1.2.3 -hnbgw - iucs - remote-addr my-msc +msc 0 + remote-addr my-msc diff --git a/tests/config/one_cs7_with_iups_addr.cfg b/tests/config/one_cs7_with_iups_addr.cfg index 96e7afa..8684870 100644 --- a/tests/config/one_cs7_with_iups_addr.cfg +++ b/tests/config/one_cs7_with_iups_addr.cfg @@ -3,6 +3,5 @@ point-code 1.1.1 sccp-address my-sgsn point-code 1.4.2 -hnbgw - iups - remote-addr my-sgsn +sgsn 0 + remote-addr my-sgsn diff --git a/tests/config/two_cs7_with_addrs.cfg b/tests/config/two_cs7_with_addrs.cfg index 57f13e3..2249e8f 100644 --- a/tests/config/two_cs7_with_addrs.cfg +++ b/tests/config/two_cs7_with_addrs.cfg @@ -10,8 +10,7 @@ sccp-address my-sgsn point-code 2.4.2 -hnbgw - iucs - remote-addr my-msc - iups - remote-addr my-sgsn +msc 0 + remote-addr my-msc +sgsn 0 + remote-addr my-sgsn -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/33129 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: If999b71a8a8237699f6ccfcaa31d1885e66c0518 Gerrit-Change-Number: 33129 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-hnbgw[master]: cnpool prep: add SCCP_EV_USER_ABORT
by neels 01 Jun '23

01 Jun '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/33128 ) Change subject: cnpool prep: add SCCP_EV_USER_ABORT ...................................................................... cnpool prep: add SCCP_EV_USER_ABORT To ease patch review, I decided to submit this separately from the caller, which follows in subsequent patch I5479eded786ec26062d49403a8be12967f113cdb The new event will be dispatched when there are SCCP config changes pending, and the human user types 'apply sccp' on the telnet VTY. The aim is to disconnect all connections so we can create a new SCCP User. Related: SYS#6412 Change-Id: Idff8e09b5328c904b175e4d4df7d4044a34f4a20 --- M include/osmocom/hnbgw/context_map.h M src/osmo-hnbgw/context_map_sccp.c 2 files changed, 38 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/28/33128/1 diff --git a/include/osmocom/hnbgw/context_map.h b/include/osmocom/hnbgw/context_map.h index 55d96ea..bcc3238 100644 --- a/include/osmocom/hnbgw/context_map.h +++ b/include/osmocom/hnbgw/context_map.h @@ -55,6 +55,9 @@ MAP_SCCP_EV_RAN_LINK_LOST, /* Receiving an SCCP RLSD from CN, or libosmo-sigtran tells us about SCCP connection timeout. All done. */ MAP_SCCP_EV_RX_RELEASED, + /* The human admin asks to drop the current SCCP connection, by telnet VTY 'apply sccp' in presence of SCCP + * config changes. */ + MAP_SCCP_EV_USER_ABORT, }; /* For context_map_get_state(), to combine the RUA and SCCP states, for VTY reporting only. */ diff --git a/src/osmo-hnbgw/context_map_sccp.c b/src/osmo-hnbgw/context_map_sccp.c index 00b24f2..cc65b6e 100644 --- a/src/osmo-hnbgw/context_map_sccp.c +++ b/src/osmo-hnbgw/context_map_sccp.c @@ -54,6 +54,7 @@ OSMO_VALUE_STRING(MAP_SCCP_EV_RAN_DISC), OSMO_VALUE_STRING(MAP_SCCP_EV_RAN_LINK_LOST), OSMO_VALUE_STRING(MAP_SCCP_EV_RX_RELEASED), + OSMO_VALUE_STRING(MAP_SCCP_EV_USER_ABORT), {} }; @@ -281,6 +282,7 @@ case MAP_SCCP_EV_RAN_LINK_LOST: case MAP_SCCP_EV_RAN_DISC: + case MAP_SCCP_EV_USER_ABORT: /* No CR has been sent yet, just go to disconnected state. */ if (msg_has_l2_data(ranap_msg)) LOG_MAP(map, DLSCCP, LOGL_ERROR, "SCCP not connected, cannot dispatch RANAP message\n"); @@ -317,6 +319,7 @@ case MAP_SCCP_EV_RAN_LINK_LOST: case MAP_SCCP_EV_RAN_DISC: + case MAP_SCCP_EV_USER_ABORT: /* RUA connection was terminated. First wait for the CC before releasing the SCCP conn. */ if (msg_has_l2_data(ranap_msg)) LOGPFSML(fi, LOGL_ERROR, "Connection not yet confirmed, cannot forward RANAP to CN\n"); @@ -373,6 +376,9 @@ case MAP_SCCP_EV_RAN_LINK_LOST: /* RUA has disconnected ungracefully, so there is no Iu Release that told the CN to disconnect. * Disconnect on the SCCP layer, ungracefully. */ + case MAP_SCCP_EV_USER_ABORT: + /* The user is asking for disconnection, so there is no Iu Release in progress. Disconnect now. */ + /* There won't be any ranap_msg, but if a caller wants to dispatch a msg, forward it before * disconnecting. */ tx_sccp_df1(fi, ranap_msg); @@ -440,6 +446,12 @@ handle_rx_sccp(fi, ranap_msg); return; + case MAP_SCCP_EV_USER_ABORT: + /* Stop waiting for RLSD, send RLSD now. */ + tx_sccp_rlsd(fi); + map_sccp_fsm_state_chg(MAP_SCCP_ST_DISCONNECTED); + return; + default: OSMO_ASSERT(false); } @@ -511,6 +523,7 @@ | S(MAP_SCCP_EV_RAN_DISC) | S(MAP_SCCP_EV_RAN_LINK_LOST) | S(MAP_SCCP_EV_RX_RELEASED) + | S(MAP_SCCP_EV_USER_ABORT) , .out_state_mask = 0 | S(MAP_SCCP_ST_INIT) @@ -527,6 +540,7 @@ | S(MAP_SCCP_EV_RAN_DISC) | S(MAP_SCCP_EV_RAN_LINK_LOST) | S(MAP_SCCP_EV_RX_RELEASED) + | S(MAP_SCCP_EV_USER_ABORT) , .out_state_mask = 0 | S(MAP_SCCP_ST_CONNECTED) @@ -543,6 +557,7 @@ | S(MAP_SCCP_EV_RAN_LINK_LOST) | S(MAP_SCCP_EV_RX_RELEASED) | S(MAP_SCCP_EV_RX_CONNECTION_CONFIRM) + | S(MAP_SCCP_EV_USER_ABORT) , .out_state_mask = 0 | S(MAP_SCCP_ST_WAIT_RLSD) @@ -560,6 +575,7 @@ | S(MAP_SCCP_EV_RAN_DISC) | S(MAP_SCCP_EV_RAN_LINK_LOST) | S(MAP_SCCP_EV_RX_CONNECTION_CONFIRM) + | S(MAP_SCCP_EV_USER_ABORT) , .out_state_mask = 0 | S(MAP_SCCP_ST_DISCONNECTED) @@ -573,6 +589,7 @@ | S(MAP_SCCP_EV_TX_DATA_REQUEST) | S(MAP_SCCP_EV_RAN_DISC) | S(MAP_SCCP_EV_RAN_LINK_LOST) + | S(MAP_SCCP_EV_USER_ABORT) , .onenter = map_sccp_disconnected_onenter, .action = map_sccp_disconnected_action, -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/33128 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Idff8e09b5328c904b175e4d4df7d4044a34f4a20 Gerrit-Change-Number: 33128 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 244
  • 245
  • 246
  • 247
  • 248
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.