Summary:ASTERISK-02040: bad checksum udp packets on linux
Reporter:cherso (cherso)Labels:
Date Opened:2004-07-17 09:53:30Date Closed:2008-01-15 15:02:52.000-0600
Versions:Frequency of
Description:alot of bad checksum udp packet in sip reply and rtp packets on linux 2.6.7, slackware 9.1 with different nic cards
sendto function is not working good and so packet are dropped by the router. My vigor 2600 always crash receiving bad udp packets so I changed the setsocketopt option adding no checksum. I will try to write ast_sendto function with SOCK_DGRAM and checksum calculation function


static int rtp_socket(void)
       int s;
       int cksum_flag = 1;           /* turn off UDP checksums */
       long flags;
       s = socket(AF_INET, SOCK_DGRAM, 0);
       if (s > -1) {
               flags = fcntl(s, F_GETFL);
               fcntl(s, F_SETFL, flags | O_NONBLOCK);
setsockopt(s, SOL_SOCKET, SO_NO_CHECK, &cksum_flag,sizeof(cksum_flag));
       return s;
Comments:By: cherso (cherso) 2004-07-17 09:59:08

well ast_sendto should be a SOCK_RAW function

By: Mark Spencer (markster) 2004-07-17 15:40:07

That will require root priviledge.  This seems to be a linux issue, not an asterisk issue, or am I missing something?

By: Mark Spencer (markster) 2004-07-17 17:22:24

I added a "rtpchecksum" option to rtp.conf to enable you to disable them

By: Digium Subversion (svnbot) 2008-01-15 15:02:52.000-0600

Repository: asterisk
Revision: 3464

U   trunk/configs/rtp.conf.sample
U   trunk/rtp.c

r3464 | markster | 2008-01-15 15:02:51 -0600 (Tue, 15 Jan 2008) | 2 lines

Add option to disable checksums on RTP UDP ports (bug ASTERISK-2040)