Ethereal-dev: Re: [Ethereal-dev] Patch to prevent rtp/rtcp to register conversationwhen disabl

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ruud Linders <[email protected]>
Date: Tue, 06 Jul 2004 20:39:40 +0200
Here is a patch which includes the previous one and implements an additional
preference in the sdp decoder to be able to switch off calling the RTCP
from the SDP decoder.

Please apply.


THanks

Martin Mathieson wrote:
Would it make sense to (also?) add a preference setting to the SDP dissector
indicating whether or not RTCP conversations should be created?  H.245 and
RTSP specify the RTCP port explicity so wouldn't need such an option.

Disabling RTCP altogether seems maybe a drastic way to achieve what you
want.

Martin


----- Original Message -----
From: "Ruud Linders" <[email protected]>
To: <[email protected]>
Sent: 03 July 2004 18:04
Subject: [Ethereal-dev] Patch to prevent rtp/rtcp to register
conversationwhen disabled



Here is a patch (against nightly build 2004-07-02) to prevent both
RTCP and RTP to create conversations when the respective protocols
are disabled.

It solves for me the problem that in packet-sdp.c the function
rtp_add_address(... srcport ...) is blindly followed by
rtCp_add_address(..srcport+1...).
Since the SDP decoder can't now if RTCP is present or not, that
seems to be the only way to create a conversation for RTCP.
(IFF RTCP is present, it IS at the RTP port + 1)

However, in my trace there were no RTCP but instead RTP packets
at the srcport+1 which were subsequently decoded wrongly as RTCP.


Regards,
Ruud Linders





----------------------------------------------------------------------------
----



--- packet-rtcp.c.20040702 2004-06-30 23:08:58.000000000 +0200
+++ packet-rtcp.c 2004-07-03 18:38:57.000000000 +0200
@@ -248,6 +248,13 @@
 struct _rtcp_conversation_info *p_conv_data = NULL;

 /*
+ * If protocol isn't enabled, we shouldn't create a conversation
+ */
+ if (!proto_is_protocol_enabled(find_protocol_by_id(proto_rtcp))) {
+   return;
+ }
+
+ /*
 * If this isn't the first time this packet has been processed,
 * we've already done this work, so we don't need to do it
 * again.
--- packet-rtp.c.20040702 2004-07-01 08:59:38.000000000 +0200
+++ packet-rtp.c 2004-07-03 18:40:31.000000000 +0200
@@ -203,6 +203,13 @@
 struct _rtp_conversation_info *p_conv_data = NULL;

 /*
+ * If protocol isn't enabled, we shouldn't create a conversation
+ */
+ if (!proto_is_protocol_enabled(find_protocol_by_id(proto_rtp))) {
+   return;
+ }
+
+ /*
 * If this isn't the first time this packet has been processed,
 * we've already done this work, so we don't need to do it
 * again.




----------------------------------------------------------------------------
----



_______________________________________________
Ethereal-dev mailing list
[email protected]
http://www.ethereal.com/mailman/listinfo/ethereal-dev


_______________________________________________
Ethereal-dev mailing list
[email protected]
http://www.ethereal.com/mailman/listinfo/ethereal-dev
--- packet-rtcp.c.20040702	2004-06-30 23:08:58.000000000 +0200
+++ packet-rtcp.c	2004-07-03 18:38:57.000000000 +0200
@@ -248,6 +248,13 @@
 	struct _rtcp_conversation_info *p_conv_data = NULL;
 
 	/*
+	 * If protocol isn't enabled, we shouldn't create a conversation
+	 */
+	if (!proto_is_protocol_enabled(find_protocol_by_id(proto_rtcp))) {
+	  return;
+	}
+	    
+	/*
 	 * If this isn't the first time this packet has been processed,
 	 * we've already done this work, so we don't need to do it
 	 * again.
--- packet-rtp.c.20040702	2004-07-01 08:59:38.000000000 +0200
+++ packet-rtp.c	2004-07-03 18:40:31.000000000 +0200
@@ -203,6 +203,13 @@
 	struct _rtp_conversation_info *p_conv_data = NULL;
 
 	/*
+	 * If protocol isn't enabled, we shouldn't create a conversation
+	 */
+	if (!proto_is_protocol_enabled(find_protocol_by_id(proto_rtp))) {
+	  return;
+	}
+
+	/*
 	 * If this isn't the first time this packet has been processed,
 	 * we've already done this work, so we don't need to do it
 	 * again.
--- packet-sdp.c.20040702	2004-07-03 18:29:44.000000000 +0200
+++ packet-sdp.c	2004-07-06 20:26:21.000000000 +0200
@@ -53,6 +53,7 @@
 #include "rtp_pt.h"
 #include "packet-rtcp.h"
 
+#include "prefs.h"
 
 static dissector_handle_t rtp_handle=NULL;
 static dissector_handle_t rtcp_handle=NULL;
@@ -174,6 +175,11 @@
 			      transport_info_t *transport_info);
 static void dissect_sdp_media_attribute(tvbuff_t *tvb, proto_item *ti);
 
+/* Global to turn OFF the implicit RTCP decode, because it might not
+ * be present
+ */
+static gboolean global_sdp_rtcp_decode = TRUE;
+
 static void
 dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
@@ -386,7 +392,7 @@
 				                "SDP", pinfo->fd->num);
 		    }
 
-		    if(rtcp_handle){
+		    if(rtcp_handle && global_sdp_rtcp_decode){
 				ipv4_port++;
 				rtcp_add_address(pinfo, (char *)&ipv4_address, ipv4_port, 0,
 				                 "SDP", pinfo->fd->num);
@@ -1126,6 +1132,8 @@
     &ett_sdp_media_attribute,
   };
 
+  module_t *sdp_module;
+  
   proto_sdp = proto_register_protocol("Session Description Protocol",
 				      "SDP", "sdp");
   proto_register_field_array(proto_sdp, hf, array_length(hf));
@@ -1138,6 +1146,15 @@
    * on Windows without stuffing it into the Big Transfer Vector).
    */
   register_dissector("sdp", dissect_sdp, proto_sdp);
+
+  sdp_module = prefs_register_protocol(proto_sdp, NULL);
+
+  prefs_register_bool_preference(sdp_module, "callrtcp",
+                "For media RTP streams, call RTCP on the next port ",
+                "When SDP detects an RTP stream, it will call RTP decoder but " 
+		"also RTCP on the RTP port+1",
+                &global_sdp_rtcp_decode);
+
 }
 
 void