RTCP: expert item on non-final packet padding flag
authorJaap Keuter <jaap.keuter@xs4all.nl>
Wed, 4 Nov 2020 13:28:05 +0000 (14:28 +0100)
committerAndersBroman <a.broman58@gmail.com>
Thu, 5 Nov 2020 05:25:31 +0000 (05:25 +0000)
RFC 3550, Section 6.4.1 describes that the padding flag may only be set
on the last packet in a compound RTCP packet. Add an expert item if that
is not the case.

epan/dissectors/packet-rtcp.c

index 914e0a34810959ceeba92955d83204f4fdc8a3c6..4286c6cdfbd609133e294bc604b3152104131906 100644 (file)
@@ -835,6 +835,7 @@ static gint ett_rtcp_mcptt_participant_ref = -1;
 static gint ett_rtcp_mcptt_eci = -1;
 static gint ett_rtcp_mccp_tmgi = -1;
 
+static expert_field ei_rtcp_not_final_padding = EI_INIT;
 static expert_field ei_rtcp_bye_reason_not_padded = EI_INIT;
 static expert_field ei_rtcp_xr_block_length_bad = EI_INIT;
 static expert_field ei_rtcp_roundtrip_delay = EI_INIT;
@@ -4343,6 +4344,7 @@ dissect_rtcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
      */
     while ( !srtcp_now_encrypted && tvb_bytes_exist( tvb, offset, 4) ) {
         guint temp_byte;
+        proto_item *padding_item;
         gint elem_count;
         guint packet_type;
         gint packet_length;
@@ -4380,6 +4382,11 @@ dissect_rtcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
             show_setup_info(tvb, pinfo, rtcp_tree);
         }
 
+        if (padding_set)
+        {
+            /* Padding can't yet be set, since there is another packet */
+            expert_add_info(pinfo, padding_item, &ei_rtcp_not_final_padding);
+        }
 
         temp_byte = tvb_get_guint8( tvb, offset );
 
@@ -4388,8 +4395,8 @@ dissect_rtcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
         padding_set = RTCP_PADDING( temp_byte );
         padding_offset = offset + packet_length - 1;
 
-        proto_tree_add_boolean( rtcp_tree, hf_rtcp_padding, tvb,
-                                offset, 1, temp_byte );
+        padding_item = proto_tree_add_boolean( rtcp_tree, hf_rtcp_padding, tvb,
+                                               offset, 1, temp_byte );
         elem_count = RTCP_COUNT( temp_byte );
 
         switch ( packet_type ) {
@@ -7893,6 +7900,7 @@ proto_register_rtcp(void)
     };
 
     static ei_register_info ei[] = {
+        { &ei_rtcp_not_final_padding, { "rtcp.not_final_padding", PI_PROTOCOL, PI_WARN, "Padding flag set on not final packet (see RFC3550, section 6.4.1)", EXPFILL }},
         { &ei_rtcp_bye_reason_not_padded, { "rtcp.bye_reason_not_padded", PI_MALFORMED, PI_WARN, "Reason string is not NULL padded (see RFC3550, section 6.6)", EXPFILL }},
         { &ei_rtcp_xr_block_length_bad, { "rtcp.invalid_block_length", PI_PROTOCOL, PI_WARN, "Invalid block length, should be 2", EXPFILL }},
         { &ei_rtcp_roundtrip_delay, { "rtcp.roundtrip-delay.expert", PI_SEQUENCE, PI_NOTE, "RTCP round-trip delay detected (%d ms)", EXPFILL }},