Change in libosmocore[master]: gprs_ns2_sns: Add some more OSMO_ASSERT about BSS role

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Mar 23 23:28:52 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/23406 )

Change subject: gprs_ns2_sns: Add some more OSMO_ASSERT about BSS role
......................................................................

gprs_ns2_sns: Add some more OSMO_ASSERT about BSS role

Some functions are only to be called when operating in BSS role,
let's enforce that by sprinkling some OSMO_ASSERT() around.

Related: OS#3373
Change-Id: I20d1bd8df62e0bb84696e291756e2d96acf49246
---
M src/gb/gprs_ns2_sns.c
1 file changed, 17 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  daniel: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index c6e8642..51b3ea8 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -713,15 +713,20 @@
 
 static void ns2_sns_st_unconfigured(struct osmo_fsm_inst *fi, uint32_t event, void *data)
 {
+	struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
+	OSMO_ASSERT(gss->role == GPRS_SNS_ROLE_BSS);
 	/* empty state - SNS Select will start by ns2_sns_st_all_action() */
 }
 
 static void ns2_sns_st_size(struct osmo_fsm_inst *fi, uint32_t event, void *data)
 {
+	struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
 	struct gprs_ns2_nse *nse = nse_inst_from_fi(fi);
 	struct gprs_ns2_inst *nsi = nse->nsi;
 	struct tlv_parsed *tp = NULL;
 
+	OSMO_ASSERT(gss->role == GPRS_SNS_ROLE_BSS);
+
 	switch (event) {
 	case GPRS_SNS_EV_RX_SIZE_ACK:
 		tp = data;
@@ -849,6 +854,8 @@
 {
 	struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
 
+	OSMO_ASSERT(gss->role == GPRS_SNS_ROLE_BSS);
+
 	/* on a generic failure, the timer callback will recover */
 	if (old_state != GPRS_SNS_ST_UNCONFIGURED)
 		ns2_prim_status_ind(gss->nse, NULL, 0, GPRS_NS2_AFF_CAUSE_SNS_FAILURE);
@@ -890,8 +897,11 @@
 
 static void ns2_sns_st_config_bss(struct osmo_fsm_inst *fi, uint32_t event, void *data)
 {
-	struct tlv_parsed *tp = NULL;
+	struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
 	struct gprs_ns2_nse *nse = nse_inst_from_fi(fi);
+	struct tlv_parsed *tp = NULL;
+
+	OSMO_ASSERT(gss->role == GPRS_SNS_ROLE_BSS);
 
 	switch (event) {
 	case GPRS_SNS_EV_RX_CONFIG_ACK:
@@ -913,6 +923,8 @@
 {
 	struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
 
+	OSMO_ASSERT(gss->role == GPRS_SNS_ROLE_BSS);
+
 	if (old_state != GPRS_SNS_ST_CONFIG_BSS)
 		gss->N = 0;
 
@@ -998,6 +1010,8 @@
 {
 	struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
 
+	OSMO_ASSERT(gss->role == GPRS_SNS_ROLE_BSS);
+
 	if (old_state != GPRS_SNS_ST_CONFIG_SGSN)
 		gss->N = 0;
 }
@@ -1009,6 +1023,8 @@
 	uint8_t cause;
 	int rc;
 
+	OSMO_ASSERT(gss->role == GPRS_SNS_ROLE_BSS);
+
 	switch (event) {
 	case GPRS_SNS_EV_RX_CONFIG_END:
 	case GPRS_SNS_EV_RX_CONFIG:

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/23406
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I20d1bd8df62e0bb84696e291756e2d96acf49246
Gerrit-Change-Number: 23406
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210323/c957bdb2/attachment.htm>


More information about the gerrit-log mailing list