aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-09-21 16:42:04 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-09-21 16:43:20 +0200
commitb492e86e4f75a4c09998d00930bf6c076293b3ed (patch)
tree242742c55628c26531acc09ee9220e5bc1c3def4
parent78f5060c622c9af9f9a3724c4032d045e1c45ff9 (diff)
ss7: Allow to force the link down when the IPA conn is going down
For the "bridging" to IPA mode we can force the SCTP/M3UA connection down. This way the remote STP will do a proper link fail-over procedure instead of the STP throwing data away. This is not configurable yet.
-rw-r--r--include/ss7_application.h5
-rw-r--r--src/sctp_m3ua_client.c1
-rw-r--r--src/ss7_application.c37
3 files changed, 39 insertions, 4 deletions
diff --git a/include/ss7_application.h b/include/ss7_application.h
index adf18f1..ede3548 100644
--- a/include/ss7_application.h
+++ b/include/ss7_application.h
@@ -88,6 +88,11 @@ struct ss7_application {
* size of it.
*/
unsigned fixed_ass_cmpl_reply : 1;
+
+ /**
+ * force link down
+ */
+ int force_down;
};
diff --git a/src/sctp_m3ua_client.c b/src/sctp_m3ua_client.c
index d4c1777..2211e92 100644
--- a/src/sctp_m3ua_client.c
+++ b/src/sctp_m3ua_client.c
@@ -325,6 +325,7 @@ static int m3ua_shutdown(struct mtp_link *mtp_link)
osmo_wqueue_clear(&link->queue);
link->aspsm_active = 0;
link->asptm_active = 0;
+ osmo_timer_del(&link->connect_timer);
return 0;
}
diff --git a/src/ss7_application.c b/src/ss7_application.c
index a537b6e..d85a818 100644
--- a/src/ss7_application.c
+++ b/src/ss7_application.c
@@ -345,7 +345,14 @@ static void start_msc(struct msc_connection *msc)
msc_connection_start(msc);
}
-static void start_set(struct ss7_application *app, struct mtp_link_set *set)
+static void start_set(struct mtp_link_set *set)
+{
+ if (!set)
+ return;
+ start_mtp(set);
+}
+
+static void prepare_set(struct ss7_application *app, struct mtp_link_set *set)
{
if (!set)
return;
@@ -353,7 +360,17 @@ static void start_set(struct ss7_application *app, struct mtp_link_set *set)
set->isup_opc = set->isup_opc >= 0 ? set->isup_opc : set->opc;
set->sccp_opc = set->sccp_opc >= 0 ? set->sccp_opc : set->opc;
set->pass_all_isup = app->isup_pass;
- start_mtp(set);
+}
+
+static void shutdown_set(struct mtp_link_set *set)
+{
+ struct mtp_link *link;
+
+ if (!set)
+ return;
+
+ llist_for_each_entry(link, &set->links, entry)
+ link->shutdown(link);
}
int ss7_application_start(struct ss7_application *app)
@@ -364,8 +381,12 @@ int ss7_application_start(struct ss7_application *app)
return -1;
}
- start_set(app, app->route_src.set);
- start_set(app, app->route_dst.set);
+ prepare_set(app, app->route_src.set);
+ prepare_set(app, app->route_dst.set);
+ if (!app->force_down) {
+ start_set(app->route_src.set);
+ start_set(app->route_dst.set);
+ }
if (app->route_src.msc)
start_msc(app->route_src.msc);
@@ -435,10 +456,18 @@ int ss7_application_trunk_name(struct ss7_application *app, const char *name)
int ss7_application_msc_up(struct ss7_application *app)
{
+ if (!app->force_down)
+ return 0;
+ start_set(app->route_src.set);
+ start_set(app->route_dst.set);
return 0;
}
int ss7_application_msc_down(struct ss7_application *app)
{
+ if (!app->force_down)
+ return 0;
+ shutdown_set(app->route_src.set);
+ shutdown_set(app->route_dst.set);
return 0;
}