[asterisk-commits] blanchet: branch group/v6 r85096 - /team/group/v6/trunk/main/rtp.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 9 10:10:13 CDT 2007


Author: blanchet
Date: Tue Oct  9 10:10:12 2007
New Revision: 85096

URL: http://svn.digium.com/view/asterisk?view=rev&rev=85096
Log:
wrong size passed to sendto. the sockaddr length is carried as a separate variab
le.

Modified:
    team/group/v6/trunk/main/rtp.c

Modified: team/group/v6/trunk/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/group/v6/trunk/main/rtp.c?view=diff&rev=85096&r1=85095&r2=85096
==============================================================================
--- team/group/v6/trunk/main/rtp.c (original)
+++ team/group/v6/trunk/main/rtp.c Tue Oct  9 10:10:12 2007
@@ -1391,7 +1391,7 @@
 	rtpheader[0] = htonl(reconstruct);
 
 	/* Send the packet back out */
-	res = sendto(bridged->s, (void *)rtpheader, len, 0, (struct sockaddr *)&bridged->them, sizeof(bridged->them));
+	res = sendto(bridged->s, (void *)rtpheader, len, 0, (struct sockaddr *)&bridged->them, bridged->themlen);
 	ast_vinetsock_sa_get_hostport((struct sockaddr*)&bridged->them,
 			bridged->themlen, hostport, sizeof(hostport));
 	if (res < 0) {
@@ -2621,7 +2621,7 @@
 
 	for (i = 0; i < 2; i++) {
 		rtpheader[3] = htonl((digit << 24) | (0xa << 16) | (rtp->send_duration));
-		res = sendto(rtp->s, (void *) rtpheader, hdrlen + 4, 0, (struct sockaddr *) &rtp->them, sizeof(rtp->them));
+		res = sendto(rtp->s, (void *) rtpheader, hdrlen + 4, 0, (struct sockaddr *) &rtp->them, rtp->themlen);
 		if (res < 0) 
 			ast_log(LOG_ERROR, "RTP Transmission error to %s: %s\n",
 					hostport, strerror(errno));
@@ -2667,7 +2667,7 @@
 	rtpheader[0] = htonl((2 << 30) | (rtp->send_payload << 16) | (rtp->seqno));
 	
 	/* Transmit */
-	res = sendto(rtp->s, (void *) rtpheader, hdrlen + 4, 0, (struct sockaddr *) &rtp->them, sizeof(rtp->them));
+	res = sendto(rtp->s, (void *) rtpheader, hdrlen + 4, 0, (struct sockaddr *) &rtp->them, rtp->themlen);
 	if (res < 0)
 		ast_log(LOG_ERROR, "RTP Transmission error to %s: %s\n",
 			hostport, strerror(errno));
@@ -2725,7 +2725,7 @@
 	rtpheader[0] = htonl((2 << 30) | (rtp->send_payload << 16) | (rtp->seqno));
 	/* Send 3 termination packets */
 	for (i = 0; i < 3; i++) {
-		res = sendto(rtp->s, (void *) rtpheader, hdrlen + 4, 0, (struct sockaddr *) &rtp->them, sizeof(rtp->them));
+		res = sendto(rtp->s, (void *) rtpheader, hdrlen + 4, 0, (struct sockaddr *) &rtp->them, rtp->themlen);
 		if (res < 0)
 			ast_log(LOG_ERROR, "RTP Transmission error to %s: %s\n",
 				hostport, strerror(errno));
@@ -2839,7 +2839,7 @@
 	rtcpheader[(len/4)+2] = htonl(0x01 << 24);                    /* Empty for the moment */
 	len += 12;
 	
-	res = sendto(rtp->rtcp->s, (unsigned int *)rtcpheader, len, 0, (struct sockaddr *)&rtp->rtcp->them, sizeof(rtp->rtcp->them));
+	res = sendto(rtp->rtcp->s, (unsigned int *)rtcpheader, len, 0, (struct sockaddr *)&rtp->rtcp->them, rtp->rtcp->themlen);
 	if (res < 0) {
 		ast_log(LOG_ERROR, "RTCP SR transmission error to %s, rtcp halted %s\n", hostport, strerror(errno));
 		if (rtp->rtcp->schedid > 0)
@@ -2962,7 +2962,7 @@
 	rtcpheader[(len/4)+2] = htonl(0x01 << 24);              /* Empty for the moment */
 	len += 12;
 	
-	res = sendto(rtp->rtcp->s, (unsigned int *)rtcpheader, len, 0, (struct sockaddr *)&rtp->rtcp->them, sizeof(rtp->rtcp->them));
+	res = sendto(rtp->rtcp->s, (unsigned int *)rtcpheader, len, 0, (struct sockaddr *)&rtp->rtcp->them, rtp->rtcp->themlen);
 
 	if (res < 0) {
 		ast_log(LOG_ERROR, "RTCP RR transmission error, rtcp halted: %s\n",strerror(errno));
@@ -3040,7 +3040,7 @@
 	if (rtp->themlen) {
 		ast_vinetsock_sa_get_hostport((struct sockaddr*)&rtp->them, rtp->themlen,
 				hostport, sizeof(hostport));
-		res = sendto(rtp->s, (void *)rtpheader, hdrlen + 1, 0, (struct sockaddr *)&rtp->them, sizeof(rtp->them));
+		res = sendto(rtp->s, (void *)rtpheader, hdrlen + 1, 0, (struct sockaddr *)&rtp->them, rtp->themlen);
 		if (res <0) 
 			ast_log(LOG_ERROR, "RTP Comfort Noise Transmission error to %s: %s\n", hostport, strerror(errno));
 		if (rtp_debug_test_addr((struct sockaddr*)&rtp->them, rtp->themlen))
@@ -3128,7 +3128,7 @@
 	if (rtp->themlen) {
 		ast_vinetsock_sa_get_hostport((struct sockaddr*)&rtp->them,
 				rtp->themlen, hostport, sizeof(hostport));
-		res = sendto(rtp->s, (void *)rtpheader, f->datalen + hdrlen, 0, (struct sockaddr *)&rtp->them, sizeof(rtp->them));
+		res = sendto(rtp->s, (void *)rtpheader, f->datalen + hdrlen, 0, (struct sockaddr *)&rtp->them, rtp->themlen);
 		if (res <0) {
 			if (!rtp->nat || (rtp->nat && (ast_test_flag(rtp, FLAG_NAT_ACTIVE) == FLAG_NAT_ACTIVE))) {
 				ast_debug(1, "RTP Transmission error of packet %d to %s: %s\n", rtp->seqno, hostport, strerror(errno));




More information about the asterisk-commits mailing list