[asterisk-bugs] [JIRA] (ASTERISK-24894) [patch] iax2_poke_noanswer expiration timer too short

Y Ateya (JIRA) noreply at issues.asterisk.org
Sun Apr 5 08:44:32 CDT 2015


     [ https://issues.asterisk.org/jira/browse/ASTERISK-24894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Y Ateya updated ASTERISK-24894:
-------------------------------

    Description: 
POKE is used to check for peer availability, but it is not given enough time to retry in case of packet loss (if qualify time is high).

If qualify time is set to 10 seconds ({{qualify = 1000}} in iax.conf); peer will be UNREACHABLE due to single packet loss.

Here is the code snippet which start timer for poke_noasnwer

{code}
	/* Speed up retransmission times for this qualify call */
	iaxs[peer->callno]->pingtime = peer->maxms / 4 + 1;
	iaxs[peer->callno]->peerpoke = peer;

	if (peer->pokeexpire > -1) {
		if (!AST_SCHED_DEL(sched, peer->pokeexpire)) {
			peer->pokeexpire = -1;
			peer_unref(peer);
		}
	}

	/* Queue up a new task to handle no reply */
	/* If the host is already unreachable then use the unreachable interval instead */
	if (peer->lastms < 0)
		peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqnotok, iax2_poke_noanswer, peer_ref(peer));
	else
		peer->pokeexpire = iax2_sched_add(sched, DEFAULT_MAXMS * 2, iax2_poke_noanswer, peer_ref(peer));
{code}

In this code, if {{peer->lastms}} is more than 0 (i.e last ping or poke succeeded), {{iax2_poke_noanswer}} will be called if we didn't get POKE reply before {{DEFAULT_MAXMS * 2}} (i.e. 4 seconds).

ping time value {noformat}iaxs[peer->callno]->pingtime = peer->maxms / 4 + 1;{noformat} will be {{10000 / 4 + 1}} (i.e 2.5 seconds).

Since IAX frames are retried {{fr->retrytime = pvt->pingtime * 2;}}, so POKE frame will be retried every 5 seconds!

So a single POKE packet loss will make the peer UNREACHABLE.

To fix this, iax2_poke_noanswer timer shall be long enough allow for proper retries for POKE packet.

  was:
POKE is used to check for peer availability, but it is not given enough time to retry in case of packet loss (if qualify time is high).

If qualify time is set to 10 seconds ({{qualify = 1000}} in iax.conf); peer will be UNREACHABLE due to single packet loss.

Here is the code snippet which start timer for poke_noasnwer

{code}
	/* Speed up retransmission times for this qualify call */
	iaxs[peer->callno]->pingtime = peer->maxms / 4 + 1;
	iaxs[peer->callno]->peerpoke = peer;

	if (peer->pokeexpire > -1) {
		if (!AST_SCHED_DEL(sched, peer->pokeexpire)) {
			peer->pokeexpire = -1;
			peer_unref(peer);
		}
	}

	/* Queue up a new task to handle no reply */
	/* If the host is already unreachable then use the unreachable interval instead */
	if (peer->lastms < 0)
		peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqnotok, iax2_poke_noanswer, peer_ref(peer));
	else
		peer->pokeexpire = iax2_sched_add(sched, DEFAULT_MAXMS * 2, iax2_poke_noanswer, peer_ref(peer));
{code}

In this code, if {{peer->lastms}} is more than 0 (i.e last ping or poke succeeded), {{iax2_poke_noanswer}} will be called if we didn't get POKE reply before {{DEFAULT_MAXMS * 2}} (i.e. 4 seconds).

ping time value {noformat}iaxs[peer->callno]->pingtime = peer->maxms / 4 + 1;{noformat} will be {{10000 / 4 + 1}} (i.e 2.5 seconds).

Since IAX frames are retried {{fr->retrytime = pvt->pingtime * 2;}}, so POKE frame will be retried every 5 seconds!

So a single POKE packet loss will make the peer UNREACHABLE.

To fix this, iax2_poke_noanswer timer shall be {{iaxs[peer->callno]->pingtime * 2 * max_retries}} to allow for proper retries for POKE packet.


> [patch] iax2_poke_noanswer expiration timer too short
> -----------------------------------------------------
>
>                 Key: ASTERISK-24894
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24894
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_iax2
>    Affects Versions: 13.2.0
>            Reporter: Y Ateya
>         Attachments: poke_noanswer_duration.diff
>
>
> POKE is used to check for peer availability, but it is not given enough time to retry in case of packet loss (if qualify time is high).
> If qualify time is set to 10 seconds ({{qualify = 1000}} in iax.conf); peer will be UNREACHABLE due to single packet loss.
> Here is the code snippet which start timer for poke_noasnwer
> {code}
> 	/* Speed up retransmission times for this qualify call */
> 	iaxs[peer->callno]->pingtime = peer->maxms / 4 + 1;
> 	iaxs[peer->callno]->peerpoke = peer;
> 	if (peer->pokeexpire > -1) {
> 		if (!AST_SCHED_DEL(sched, peer->pokeexpire)) {
> 			peer->pokeexpire = -1;
> 			peer_unref(peer);
> 		}
> 	}
> 	/* Queue up a new task to handle no reply */
> 	/* If the host is already unreachable then use the unreachable interval instead */
> 	if (peer->lastms < 0)
> 		peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqnotok, iax2_poke_noanswer, peer_ref(peer));
> 	else
> 		peer->pokeexpire = iax2_sched_add(sched, DEFAULT_MAXMS * 2, iax2_poke_noanswer, peer_ref(peer));
> {code}
> In this code, if {{peer->lastms}} is more than 0 (i.e last ping or poke succeeded), {{iax2_poke_noanswer}} will be called if we didn't get POKE reply before {{DEFAULT_MAXMS * 2}} (i.e. 4 seconds).
> ping time value {noformat}iaxs[peer->callno]->pingtime = peer->maxms / 4 + 1;{noformat} will be {{10000 / 4 + 1}} (i.e 2.5 seconds).
> Since IAX frames are retried {{fr->retrytime = pvt->pingtime * 2;}}, so POKE frame will be retried every 5 seconds!
> So a single POKE packet loss will make the peer UNREACHABLE.
> To fix this, iax2_poke_noanswer timer shall be long enough allow for proper retries for POKE packet.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list