neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32913 )
Change subject: unbloat: drop context_map_check_released()
......................................................................
unbloat: drop context_map_check_released()
When I implemented it, I thought context_map_check_released() would help
clarify context map deallocation, but instead it just bloats. Simplify
and tweak related comment.
Change-Id: I535780de0d3b09893ba89d66804e5e36b26db049
---
M include/osmocom/hnbgw/context_map.h
M src/osmo-hnbgw/context_map.c
M src/osmo-hnbgw/context_map_rua.c
M src/osmo-hnbgw/context_map_sccp.c
4 files changed, 22 insertions(+), 18 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/13/32913/1
diff --git a/include/osmocom/hnbgw/context_map.h b/include/osmocom/hnbgw/context_map.h
index 2b60958..a2e76c3 100644
--- a/include/osmocom/hnbgw/context_map.h
+++ b/include/osmocom/hnbgw/context_map.h
@@ -156,6 +156,6 @@
bool map_rua_is_active(struct hnbgw_context_map *map);
bool map_sccp_is_active(struct hnbgw_context_map *map);
-void context_map_check_released(struct hnbgw_context_map *map);
+void context_map_free(struct hnbgw_context_map *map);
unsigned int msg_has_l2_data(const struct msgb *msg);
diff --git a/src/osmo-hnbgw/context_map.c b/src/osmo-hnbgw/context_map.c
index c9507be..f610087 100644
--- a/src/osmo-hnbgw/context_map.c
+++ b/src/osmo-hnbgw/context_map.c
@@ -247,12 +247,3 @@
LOG_MAP(map, DMAIN, LOGL_INFO, "Deallocating\n");
talloc_free(map);
}
-
-void context_map_check_released(struct hnbgw_context_map *map)
-{
- if (map_rua_is_active(map) || map_sccp_is_active(map)) {
- /* still active, do not release yet. */
- return;
- }
- context_map_free(map);
-}
diff --git a/src/osmo-hnbgw/context_map_rua.c b/src/osmo-hnbgw/context_map_rua.c
index 5a715c4..f50f711 100644
--- a/src/osmo-hnbgw/context_map_rua.c
+++ b/src/osmo-hnbgw/context_map_rua.c
@@ -294,13 +294,13 @@
static void map_rua_disconnected_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
{
struct hnbgw_context_map *map = fi->priv;
- /* For sanity, always tell SCCP to disconnect, if it hasn't done so. Dispatching MAP_SCCP_EV_RAN_DISC may send
- * SCCP into MAP_RUA_ST_DISCONNECTED, which calls context_map_check_released() and frees the hnbgw_context_map,
- * so don't free it a second time. If SCCP stays active, calling context_map_check_released() has no effect. */
+ /* From RUA's POV, we can now free the hnbgw_context_map.
+ * If SCCP is still active, tell it to disconnect -- in that case the SCCP side will call context_map_free().
+ * If SCCP is no longer active, free this map. */
if (map_sccp_is_active(map))
map_sccp_dispatch(map, MAP_SCCP_EV_RAN_DISC, NULL);
else
- context_map_check_released(map);
+ context_map_free(map);
}
static void map_rua_disconnected_action(struct osmo_fsm_inst *fi, uint32_t event, void *data)
diff --git a/src/osmo-hnbgw/context_map_sccp.c b/src/osmo-hnbgw/context_map_sccp.c
index 8e04fba..132d03e 100644
--- a/src/osmo-hnbgw/context_map_sccp.c
+++ b/src/osmo-hnbgw/context_map_sccp.c
@@ -419,13 +419,13 @@
static void map_sccp_disconnected_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
{
struct hnbgw_context_map *map = fi->priv;
- /* For sanity, always tell RUA to disconnect, if it hasn't done so. Dispatching MAP_RUA_EV_CN_DISC may send
- * RUA into MAP_RUA_ST_DISCONNECTED, which calls context_map_check_released() and frees the hnbgw_context_map,
- * so don't free it a second time. If RUA stays active, calling context_map_check_released() has no effect. */
+ /* From SCCP's POV, we can now free the hnbgw_context_map.
+ * If RUA is still active, tell it to disconnect -- in that case the RUA side will call context_map_free().
+ * If RUA is no longer active, free this map. */
if (map_rua_is_active(map))
map_rua_dispatch(map, MAP_RUA_EV_CN_DISC, NULL);
else
- context_map_check_released(map);
+ context_map_free(map);
}
static void map_sccp_disconnected_action(struct osmo_fsm_inst *fi, uint32_t event, void *data)
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32913
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I535780de0d3b09893ba89d66804e5e36b26db049
Gerrit-Change-Number: 32913
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32911 )
Change subject: drop dead code: cnlink.T_RafC
......................................................................
drop dead code: cnlink.T_RafC
This looks like working RANAP RESET handling, but is in fact dead code.
Instead of testing and completing this implementation, I will copy the
RESET handling FSM from osmo-bsc, which is proven to work well.
See Id3eefdea889a736fd5957b80280fa45b9547b792
"detect in/active CN links by RANAP RESET"
The future patch will start to use transmit_rst(). So instead of
dropping now and resurrecting later, let's keep the code -- but it has
to be '#if 0'-ed to avoid compiler complaints about the unused function.
Related: SYS#6412
Change-Id: I7cacaec631051cf5420202f2f0dd9665a5565b17
---
M include/osmocom/hnbgw/hnbgw.h
M src/osmo-hnbgw/hnbgw_cn.c
2 files changed, 28 insertions(+), 55 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/11/32911/1
diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h
index e3ec38b..e67a86a 100644
--- a/include/osmocom/hnbgw/hnbgw.h
+++ b/include/osmocom/hnbgw/hnbgw.h
@@ -61,24 +61,9 @@
uint32_t cid; /*!< Cell ID */
};
-enum hnbgw_cnlink_state {
- /* we have just been initialized or were disconnected */
- CNLINK_S_NULL,
- /* establishment of the SUA/SCCP link is pending */
- CNLINK_S_EST_PEND,
- /* establishment of the SUA/SCCP link was confirmed */
- CNLINK_S_EST_CONF,
- /* we have esnt the RANAP RESET and wait for the ACK */
- CNLINK_S_EST_RST_TX_WAIT_ACK,
- /* we have received the RANAP RESET ACK and are active */
- CNLINK_S_EST_ACTIVE,
-};
-
struct hnbgw_cnlink {
struct llist_head list;
- enum hnbgw_cnlink_state state;
- /* timer for re-transmitting the RANAP Reset */
- struct osmo_timer_list T_RafC;
+
/* reference to the SCCP User SAP by which we communicate */
struct osmo_sccp_instance *sccp;
struct osmo_sccp_user *sccp_user;
diff --git a/src/osmo-hnbgw/hnbgw_cn.c b/src/osmo-hnbgw/hnbgw_cn.c
index a256b24..3e95528 100644
--- a/src/osmo-hnbgw/hnbgw_cn.c
+++ b/src/osmo-hnbgw/hnbgw_cn.c
@@ -37,14 +37,9 @@
#include <osmocom/ranap/ranap_msg_factory.h>
#include <osmocom/hnbgw/context_map.h>
-/***********************************************************************
- * Outbound RANAP RESET to CN
- ***********************************************************************/
-
-void hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state);
-
-static int transmit_rst(RANAP_CN_DomainIndicator_t domain,
- struct osmo_sccp_addr *remote_addr)
+#if 0
+-- this code will soon move to new file cnlink.c --
+static int transmit_rst(struct hnbgw_cnlink *cnlink)
{
struct msgb *msg;
RANAP_Cause_t cause = {
@@ -63,6 +58,7 @@
remote_addr,
msg);
}
+#endif
static int transmit_reset_ack(RANAP_CN_DomainIndicator_t domain,
const struct osmo_sccp_addr *remote_addr)
@@ -81,35 +77,6 @@
msg);
}
-/* Timer callback once T_RafC expires */
-static void cnlink_trafc_cb(void *unused)
-{
- transmit_rst(RANAP_CN_DomainIndicator_cs_domain, &g_hnbgw->sccp.iucs_remote_addr);
- transmit_rst(RANAP_CN_DomainIndicator_ps_domain, &g_hnbgw->sccp.iups_remote_addr);
- hnbgw_cnlink_change_state(g_hnbgw->sccp.cnlink, CNLINK_S_EST_RST_TX_WAIT_ACK);
- /* The spec states that we should abandon after a configurable
- * number of times. We decide to simply continue trying */
-}
-
-/* change the state of a CN Link */
-void hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state)
-{
- switch (state) {
- case CNLINK_S_NULL:
- case CNLINK_S_EST_PEND:
- break;
- case CNLINK_S_EST_CONF:
- cnlink_trafc_cb(NULL);
- break;
- case CNLINK_S_EST_RST_TX_WAIT_ACK:
- osmo_timer_schedule(&cnlink->T_RafC, 5, 0);
- break;
- case CNLINK_S_EST_ACTIVE:
- osmo_timer_del(&cnlink->T_RafC);
- break;
- }
-}
-
/***********************************************************************
* Incoming primitives from SCCP User SAP
***********************************************************************/
@@ -148,7 +115,8 @@
rc = ranap_decode_resetacknowledgeies(&ies, &omsg->value);
- hnbgw_cnlink_change_state(cnlink, CNLINK_S_EST_ACTIVE);
+ /* FUTURE: will do something useful in commit 'detect in/active CN links by RANAP RESET'
+ * Id3eefdea889a736fd5957b80280fa45b9547b792 */
ranap_free_resetacknowledgeies(&ies);
return rc;
@@ -527,7 +495,6 @@
cnlink = talloc_zero(g_hnbgw, struct hnbgw_cnlink);
INIT_LLIST_HEAD(&cnlink->map_list);
- cnlink->T_RafC.cb = cnlink_trafc_cb;
cnlink->next_conn_id = 1000;
cnlink->sccp_user = osmo_sccp_user_bind_pc(g_hnbgw->sccp.client, "OsmoHNBGW", sccp_sap_up,
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32911
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I7cacaec631051cf5420202f2f0dd9665a5565b17
Gerrit-Change-Number: 32911
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/32910 )
Change subject: gmm: Initial implementation of T3312
......................................................................
gmm: Initial implementation of T3312
The RAU procedure triggered by T3312 expiration will be implemented
in a follow-up patch.
Change-Id: If1ca164b7a6c7f7750e2e2f0812d6fde828ed4a4
---
M include/osmocom/gprs/gmm/gmm_private.h
M src/gmm/gmm.c
M src/gmm/gmm_ms_fsm.c
3 files changed, 86 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/10/32910/1
diff --git a/include/osmocom/gprs/gmm/gmm_private.h b/include/osmocom/gprs/gmm/gmm_private.h
index 0ae4df4..daa967f 100644
--- a/include/osmocom/gprs/gmm/gmm_private.h
+++ b/include/osmocom/gprs/gmm/gmm_private.h
@@ -66,7 +66,6 @@
char imei[GSM23003_IMEI_NUM_DIGITS + 1];
char imeisv[GSM23003_IMEISV_NUM_DIGITS+1];
- uint8_t ra_upd_timer; /* TS 24.008 10.5.7.3 */
uint8_t radio_prio; /* TS 24.008 10.5.7.2 */
struct gprs_ra_id ra; /* TS 24.008 10.5.5.15 (decoded) */
@@ -87,6 +86,8 @@
/* READY timer, TS 24.008 4.7.2.1.1 */
struct osmo_timer_list t3314;
unsigned long t3314_assigned_sec; /* value assigned by the network */
+ struct osmo_timer_list t3312; /* periodic RAU, in seconds */
+ unsigned long t3312_assigned_sec; /* value assigned by the network */
};
/* gmm_prim.c: */
@@ -116,6 +117,8 @@
void gprs_gmm_gmme_ready_timer_start(struct gprs_gmm_entity *gmme);
void gprs_gmm_gmme_ready_timer_stop(struct gprs_gmm_entity *gmme);
bool gprs_gmm_gmme_ready_timer_running(const struct gprs_gmm_entity *gmme);
+void gprs_gmm_gmme_t3312_start(struct gprs_gmm_entity *gmme);
+void gprs_gmm_gmme_t3312_stop(struct gprs_gmm_entity *gmme);
int gprs_gmm_rx(struct gprs_gmm_entity *gmme, struct gsm48_hdr *gh, unsigned int len);
int gprs_gmm_tx_att_req(struct gprs_gmm_entity *gmme,
enum osmo_gprs_gmm_attach_type attach_type,
diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c
index 5a3b0c0..6184a01 100644
--- a/src/gmm/gmm.c
+++ b/src/gmm/gmm.c
@@ -79,6 +79,7 @@
};
static void t3314_ready_timer_cb(void *data);
+static void t3312_periodic_rau_timer_cb(void *data);
static void gprs_gmm_ctx_free(void)
{
@@ -176,6 +177,7 @@
gmme->t3346 = osmo_tdef_get(g_gmm_ctx->T_defs, 3346, OSMO_TDEF_S, -1);
osmo_timer_setup(&gmme->t3314, t3314_ready_timer_cb, gmme);
+ osmo_timer_setup(&gmme->t3312, t3312_periodic_rau_timer_cb, gmme);
llist_add(&gmme->list, &g_gmm_ctx->gmme_list);
@@ -190,6 +192,8 @@
LOGGMME(gmme, LOGL_DEBUG, "free()\n");
if (osmo_timer_pending(&gmme->t3314))
osmo_timer_del(&gmme->t3314);
+ if (osmo_timer_pending(&gmme->t3312))
+ osmo_timer_del(&gmme->t3312);
gprs_gmm_ms_fsm_ctx_release(&gmme->ms_fsm);
llist_del(&gmme->list);
talloc_free(gmme);
@@ -295,20 +299,23 @@
LOGGMME(gmme, LOGL_INFO, "READY timer started\n");
osmo_timer_schedule(&gmme->t3314, gmme->t3314_assigned_sec, 0);
- /* TODO: "Timer T3312 is stopped and shall be set to its initial value
- * for the next start when the READY timer is started." */
+ /* "Timer T3312 is stopped and shall be set to its initial value
+ * for the next start when the READY timer is started.": */
+ gprs_gmm_gmme_t3312_stop(gmme);
}
/* Ready timer is stopped: */
void gprs_gmm_gmme_ready_timer_stop(struct gprs_gmm_entity *gmme)
{
- /* TODO: "In A/Gb mode, the timer T3312 is reset and started with its
- * initial value, when the READY timer is stopped or expires."
- */
if (!osmo_timer_pending(&gmme->t3314))
return;
LOGGMME(gmme, LOGL_INFO, "READY timer stopped\n");
osmo_timer_del(&gmme->t3314);
+
+ /* "In A/Gb mode, the timer T3312 is reset and started with its
+ * initial value, when the READY timer is stopped or expires."
+ */
+ gprs_gmm_gmme_t3312_start(gmme);
}
bool gprs_gmm_gmme_ready_timer_running(const struct gprs_gmm_entity *gmme)
@@ -325,10 +332,54 @@
struct gprs_gmm_entity *gmme = (struct gprs_gmm_entity *)data;
LOGGMME(gmme, LOGL_INFO, "READY timer expired\n");
- /* TODO: "In A/Gb mode, the timer T3312 is reset and started with its
- *initial value, when the READY timer is stopped or expires."
+ /* "In A/Gb mode, the timer T3312 is reset and started with its
+ * initial value, when the READY timer is stopped or expires.":
*/
+ gprs_gmm_gmme_t3312_start(gmme);
+}
+/* T3312 (Periodic RAU) is started: */
+void gprs_gmm_gmme_t3312_start(struct gprs_gmm_entity *gmme)
+{
+ unsigned long t3312_sec;
+
+ t3312_sec = osmo_tdef_get(g_gmm_ctx->T_defs, 3312, OSMO_TDEF_S, -1);
+ if (t3312_sec == 0)
+ return;
+
+ LOGGMME(gmme, LOGL_INFO, "T3312 started\n");
+ osmo_timer_schedule(&gmme->t3312, t3312_sec, 0);
+}
+
+/* T3312 (Periodic RAU) is stopped: */
+void gprs_gmm_gmme_t3312_stop(struct gprs_gmm_entity *gmme)
+{
+ if (!osmo_timer_pending(&gmme->t3312))
+ return;
+
+ LOGGMME(gmme, LOGL_INFO, "T3312 stopped\n");
+ osmo_timer_del(&gmme->t3312);
+}
+
+/* T3312 (Periodic RAU) timer expiration: */
+static void t3312_periodic_rau_timer_cb(void *data)
+{
+ struct gprs_gmm_entity *gmme = (struct gprs_gmm_entity *)data;
+ LOGGMME(gmme, LOGL_INFO, "T3312 Periodic RAU timer expired\n");
+
+ /* TODO:
+ * - "Initiation of the Periodic RAU procedure if the MS is not
+ * attached for emergency bearer services or T3323 started under the
+ * conditions as specified in subclause 4.7.2.2.
+ * - Implicit detach from network if the MS is attached for emergency
+ * bearer services."
+ * - "If the MS is in a state other than GMM-REGISTERED.NORMAL-SERVICE
+ * when timer T3312 expires, the periodic routing area updating procedure
+ * is delayed until the MS returns to GMM-REGISTERED.NORMAL-SERVICE."
+ * "If timer T3323 expires, the MS shall memorize that it has to initiate a
+ * routing area updating procedure when it returns to state
+ * GMM-REGISTERED.NORMAL-SERVICE."
+ */
}
int gprs_gmm_submit_gmmreg_attach_cnf(struct gprs_gmm_entity *gmme, bool accepted, uint8_t cause)
@@ -595,6 +646,7 @@
struct gsm48_attach_ack *aa;
struct tlv_parsed tp;
int rc;
+ int periodic_rau_sec;
if (len < sizeof(*gh) + sizeof(*aa)) {
LOGGMME(gmme, LOGL_ERROR, "Rx GMM ATTACH ACCEPT with wrong size %u\n", len);
@@ -604,8 +656,11 @@
LOGGMME(gmme, LOGL_INFO, "Rx GMM ATTACH ACCEPT\n");
aa = (struct gsm48_attach_ack *)&gh->data[0];
- gmme->ra_upd_timer = aa->ra_upd_timer;
+ periodic_rau_sec = gprs_gmm_gprs_tmr_to_secs(aa->ra_upd_timer);
gmme->radio_prio = aa->radio_prio;
+ gmme->t3312_assigned_sec = periodic_rau_sec >= 0 ? periodic_rau_sec : 0;
+ if (gmme->t3312_assigned_sec == 0)
+ gprs_gmm_gmme_t3312_stop(gmme);
gsm48_parse_ra(&gmme->ra, (const uint8_t *)&aa->ra_id);
if (len > sizeof(*gh) + sizeof(*aa)) {
@@ -632,8 +687,13 @@
gmme->t3314_assigned_sec = osmo_tdef_get(g_gmm_ctx->T_defs, 3314, OSMO_TDEF_S, -1);
}
/* "If the negotiated READY timer value is set to zero, the READY timer shall be stopped immediately": */
- if (gmme->t3314_assigned_sec == 0)
+ if (gmme->t3314_assigned_sec == 0) {
gprs_gmm_gmme_ready_timer_stop(gmme);
+ /* "If after a READY timer negotiation the READY timer
+ * value is set to zero, timer T3312 is reset and started
+ * with its initial value." */
+ gprs_gmm_gmme_t3312_start(gmme);
+ }
if (TLVP_PRESENT(&tp, GSM48_IE_GMM_ALLOC_PTMSI)) {
struct osmo_mobile_identity mi;
diff --git a/src/gmm/gmm_ms_fsm.c b/src/gmm/gmm_ms_fsm.c
index fcaf0d6..889d82a 100644
--- a/src/gmm/gmm_ms_fsm.c
+++ b/src/gmm/gmm_ms_fsm.c
@@ -75,6 +75,7 @@
struct gprs_gmm_ms_fsm_ctx *ctx = (struct gprs_gmm_ms_fsm_ctx *)fi->priv;
memset(&ctx->attach, 0, sizeof(ctx->attach));
+ gprs_gmm_gmme_t3312_stop(ctx->gmme);
}
static void st_gmm_ms_deregistered(struct osmo_fsm_inst *fi, uint32_t event, void *data)
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/32910
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: If1ca164b7a6c7f7750e2e2f0812d6fde828ed4a4
Gerrit-Change-Number: 32910
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: neels, laforge, pespin, lynxis lazus.
daniel has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hlr/+/32512 )
Change subject: Add support for multiple APN profiles for subscriber data
......................................................................
Patch Set 9: Code-Review-1
(1 comment)
File src/hlr_vty.c:
https://gerrit.osmocom.org/c/osmo-hlr/+/32512/comment/7125dfaf_68f1b1a9
PS9, Line 252: info->apn_enc = (uint8_t *) talloc_strdup(g_hlr, apn_name);
This is actually wrong since you simply copy the profile info over in the GSUP message.
osmo_gsup_configure_wildcard_apn() calls osmo_apn_from_str() which encodes the APN and prefixed the length in the beginning (in addition to apn_enc_len).
--
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/32512
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: I540132ee5dcfd09f4816e02e702927e1074ca50f
Gerrit-Change-Number: 32512
Gerrit-PatchSet: 9
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-CC: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Comment-Date: Mon, 22 May 2023 15:05:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment