Skip to content

Commit

Permalink
RTP: Allow more than 4 RTP packets in a frame to be tapped
Browse files Browse the repository at this point in the history
Rather than a static array of rtp_info structs, allocate a
new one in pinfo->pool scope each time dissect_rtp is
called to pass to the tap.

More than 4 packets can appear in a single frame under some
unusual situations (e.g., RFC 4571 RTP over TCP, combined
with out of order TCP), and it's best not to have an arbitrary
limit.
  • Loading branch information
johnthacker authored and AndersBroman committed Sep 10, 2023
1 parent 48edbe1 commit 9efeb51
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions epan/dissectors/packet-rtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2102,9 +2102,6 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
/*struct srtp_info *srtp_info = NULL;*/
/*unsigned int srtp_offset;*/
const char *pt = NULL;
/* Can tap up to 4 RTP packets within same packet */
static struct _rtp_info rtp_info_arr[4];
static int rtp_info_current = 0;
struct _rtp_info *rtp_info;
static int * const octet1_fields[] = {
&hf_rtp_version,
Expand All @@ -2114,12 +2111,6 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
NULL
};

rtp_info_current++;
if (rtp_info_current == 4) {
rtp_info_current = 0;
}
rtp_info = &rtp_info_arr[rtp_info_current];

/* Get the fields in the first octet */
octet1 = tvb_get_guint8( tvb, offset );
version = RTP_VERSION( octet1 );
Expand Down Expand Up @@ -2221,6 +2212,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
}

/* fill in the rtp_info structure */
rtp_info = wmem_new0(pinfo->pool, struct _rtp_info);
rtp_info->info_version = version;
if (version != 2) {
/*
Expand Down

0 comments on commit 9efeb51

Please sign in to comment.