linphone-developers
[Top][All Lists]
Advanced

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

Re: [Linphone-developers] oRTP: Bug in STUN handling?


From: Simon Morlat
Subject: Re: [Linphone-developers] oRTP: Bug in STUN handling?
Date: Wed, 11 Feb 2009 16:47:39 +0100
User-agent: KMail/1.9.9

Hi,

You are right, this is a bug.
I fixed it differently:
if (rtp->version!=2)
        {
                /* try to see if it is a STUN packet */
                uint16_t stunlen=*((uint16_t*)(mp->b_rptr + sizeof(uint16_t)));
                stunlen = ntohs(stunlen);
                if (stunlen+20==mp->b_wptr-mp->b_rptr){
                        /* this looks like a stun packet */
                        if (session->eventqs!=NULL){
                                OrtpEvent 
*ev=ortp_event_new(ORTP_EVENT_STUN_PACKET_RECEIVED);
                                OrtpEventData *ed=ortp_event_get_data(ev);
                                ed->packet=mp;
                                ed->ep=rtp_endpoint_new(addr,addrlen);
                                rtp_session_dispatch_event(session,ev);
                                return;
                        }
                }
                /* discard in two case: the packet is not stun OR nobody is 
interested by 
STUN (no eventqs) */
                ortp_debug("Receiving rtp packet with version number 
!=2...discarded");
                stats->bad++;
                ortp_global_stats.bad++;
                freemsg(mp);
                return;
        }

So that stun packets get counted as 'bad' when no event queue has been 
registered.
Thank you very much for reporting this problem.

Simon


Le Wednesday 11 February 2009 13:05:39 Alexander Beisig, vous avez écrit :
> Hello!
>
> I think there is a bug in rtpparse.c near line 82:  If session->eventqs
> is NULL, the STUN processing falls through and the STUN packet is
> processed like an ordinary RTP packet, which caused all sorts of weird
> behaviour for me.  I fixed it by adding:
>
> else{
>    freemsg(mp);
>    return;
> }
>
> to the if-clause, but since I don't know what this session->eventqs is
> anyway I'm not sure if this is the right way to deal with the problem.
>
> What do you think?
>
>
> Alex






reply via email to

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