lynxis lazus has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-sgsn/+/40691?usp=email )
Change subject: routing area: on alloc, check if RA already exists
......................................................................
routing area: on alloc, check if RA already exists
If the RA is the same, return the RA, but if the ran type is different,
return NULL.
Change-Id: I6955a09d9d8f3ba4dc3a14d7ed5cd9798d929c61
---
M src/sgsn/gprs_routing_area.c
1 file changed, 15 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/91/40691/1
diff --git a/src/sgsn/gprs_routing_area.c b/src/sgsn/gprs_routing_area.c
index 3c84008..5c465d9 100644
--- a/src/sgsn/gprs_routing_area.c
+++ b/src/sgsn/gprs_routing_area.c
@@ -80,7 +80,21 @@
struct sgsn_ra *sgsn_ra_alloc(const struct osmo_routing_area_id *rai, enum
sgsn_ra_ran_type ran_type)
{
- struct sgsn_ra *ra;
+ struct sgsn_ra *ra = sgsn_ra_get_ra(rai);
+
+ if (ra) {
+ if (ra->ran_type == ran_type) {
+ LOGP(DRA, LOGL_ERROR, "Trying to create an already existing RA %s with the same
ran type %s. Using old RA.\n",
+ osmo_rai_name2(rai), get_value_string(sgsn_ra_ran_type_names, ra->ran_type));
+
+ return ra;
+ }
+
+ LOGP(DRA, LOGL_ERROR, "Failed to create an already existing RA %s with a different
ran type %s.\n",
+ osmo_rai_name2(rai), get_value_string(sgsn_ra_ran_type_names, ra->ran_type));
+ return NULL;
+ }
+
ra = talloc_zero(sgsn->routing_area, struct sgsn_ra);
if (!ra)
return NULL;
--
To view, visit
https://gerrit.osmocom.org/c/osmo-sgsn/+/40691?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I6955a09d9d8f3ba4dc3a14d7ed5cd9798d929c61
Gerrit-Change-Number: 40691
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>