linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Linphone-developers] [PATCH] zrtp: use session's seq_number for zrt


From: Werner Dittmann
Subject: Re: [Linphone-developers] [PATCH] zrtp: use session's seq_number for zrtp packets
Date: Tue, 06 Nov 2012 15:02:42 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120825 Thunderbird/15.0

Am 05.11.2012 21:53, schrieb Dmitry Monakhov:
> 
> Currently seq_number for zrtp initiated to random value so
> seq_numbers for rtp and zrtp packets will have different base
> which is incorrect because other parts expect to receive packets
> with monolithic seq_numbers.

It's abosultely ok that ZRTP packet have different seq numbers, acutally
the ZRTP spec (RFC 6189) requires a random number, see chap 5.

ZRTP just uses the same port numbers to send/receive its packets. ZRTP
is an own protocol and ZRTP packets shall be filtered by the receiving software
and handed over to the ZRTP software and then discarded after ZRTP processing.
ZRTP packets are _not_ RTP packets and should never be treated as such.

Werner


> Let's use common session.rtp.snd_seq counter. ASAIU it is safe to
> modify counter w/o locking from zrtp callback because it is called
> from sender context.
> 
> Signed-off-by: Dmitry Monakhov <address@hidden>
> ---
>  src/zrtp.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/zrtp.c b/src/zrtp.c
> index bb653cd..3a35876 100644
> --- a/src/zrtp.c
> +++ b/src/zrtp.c
> @@ -50,7 +50,6 @@ struct _OrtpZrtpContext{
>       RtpSession *session;
>       uint32_t timerWillTriggerAt;
>       uint16_t last_recv_zrtp_seq_number;
> -     uint16_t last_sent_zrtp_seq_number;
>       srtp_t srtpSend;
>       srtp_t srtpRecv;
>       zrtp_Callbacks zrtp_cb;
> @@ -197,7 +196,7 @@ static int32_t ozrtp_sendDataZRTP (ZrtpContext* ctx, 
> const uint8_t* data, const
>       uint8_t *buffer8=(uint8_t*)buffer32;
>       uint16_t *buffer16=(uint16_t*)buffer32;
>  
> -     uint16_t seqNumber=userData->last_sent_zrtp_seq_number++;
> +     uint16_t seqNumber=session->rtp.snd_seq++;
>  
>       *buffer8 = 0x10;
>       buffer8[1]=0;
> @@ -769,7 +768,6 @@ static OrtpZrtpContext* createUserData(ZrtpContext 
> *context) {
>       userData->zrtpContext=context;
>       userData->timerWillTriggerAt=0;
>       userData->last_recv_zrtp_seq_number=0;
> -     userData->last_sent_zrtp_seq_number=rand()+1; // INT_MAX+1 (signed)
>  
>       userData->srtpRecv=NULL;
>       userData->srtpSend=NULL;
> 


-- 
----------------------------------------------
Werner Dittmann    address@hidden
Tel +49 176 993 462 95
PGP key: 82EF5E8B



reply via email to

[Prev in Thread] Current Thread [Next in Thread]