[Home]

Summary:ASTERISK-02457: rtp.c generates seemingly erroneous warning message
Reporter:tih (tih)Labels:
Date Opened:2004-09-24 05:37:13Date Closed:2004-10-12 22:25:14
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:In rtp.c, we find the following:

       res = recvfrom(rtp->rtcp->s, rtcpdata, sizeof(rtcpdata),
                                       0, (struct sockaddr *)&sin, &len);

       if (res < 0) {
               if (errno == EAGAIN)
                       ast_log(LOG_NOTICE, "RTP: Received packet with bad UDP checksum\n");

Now, when recvfrom() returns -1, and errno is EAGAIN, that actually means that the socket is non-blocking, and the recvfrom() call would block. The message should either be removed (if the recvfrom() can be invoked when data is not ready), or changed (if the surrounding code path is such that recvfrom() will only be called when a packet has actually been received).
Comments:By: alric (alric) 2004-09-24 08:18:59

What version of Asterisk are you currently running?

By: tih (tih) 2004-09-27 02:03:24

Asterisk CVS-HEAD-09/23/04-19:31:36 built by root@athene.i.eunet.no on a i386 running NetBSD.

I noticed the problem while playing with the "Conference" application by Steve Kann, so I guess it might actually be a case of that application abusing the RTP subsystem. In any case, the wording of the message is not in accordance with what EAGAIN actually means in the recvfrom() context.

By: Mark Spencer (markster) 2004-10-12 18:36:52

No, because you shouldn't be calling the routine unless you're calling it from select, and when select says "there's something to be read" and then you read and it's gone, it's typically because there was a bad UDP checksum (see /usr/src/linux/net/ipv4/udp.c, udp_recvmsg, when skb_copy_and_csum_datagram_iovec fails.