[Sumover-dev] [svn commit] r4122 - common/trunk/src

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Tue Feb 5 13:31:17 GMT 2008


Author: piers
Date: Tue Feb  5 13:31:16 2008
New Revision: 4122

Modified:
   common/trunk/src/rtp.c
   common/trunk/src/rtp.h

Log:
Fixes Ticket #168 - Stops rat crashing when two (or more) instances run in encrypted mode using different keys on the same address with promiscuous mode switched on.

Promiscuous mode (where RAT doesn't wait for an RTCP packet before allowing the source - ie it only requires a RTP packet and omits the 'probation' check for in sequence RTP packets) has been on as default for a while as it useful for quickly connecting to devices that don't generate RTCP. However promiscuous mode is too relaxed about packet admission. Despite passing the rtp_validate() function some packets - especially those from a 'wrongly' (the key isn't correct) decrypted session - manage to pass that check but are actually garbage. The additional 'probation' checks in the promiscuous code (which checked for more than one packet in the sequence) are switched off. 

Solution:
- The wait_for_rtcp rtp option has had it's token renamed from RTP_OPT_WEAK_VALIDATION to RTP_OPT_WAIT_FOR_RTCP - It's value has been switched for previous usage as it makes more sense with the new naming. Code has been cleaned up. 
- Basically the fixes lies in the changed default config: RAT now enabled wait_for_rtcp and disables promiscuous mode. 


Modified: common/trunk/src/rtp.c
==============================================================================
--- common/trunk/src/rtp.c	(original)
+++ common/trunk/src/rtp.c	Tue Feb  5 13:31:16 2008
@@ -634,7 +634,7 @@
 			event.ssrc = ssrc;
 			event.type = SOURCE_CREATED;
 			event.data = NULL;
-		event.ts   = &event_ts;
+			event.ts   = &event_ts;
 			session->callback(session, &event);
 		}
         }
@@ -936,7 +936,7 @@
 {
 	/* Default option settings. */
 	rtp_set_option(session, RTP_OPT_PROMISC,           FALSE);
-	rtp_set_option(session, RTP_OPT_WEAK_VALIDATION,   FALSE);
+	rtp_set_option(session, RTP_OPT_WAIT_FOR_RTCP,     FALSE);
 	rtp_set_option(session, RTP_OPT_FILTER_MY_PACKETS, FALSE);
 	rtp_set_option(session, RTP_OPT_REUSE_PACKET_BUFS, FALSE);
 }
@@ -1170,7 +1170,7 @@
 	assert((optval == TRUE) || (optval == FALSE));
 
 	switch (optname) {
-		case RTP_OPT_WEAK_VALIDATION:
+		case RTP_OPT_WAIT_FOR_RTCP:
 			session->opt->wait_for_rtcp = optval;
 			break;
 	        case RTP_OPT_PROMISC:
@@ -1209,7 +1209,7 @@
 int rtp_get_option(struct rtp *session, rtp_option optname, int *optval)
 {
 	switch (optname) {
-		case RTP_OPT_WEAK_VALIDATION:
+		case RTP_OPT_WAIT_FOR_RTCP:
 			*optval = session->opt->wait_for_rtcp;
                         break;
         	case RTP_OPT_PROMISC:
@@ -1404,14 +1404,13 @@
 		}
 		if (validate_rtp(session, packet, buflen)) {
 			if (session->opt->wait_for_rtcp) {
-				s = create_source(session, packet->fields.ssrc, TRUE);
-			} else {
 				s = get_source(session, packet->fields.ssrc);
+			} else {
+				s = create_source(session, packet->fields.ssrc, TRUE);
 			}
 			if (session->opt->promiscuous_mode) {
 				if (s == NULL) {
-					create_source(session, packet->fields.ssrc, FALSE);
-					s = get_source(session, packet->fields.ssrc);
+					s = create_source(session, packet->fields.ssrc, FALSE);
 				}
 				process_rtp(session, curr_rtp_ts, packet, s);
 				return; /* We don't free "packet", that's done by the callback function... */

Modified: common/trunk/src/rtp.h
==============================================================================
--- common/trunk/src/rtp.h	(original)
+++ common/trunk/src/rtp.h	Tue Feb  5 13:31:16 2008
@@ -186,7 +186,7 @@
 /* RTP options */
 typedef enum {
         RTP_OPT_PROMISC =	    1,
-        RTP_OPT_WEAK_VALIDATION	=   2,
+        RTP_OPT_WAIT_FOR_RTCP	=   2,
         RTP_OPT_FILTER_MY_PACKETS = 3,
 	RTP_OPT_REUSE_PACKET_BUFS = 4  /* Each data packet is written into the same buffer, */
 	                               /* rather than malloc()ing a new buffer each time.   */



More information about the Sumover-dev mailing list