lynxis lazus has uploaded this change for review.
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 change 40691. To unsubscribe, or for help writing mail filters, visit settings.