9
0
Fork 0

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.
This commit is contained in:
Holger Hans Peter Freyther 2015-09-21 16:42:04 +02:00
parent 78f5060c62
commit b492e86e4f
3 changed files with 39 additions and 4 deletions

View File

@ -88,6 +88,11 @@ struct ss7_application {
* size of it.
*/
unsigned fixed_ass_cmpl_reply : 1;
/**
* force link down
*/
int force_down;
};

View File

@ -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;
}

View File

@ -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;
}