lynxis lazus has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-remsim/+/40570?usp=email )
Change subject: bankd: implicit remove a client mapping when creating a new mapping
......................................................................
bankd: implicit remove a client mapping when creating a new mapping
After a desynchronisation between the server and bankd happen (e.g. restart the server),
the server might request a mapping between a client slot and a bankd slot
while the bankd still has a different mapping for the same client slot.
Example before this commit:
* server -> bankd: New Mapping (Client 1/0, Bankd 1/0)
* server <- bankd: Ack
* Restart server
* server -> bankd: New Mapping (Client 1/0, Bankd 2/0)
* server <- bankd: Reject (commit change to Ack)
Previous the second mapping got rejected, while the server
had no chance of knowing or asking the bankd to whats the old
mapping was.
Related: SYS#7470
Change-Id: Iae3f86a6e695e2d6580151b203df1dd0e2db625b
---
M src/bankd/bankd_main.c
1 file changed, 13 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/70/40570/1
diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c
index c43fe97..b7a94b6 100644
--- a/src/bankd/bankd_main.c
+++ b/src/bankd/bankd_main.c
@@ -207,7 +207,8 @@
} else {
rspro2bank_slot(&bs, &creq->bank);
rspro2client_slot(&cs, &creq->client);
- /* check if map exists */
+
+ /* check if slot map exists */
map = slotmap_by_bank(g_bankd->slotmaps, &bs);
if (map) {
if (client_slot_equals(&map->client, &cs)) {
@@ -215,10 +216,20 @@
resp = rspro_gen_CreateMappingRes(ResultCode_ok);
goto send_resp;
} else {
- LOGPFSML(srvc->fi, LOGL_NOTICE, "implicitly removing slotmap\n");
+ LOGPFSML(srvc->fi, LOGL_NOTICE, "slot already conntect to client %d:%d.
Removing old mapping.\n",
+ map->client.client_id, map->client.slot_nr);
bankd_srvc_remove_mapping(map);
}
}
+
+ /* check if client map exists */
+ map = slotmap_by_client(g_bankd->slotmaps, &cs);
+ if (map) {
+ LOGPFSML(srvc->fi, LOGL_NOTICE, "client already connected to slot %d:%d.
Removing old mapping.\n",
+ map->bank.bank_id, map->bank.slot_nr);
+ bankd_srvc_remove_mapping(map);
+ }
+
/* Add a new mapping */
map = slotmap_add(g_bankd->slotmaps, &bs, &cs);
if (!map) {
--
To view, visit
https://gerrit.osmocom.org/c/osmo-remsim/+/40570?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Iae3f86a6e695e2d6580151b203df1dd0e2db625b
Gerrit-Change-Number: 40570
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>