Change in osmo-remsim[master]: bankd: createMapping should implicitly delete existing mappings

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
Wed Dec 4 21:13:17 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-remsim/+/16478 )

Change subject: bankd: createMapping should implicitly delete existing mappings
......................................................................

bankd: createMapping should implicitly delete existing mappings

As explained in OS#4278, a remsim-bankd currently doesn't recover after
a remsim-server resetart, since old mappings remain in the bankd, and
the server has no chance of removing them.

To avoid this problem, a createMapping now always implicitly removes
any existing mapping that may exist for the given bankdSlot.

Change-Id: I83e319d22896b881c0d882542842f500075aa546
Closes: OS#4278
---
M src/bankd/bankd_main.c
1 file changed, 13 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c
index 7b50a73..03101fb 100644
--- a/src/bankd/bankd_main.c
+++ b/src/bankd/bankd_main.c
@@ -176,6 +176,18 @@
 		} else {
 			rspro2bank_slot(&bs, &creq->bank);
 			rspro2client_slot(&cs, &creq->client);
+			/* check if map exists */
+			map = slotmap_by_bank(g_bankd->slotmaps, &bs);
+			if (map) {
+				if (client_slot_equals(&map->client, &cs)) {
+					LOGPFSML(srvc->fi, LOGL_ERROR, "ignoring identical slotmap\n");
+					resp = rspro_gen_CreateMappingRes(ResultCode_ok);
+					goto send_resp;
+				} else {
+					LOGPFSM(srvc->fi, "implicitly removing slotmap\n");
+					bankd_srvc_remove_mapping(map);
+				}
+			}
 			/* Add a new mapping */
 			map = slotmap_add(g_bankd->slotmaps, &bs, &cs);
 			if (!map) {
@@ -184,6 +196,7 @@
 			} else
 				resp = rspro_gen_CreateMappingRes(ResultCode_ok);
 		}
+send_resp:
 		server_conn_send_rspro(srvc, resp);
 		break;
 	case RsproPDUchoice_PR_removeMappingReq:

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

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I83e319d22896b881c0d882542842f500075aa546
Gerrit-Change-Number: 16478
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191204/218ab5c9/attachment.htm>


More information about the gerrit-log mailing list