diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-03-03 00:45:49 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-03-03 01:19:02 +0100 |
commit | d38b87a4c9d674189e661814d42e1df61a249323 (patch) | |
tree | 06f3aab1f7b82beddcdde7a87c7b26ce9c666dd4 | |
parent | 123147a47261b3612aba988b71b9cc5abb1d2c9b (diff) |
ss7: Do not send anything until both linksets in an app are up
We need some way to forward the failure of one link to another but
they are not normally routed so we can not send a TFP. Right now we
will simply stop responding until both links are up. This should make
the SLTM fail and trigger a re-alignment on both sides. The key here
is that the 2 * SLTM timeout needs to be higher than it takes to re-align
the link. I'm not sure this code will work.
-rw-r--r-- | include/ss7_application.h | 2 | ||||
-rw-r--r-- | src/mtp_layer3.c | 10 | ||||
-rw-r--r-- | src/ss7_application.c | 25 |
3 files changed, 32 insertions, 5 deletions
diff --git a/include/ss7_application.h b/include/ss7_application.h index 084a8f7..1b4d412 100644 --- a/include/ss7_application.h +++ b/include/ss7_application.h @@ -45,6 +45,8 @@ struct ss7_application_route { int type; int nr; + int up; + /* maybe they were resolved */ struct mtp_link_set *set; struct msc_connection *msc; diff --git a/src/mtp_layer3.c b/src/mtp_layer3.c index 45bbfa3..928a05c 100644 --- a/src/mtp_layer3.c +++ b/src/mtp_layer3.c @@ -23,6 +23,7 @@ #include <bsc_data.h> #include <cellmgr_debug.h> #include <isup_types.h> +#include <ss7_application.h> #include <counter.h> #include <osmocore/talloc.h> @@ -37,6 +38,15 @@ static int mtp_int_submit(struct mtp_link_set *set, int pc, int sls, int type, c void mtp_link_submit(struct mtp_link *link, struct msgb *msg) { + if (link->set->app && link->set->app->type == APP_STP) { + if (!link->set->app->route_src.up || !link->set->app->route_dst.up) { + LOGP(DINP, LOGL_NOTICE, "Not sending data as application is down %d/%s.\n", + link->set->app->nr, link->set->app->name); + msgb_free(msg); + return; + } + } + rate_ctr_inc(&link->ctrg->ctr[MTP_LNK_OUT]); rate_ctr_inc(&link->set->ctrg->ctr[MTP_LSET_TOTA_OUT_MSG]); link->write(link, msg); diff --git a/src/ss7_application.c b/src/ss7_application.c index 485aa2e..847a96e 100644 --- a/src/ss7_application.c +++ b/src/ss7_application.c @@ -91,7 +91,15 @@ void mtp_linkset_down(struct mtp_link_set *set) set->available = 0; mtp_link_set_stop(set); - if (set->app && set->app->type != APP_STP) { + if (!set->app) + return; + + if (set->app->type == APP_STP) { + if (set->app->route_src.set == set) + set->app->route_src.up = 0; + else + set->app->route_dst.up = 0; + } else { app_clear_connections(set->app); /* If we have an A link send a reset to the MSC */ @@ -105,10 +113,17 @@ void mtp_linkset_up(struct mtp_link_set *set) set->available = 1; /* we have not gone through link down */ - if (set->app && set->app->type != APP_STP && - set->app->route_dst.msc->msc_link_down) { - app_clear_connections(set->app); - app_resources_released(set->app); + if (set->app) { + if (set->app->type == APP_STP) { + if (set->app->route_src.set == set) + set->app->route_src.up = 1; + else + set->app->route_dst.up = 1; + } else if (set->app->type != APP_STP && + set->app->route_dst.msc->msc_link_down) { + app_clear_connections(set->app); + app_resources_released(set->app); + } } mtp_link_set_reset(set); |