aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-10-11 19:52:36 +0200
committerlaforge <laforge@osmocom.org>2020-10-12 13:08:42 +0000
commit896fcd5c80962767dd2ed413fb348d4e178262d5 (patch)
tree3bac28416ab089287f9ec3d3d16705bdd0c930da
parent05e7f7dd9974095df3f8cc4688fab100ab30e4df (diff)
gprs_ns2: add gprs_ns2_free_binds() to free all binds
Allow users to clean up all binds (e.g. the PCU). Change-Id: Ic8f6f8aca10da23a18fab8870be7806065a34b47
-rw-r--r--include/osmocom/gprs/gprs_ns2.h1
-rw-r--r--src/gb/gprs_ns2.c14
-rw-r--r--src/gb/libosmogb.map1
3 files changed, 12 insertions, 4 deletions
diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index d798ac49..2c58723a 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -131,6 +131,7 @@ struct gprs_ns2_vc *gprs_ns2_ip_connect_inactive(struct gprs_ns2_vc_bind *bind,
uint16_t nsvci);
void gprs_ns2_free_bind(struct gprs_ns2_vc_bind *bind);
+void gprs_ns2_free_binds(struct gprs_ns2_inst *nsi);
/* create a VC SNS connection */
int gprs_ns2_ip_connect_sns(struct gprs_ns2_vc_bind *bind,
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 58304cdf..e3fc0786 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -997,7 +997,6 @@ struct gprs_ns2_inst *gprs_ns2_instantiate(void *ctx, osmo_prim_cb cb, void *cb_
* \param[in] nsi NS instance to destroy */
void gprs_ns2_free(struct gprs_ns2_inst *nsi)
{
- struct gprs_ns2_vc_bind *bind, *tbind;
struct gprs_ns2_nse *nse, *ntmp;
if (!nsi)
@@ -1007,9 +1006,7 @@ void gprs_ns2_free(struct gprs_ns2_inst *nsi)
gprs_ns2_free_nse(nse);
}
- llist_for_each_entry_safe(bind, tbind, &nsi->binding, list) {
- gprs_ns2_free_bind(bind);
- }
+ gprs_ns2_free_binds(nsi);
talloc_free(nsi);
}
@@ -1067,4 +1064,13 @@ void gprs_ns2_free_bind(struct gprs_ns2_vc_bind *bind)
llist_del(&bind->list);
talloc_free(bind);
}
+
+void gprs_ns2_free_binds(struct gprs_ns2_inst *nsi)
+{
+ struct gprs_ns2_vc_bind *bind, *tbind;
+
+ llist_for_each_entry_safe(bind, tbind, &nsi->binding, list) {
+ gprs_ns2_free_bind(bind);
+ }
+}
/*! @} */
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index 3d1d5d68..d23d263b 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -79,6 +79,7 @@ gprs_ns2_dynamic_create_nse;
gprs_ns2_find_vc_by_sockaddr;
gprs_ns2_free;
gprs_ns2_free_bind;
+gprs_ns2_free_binds;
gprs_ns2_free_nse;
gprs_ns2_free_nsvc;
gprs_ns2_frgre_bind;