Fix hole in layer2_persistence option for TE PTMP links.

If the network stops responding, according to Q.921 we are supposed to
remove the TEI.  With the layer2_persistence option enabled, we are
supposed to keep trying to bring layer 2 back up.  Unfortunately, when the
network stops responding, we stopped the restart timer and removed the
TEI.  As a result, layer 2 does not immediately come back up.

* Made not stop the restart timer if we are removing the TEI on the CPE
side.  Also handle the timer expiration in relevant unassigned TEI states.

(closes issue LIBPRI-72)
Reported by: Trey Blancher
Patches:
      jira_dahdi_1001_libpri_v1.4.patch (license #5621) patch uploaded by rmudgett


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2315 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
Richard Mudgett 2013-03-28 16:40:22 +00:00
parent 28553ff8cb
commit 84b2560da5

8
q921.c
View File

@ -557,7 +557,7 @@ static void kick_start_link(struct q921_link *link)
break;
case Q921_ASSIGN_AWAITING_TEI:
if (ctrl->debug & PRI_DEBUG_Q921_STATE) {
pri_message(ctrl, "Kick starting link when get TEI.\n");
pri_message(ctrl, "Kick starting link when awaiting TEI.\n");
}
q921_setstate(link, Q921_ESTABLISH_AWAITING_TEI);
break;
@ -586,6 +586,8 @@ static void restart_timer_expire(void *vlink)
link->restart_timer = 0;
switch (link->state) {
case Q921_TEI_UNASSIGNED:
case Q921_ASSIGN_AWAITING_TEI:
case Q921_TEI_ASSIGNED:
/* Try to bring layer 2 up. */
kick_start_link(link);
@ -1911,7 +1913,9 @@ static void q921_mdl_remove(struct q921_link *link)
switch (link->state) {
case Q921_TEI_ASSIGNED:
restart_timer_stop(link);
if (mdl_free_me) {
restart_timer_stop(link);
}
/* XXX: deviation! Since we don't have a UI queue, we just discard our I-queue */
q921_discard_iqueue(link);
q921_setstate(link, Q921_TEI_UNASSIGNED);