A couple of bugfixes and enhancements

- Updated RTPproxy dissector (again)
- Fix rare issue with the Sniffer traces (patch no. 23)

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
This commit is contained in:
Peter Lemenkov 2014-01-13 16:38:45 +04:00
parent e786aaccf2
commit ab5f7ca144
4 changed files with 386 additions and 28 deletions

View File

@ -195,6 +195,12 @@ From me: Remove dereferencing operator from 'ipaddr' in two calls to
svn path=/trunk/; revision=54156 svn path=/trunk/; revision=54156
Add numeric types instead of string where possible in the RTPproxy dissector. Bug 9561 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9561)
From Peter Lemenkov
svn path=/trunk/; revision=54467
diff --git a/AUTHORS b/AUTHORS diff --git a/AUTHORS b/AUTHORS
index 10782b0..e7b3c18 100644 index 10782b0..e7b3c18 100644
--- a/AUTHORS --- a/AUTHORS
@ -233,10 +239,10 @@ index 937f522..73217d7 100644
packet-rudp.c \ packet-rudp.c \
diff --git a/epan/dissectors/packet-rtpproxy.c b/epan/dissectors/packet-rtpproxy.c diff --git a/epan/dissectors/packet-rtpproxy.c b/epan/dissectors/packet-rtpproxy.c
new file mode 100644 new file mode 100644
index 0000000..2c8fba3 index 0000000..e8c5c95
--- /dev/null --- /dev/null
+++ b/epan/dissectors/packet-rtpproxy.c +++ b/epan/dissectors/packet-rtpproxy.c
@@ -0,0 +1,1386 @@ @@ -0,0 +1,1394 @@
+/* packet-rtpproxy.c +/* packet-rtpproxy.c
+ * RTPproxy command protocol dissector + * RTPproxy command protocol dissector
+ * Copyright 2013, Peter Lemenkov <lemenkov@gmail.com> + * Copyright 2013, Peter Lemenkov <lemenkov@gmail.com>
@ -564,7 +570,8 @@ index 0000000..2c8fba3
+ while(codecs[i]){ + while(codecs[i]){
+ /* We assume strings < 2^32-1 bytes long. :-) */ + /* We assume strings < 2^32-1 bytes long. :-) */
+ codec_len = (guint)strlen(codecs[i]); + codec_len = (guint)strlen(codecs[i]);
+ ti = proto_tree_add_item(another_tree, hf_rtpproxy_command_parameter_codec, tvb, begin+offset, codec_len, ENC_ASCII | ENC_NA); + ti = proto_tree_add_uint(another_tree, hf_rtpproxy_command_parameter_codec, tvb, begin+offset, codec_len,
+ (guint16) g_ascii_strtoull((gchar*)tvb_get_ephemeral_string(tvb, begin+offset, codec_len), NULL, 10));
+ proto_item_append_text(ti, " (%s)", val_to_str_ext((guint)strtoul(tvb_format_text(tvb,begin+offset,codec_len),NULL,10), &rtp_payload_type_vals_ext, "Unknown")); + proto_item_append_text(ti, " (%s)", val_to_str_ext((guint)strtoul(tvb_format_text(tvb,begin+offset,codec_len),NULL,10), &rtp_payload_type_vals_ext, "Unknown"));
+ offset += codec_len; + offset += codec_len;
+ if(codecs[i+1]) + if(codecs[i+1])
@ -588,14 +595,16 @@ index 0000000..2c8fba3
+ case 'z': + case 'z':
+ new_offset = (gint)strspn(rawstr+offset, "0123456789"); + new_offset = (gint)strspn(rawstr+offset, "0123456789");
+ another_tree = proto_item_add_subtree(ti, ett_rtpproxy_command_parameters_repacketize); + another_tree = proto_item_add_subtree(ti, ett_rtpproxy_command_parameters_repacketize);
+ proto_tree_add_item(another_tree, hf_rtpproxy_command_parameter_repacketize, tvb, begin+offset, new_offset, ENC_ASCII | ENC_NA); + proto_tree_add_uint(another_tree, hf_rtpproxy_command_parameter_repacketize, tvb, begin+offset, new_offset,
+ (guint16) g_ascii_strtoull((gchar*)tvb_get_ephemeral_string(tvb, begin+offset, new_offset), NULL, 10));
+ offset += new_offset; + offset += new_offset;
+ break; + break;
+ /* Unofficial long parameters */ + /* Unofficial long parameters */
+ case 'd': + case 'd':
+ new_offset = (gint)strspn(rawstr+offset, "0123456789"); + new_offset = (gint)strspn(rawstr+offset, "0123456789");
+ another_tree = proto_item_add_subtree(ti, ett_rtpproxy_command_parameters_dtmf); + another_tree = proto_item_add_subtree(ti, ett_rtpproxy_command_parameters_dtmf);
+ proto_tree_add_item(another_tree, hf_rtpproxy_command_parameter_dtmf, tvb, begin+offset, new_offset, ENC_ASCII | ENC_NA); + proto_tree_add_uint(another_tree, hf_rtpproxy_command_parameter_dtmf, tvb, begin+offset, new_offset,
+ (guint16) g_ascii_strtoull((gchar*)tvb_get_ephemeral_string(tvb, begin+offset, new_offset), NULL, 10));
+ if(rtpproxy_establish_conversation){ + if(rtpproxy_establish_conversation){
+ pt = (guint)strtoul(tvb_format_text(tvb,begin+offset,new_offset),NULL,10); + pt = (guint)strtoul(tvb_format_text(tvb,begin+offset,new_offset),NULL,10);
+ dissector_add_uint("rtp.pt", pt, rtp_events_handle); + dissector_add_uint("rtp.pt", pt, rtp_events_handle);
@ -615,7 +624,8 @@ index 0000000..2c8fba3
+ case 't': + case 't':
+ new_offset = (gint)strspn(rawstr+offset, "0123456789"); + new_offset = (gint)strspn(rawstr+offset, "0123456789");
+ another_tree = proto_item_add_subtree(ti, ett_rtpproxy_command_parameters_transcode); + another_tree = proto_item_add_subtree(ti, ett_rtpproxy_command_parameters_transcode);
+ ti = proto_tree_add_item(another_tree, hf_rtpproxy_command_parameter_transcode, tvb, begin+offset, new_offset, ENC_ASCII | ENC_NA); + ti = proto_tree_add_uint(another_tree, hf_rtpproxy_command_parameter_transcode, tvb, begin+offset, new_offset,
+ (guint16) g_ascii_strtoull((gchar*)tvb_get_ephemeral_string(tvb, begin+offset, new_offset), NULL, 10));
+ proto_item_append_text(ti, " (%s)", val_to_str_ext((guint)strtoul(tvb_format_text(tvb,begin+offset, new_offset),NULL,10), &rtp_payload_type_vals_ext, "Unknown")); + proto_item_append_text(ti, " (%s)", val_to_str_ext((guint)strtoul(tvb_format_text(tvb,begin+offset, new_offset),NULL,10), &rtp_payload_type_vals_ext, "Unknown"));
+ offset += new_offset; + offset += new_offset;
+ break; + break;
@ -693,14 +703,16 @@ index 0000000..2c8fba3
+ proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_ipv6, tvb, begin, offset - begin, ENC_ASCII | ENC_NA); + proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_ipv6, tvb, begin, offset - begin, ENC_ASCII | ENC_NA);
+ else + else
+ proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_ipv4, tvb, begin, offset - begin, ENC_ASCII | ENC_NA); + proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_ipv4, tvb, begin, offset - begin, ENC_ASCII | ENC_NA);
+ proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_port, tvb, offset+1, end - (offset+1), ENC_ASCII | ENC_NA); + proto_tree_add_uint(rtpproxy_tree, hf_rtpproxy_notify_port, tvb, offset+1, end - (offset+1),
+ (guint16) g_ascii_strtoull((gchar*)tvb_get_ephemeral_string(tvb, offset+1, end - (offset+1)), NULL, 10));
+ } + }
+ else{ + else{
+ /* Only port is supplied */ + /* Only port is supplied */
+ ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_ipv4, tvb, begin, 0, ENC_ASCII | ENC_NA); + ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_ipv4, tvb, begin, 0, ENC_ASCII | ENC_NA);
+ proto_item_append_text(ti, "<skipped>"); + proto_item_append_text(ti, "<skipped>");
+ PROTO_ITEM_SET_GENERATED(ti); + PROTO_ITEM_SET_GENERATED(ti);
+ proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_port, tvb, begin, end - begin, ENC_ASCII | ENC_NA); + proto_tree_add_uint(rtpproxy_tree, hf_rtpproxy_notify_port, tvb, begin, end - begin,
+ (guint16) g_ascii_strtoull((gchar*)tvb_get_ephemeral_string(tvb, begin, end - begin), NULL, 10));
+ } + }
+} +}
+ +
@ -865,7 +877,8 @@ index 0000000..2c8fba3
+ +
+ /* Extract Port */ + /* Extract Port */
+ new_offset = tvb_find_guint8(tvb, offset, -1, ' '); + new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
+ proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_port, tvb, offset, new_offset - offset, ENC_ASCII | ENC_NA); + proto_tree_add_uint(rtpproxy_tree, hf_rtpproxy_port, tvb, offset, new_offset - offset,
+ (guint16) g_ascii_strtoull((gchar*)tvb_get_ephemeral_string(tvb, offset, new_offset - offset), NULL, 10));
+ /* Skip whitespace */ + /* Skip whitespace */
+ offset = tvb_skip_wsp(tvb, new_offset+1, -1); + offset = tvb_skip_wsp(tvb, new_offset+1, -1);
+ } + }
@ -888,7 +901,8 @@ index 0000000..2c8fba3
+ +
+ /* Extract codec */ + /* Extract codec */
+ new_offset = tvb_find_guint8(tvb, offset, -1, ' '); + new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
+ proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_playback_codec, tvb, offset, new_offset - offset, ENC_ASCII | ENC_NA); + proto_tree_add_uint(rtpproxy_tree, hf_rtpproxy_playback_codec, tvb, offset, new_offset - offset,
+ (guint16) g_ascii_strtoull((gchar*)tvb_get_ephemeral_string(tvb, offset, new_offset - offset), NULL, 10));
+ /* Skip whitespace */ + /* Skip whitespace */
+ offset = tvb_skip_wsp(tvb, new_offset+1, -1); + offset = tvb_skip_wsp(tvb, new_offset+1, -1);
+ } + }
@ -986,7 +1000,7 @@ index 0000000..2c8fba3
+ new_offset = tvb_find_guint8(tvb, offset, -1, ' '); + new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
+ /* Convert port to unsigned 16-bit number */ + /* Convert port to unsigned 16-bit number */
+ port = (guint16) g_ascii_strtoull((gchar*)tvb_get_ephemeral_string(tvb, offset, new_offset - offset), NULL, 10); + port = (guint16) g_ascii_strtoull((gchar*)tvb_get_ephemeral_string(tvb, offset, new_offset - offset), NULL, 10);
+ proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_port, tvb, offset, new_offset - offset, ENC_ASCII | ENC_NA); + proto_tree_add_uint(rtpproxy_tree, hf_rtpproxy_port, tvb, offset, new_offset - offset, port);
+ /* Skip whitespace */ + /* Skip whitespace */
+ offset = tvb_skip_wsp(tvb, new_offset+1, -1); + offset = tvb_skip_wsp(tvb, new_offset+1, -1);
+ +
@ -1141,8 +1155,8 @@ index 0000000..2c8fba3
+ { + {
+ "Port", + "Port",
+ "rtpproxy.port", + "rtpproxy.port",
+ FT_STRING, + FT_UINT16, /* 0 - 65535 */
+ BASE_NONE, + BASE_DEC,
+ NULL, + NULL,
+ 0x0, + 0x0,
+ NULL, + NULL,
@ -1206,8 +1220,8 @@ index 0000000..2c8fba3
+ { + {
+ "Allowed codec", + "Allowed codec",
+ "rtpproxy.command_parameter_codec", + "rtpproxy.command_parameter_codec",
+ FT_STRING, + FT_UINT8, /* 0 - 127 */
+ BASE_NONE, + BASE_DEC,
+ NULL, + NULL,
+ 0x0, + 0x0,
+ NULL, + NULL,
@ -1245,8 +1259,8 @@ index 0000000..2c8fba3
+ { + {
+ "Repacketize (ms)", + "Repacketize (ms)",
+ "rtpproxy.command_parameter_repacketize", + "rtpproxy.command_parameter_repacketize",
+ FT_STRING, + FT_UINT16, /* 0 - 1000 milliseconds */
+ BASE_NONE, + BASE_DEC,
+ NULL, + NULL,
+ 0x0, + 0x0,
+ NULL, + NULL,
@ -1258,8 +1272,8 @@ index 0000000..2c8fba3
+ { + {
+ "DTMF payload ID", + "DTMF payload ID",
+ "rtpproxy.command_parameter_dtmf", + "rtpproxy.command_parameter_dtmf",
+ FT_STRING, + FT_UINT8, /* 0 - 127 */
+ BASE_NONE, + BASE_DEC,
+ NULL, + NULL,
+ 0x0, + 0x0,
+ NULL, + NULL,
@ -1284,8 +1298,8 @@ index 0000000..2c8fba3
+ { + {
+ "Transcode to", + "Transcode to",
+ "rtpproxy.command_parameter_transcode", + "rtpproxy.command_parameter_transcode",
+ FT_STRING, + FT_UINT8, /* 0 - 127 */
+ BASE_NONE, + BASE_DEC,
+ NULL, + NULL,
+ 0x0, + 0x0,
+ NULL, + NULL,
@ -1310,7 +1324,7 @@ index 0000000..2c8fba3
+ { + {
+ "Copy target", + "Copy target",
+ "rtpproxy.copy_target", + "rtpproxy.copy_target",
+ FT_STRING, + FT_STRING, /* Filename or UDP address, e.g. /var/tmp/fileXXXX.yyy or IP:Port */
+ BASE_NONE, + BASE_NONE,
+ NULL, + NULL,
+ 0x0, + 0x0,
@ -1336,8 +1350,8 @@ index 0000000..2c8fba3
+ { + {
+ "Playback codec", + "Playback codec",
+ "rtpproxy.playback_codec", + "rtpproxy.playback_codec",
+ FT_STRING, + FT_UINT8, /* 0 - 127 */
+ BASE_NONE, + BASE_DEC,
+ NULL, + NULL,
+ 0x0, + 0x0,
+ NULL, + NULL,
@ -1427,8 +1441,8 @@ index 0000000..2c8fba3
+ { + {
+ "Notification Port", + "Notification Port",
+ "rtpproxy.notify_port", + "rtpproxy.notify_port",
+ FT_STRING, + FT_UINT16,
+ BASE_NONE, + BASE_DEC,
+ NULL, + NULL,
+ 0x0, + 0x0,
+ NULL, + NULL,

View File

@ -0,0 +1,299 @@
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Fri, 13 Dec 2013 22:10:21 +0400
Subject: [PATCH] Fix IP types
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/epan/dissectors/packet-rtpproxy.c b/epan/dissectors/packet-rtpproxy.c
index e8c5c95..6291de3 100644
--- a/epan/dissectors/packet-rtpproxy.c
+++ b/epan/dissectors/packet-rtpproxy.c
@@ -40,6 +40,9 @@
#include <epan/expert.h>
#include <epan/rtp_pt.h>
+#include <epan/exceptions.h>
+#include <epan/show_exception.h>
+
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
@@ -69,8 +72,8 @@ static int hf_rtpproxy_command = -1;
static int hf_rtpproxy_command_parameters = -1;
static int hf_rtpproxy_command_parameter = -1;
static int hf_rtpproxy_command_parameter_codec = -1;
-static int hf_rtpproxy_command_parameter_local = -1;
-static int hf_rtpproxy_command_parameter_remote = -1;
+static int hf_rtpproxy_command_parameter_local_ipv4 = -1;
+static int hf_rtpproxy_command_parameter_remote_ipv4 = -1;
static int hf_rtpproxy_command_parameter_repacketize = -1;
static int hf_rtpproxy_command_parameter_dtmf = -1;
/* static int hf_rtpproxy_command_parameter_cmap = -1; TODO */
@@ -294,8 +297,8 @@ rtpproxy_add_tag(proto_tree *rtpproxy_tree, tvbuff_t *tvb, guint begin, guint re
return (end == realsize ? -1 : (gint)end);
}
-void
-rtpproxy_add_parameter(proto_tree *rtpproxy_tree, tvbuff_t *tvb, guint begin, guint realsize)
+static void
+rtpproxy_add_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *rtpproxy_tree, guint begin, guint realsize)
{
proto_item *ti;
proto_tree *another_tree = NULL;
@@ -306,6 +309,7 @@ rtpproxy_add_parameter(proto_tree *rtpproxy_tree, tvbuff_t *tvb, guint begin, gu
gchar** codecs = NULL;
guint codec_len;
guint8* rawstr = NULL;
+ guint32 ipaddr[4]; /* Enough room for IPv4 or IPv6 */
/* Extract the entire parameters line. */
/* Something like "t4p1iic8,0,2,4,18,96,97,98,100,101" */
@@ -338,13 +342,19 @@ rtpproxy_add_parameter(proto_tree *rtpproxy_tree, tvbuff_t *tvb, guint begin, gu
case 'l':
new_offset = (gint)strspn(rawstr+offset, "0123456789.");
another_tree = proto_item_add_subtree(ti, ett_rtpproxy_command_parameters_local);
- proto_tree_add_item(another_tree, hf_rtpproxy_command_parameter_local, tvb, begin+offset, new_offset, ENC_ASCII | ENC_NA);
+ if(inet_pton(AF_INET, (char*)tvb_get_ephemeral_string(tvb, begin+offset, new_offset), ipaddr))
+ proto_tree_add_ipv4(another_tree, hf_rtpproxy_command_parameter_local_ipv4, tvb, begin+offset, new_offset, ipaddr[0]);
+ else
+ show_exception(tvb, pinfo, another_tree, DissectorError, "Bogus IPv4");
offset += new_offset;
break;
case 'r':
new_offset = (gint)strspn(rawstr+offset, "0123456789.");
another_tree = proto_item_add_subtree(ti, ett_rtpproxy_command_parameters_remote);
- proto_tree_add_item(another_tree, hf_rtpproxy_command_parameter_remote, tvb, begin+offset, new_offset, ENC_ASCII | ENC_NA);
+ if(inet_pton(AF_INET, (char*)tvb_get_ephemeral_string(tvb, begin+offset, new_offset), ipaddr))
+ proto_tree_add_ipv4(another_tree, hf_rtpproxy_command_parameter_remote_ipv4, tvb, begin+offset, new_offset, ipaddr[0]);
+ else
+ show_exception(tvb, pinfo, another_tree, DissectorError, "Bogus IPv4");
offset += new_offset;
break;
case 'z':
@@ -437,12 +447,13 @@ rtpproxy_add_tid(gboolean is_request, tvbuff_t *tvb, packet_info *pinfo, proto_t
return rtpproxy_info;
}
-void
-rtpproxy_add_notify_addr(proto_tree *rtpproxy_tree, tvbuff_t *tvb, guint begin, guint end)
+static void
+rtpproxy_add_notify_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *rtpproxy_tree, guint begin, guint end)
{
gint offset = 0;
gint tmp = 0;
gboolean ipv6 = FALSE;
+ guint32 ipaddr[4]; /* Enough room for IPv4 or IPv6 */
proto_item *ti;
/* Check for at least one colon */
@@ -454,17 +465,28 @@ rtpproxy_add_notify_addr(proto_tree *rtpproxy_tree, tvbuff_t *tvb, guint begin,
offset = tmp;
}
/* We have ip:port */
- if(ipv6)
- proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_ipv6, tvb, begin, offset - begin, ENC_ASCII | ENC_NA);
- else
- proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_ipv4, tvb, begin, offset - begin, ENC_ASCII | ENC_NA);
+ if(ipv6){
+ if(inet_pton(AF_INET6, (char*)tvb_get_ephemeral_string(tvb, begin, offset - begin), ipaddr))
+ proto_tree_add_ipv6(rtpproxy_tree, hf_rtpproxy_notify_ipv6, tvb, begin, offset - begin, (const guint8 *)ipaddr);
+ else
+ show_exception(tvb, pinfo, rtpproxy_tree, DissectorError, "Bogus IPv6");
+ }
+ else{
+ if(inet_pton(AF_INET, (char*)tvb_get_ephemeral_string(tvb, begin, offset - begin), ipaddr))
+ proto_tree_add_ipv4(rtpproxy_tree, hf_rtpproxy_notify_ipv4, tvb, begin, offset - begin, ipaddr[0]);
+ else
+ show_exception(tvb, pinfo, rtpproxy_tree, DissectorError, "Bogus IPv4");
+ }
proto_tree_add_uint(rtpproxy_tree, hf_rtpproxy_notify_port, tvb, offset+1, end - (offset+1),
(guint16) g_ascii_strtoull((gchar*)tvb_get_ephemeral_string(tvb, offset+1, end - (offset+1)), NULL, 10));
}
else{
- /* Only port is supplied */
- ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_ipv4, tvb, begin, 0, ENC_ASCII | ENC_NA);
- proto_item_append_text(ti, "<skipped>");
+ /* Only port is supplied - take IPv4/IPv6 from ip.src/ipv6.src respectively */
+ expert_add_info_format(pinfo, rtpproxy_tree, PI_PROTOCOL, PI_WARN, "Only port is supplied - take IPv4/IPv6 from ip.src/ipv6.src respectively");
+ if (pinfo->src.type == AT_IPv4)
+ ti = proto_tree_add_ipv4(rtpproxy_tree, hf_rtpproxy_notify_ipv4, tvb, begin, 0, ((guint32*)(pinfo->src.data))[0]);
+ else
+ ti = proto_tree_add_ipv6(rtpproxy_tree, hf_rtpproxy_notify_ipv6, tvb, begin, 0, (const guint8 *)(pinfo->src.data));
PROTO_ITEM_SET_GENERATED(ti);
proto_tree_add_uint(rtpproxy_tree, hf_rtpproxy_notify_port, tvb, begin, end - begin,
(guint16) g_ascii_strtoull((gchar*)tvb_get_ephemeral_string(tvb, begin, end - begin), NULL, 10));
@@ -490,7 +512,7 @@ dissect_rtpproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
/* For RT(C)P setup */
address addr;
guint16 port;
- guint32 ipaddr[4];
+ guint32 ipaddr[4]; /* Enough room for IPv4 or IPv6 */
rtpproxy_info_t *rtpproxy_info = NULL;
/* If it does not start with a printable character it's not RTPProxy */
@@ -600,7 +622,7 @@ dissect_rtpproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
if (new_offset != offset + 1){
rtpproxy_tree = proto_item_add_subtree(ti, ett_rtpproxy_command);
ti2 = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_command_parameters, tvb, offset+1, new_offset - (offset+1), ENC_ASCII | ENC_NA);
- rtpproxy_add_parameter(proto_item_add_subtree(ti2, ett_rtpproxy_command_parameters), tvb, offset+1, new_offset - (offset+1));
+ rtpproxy_add_parameter(tvb, pinfo, proto_item_add_subtree(ti2, ett_rtpproxy_command_parameters), offset+1, new_offset - (offset+1));
rtpproxy_tree = proto_item_get_parent(ti);
}
@@ -623,10 +645,18 @@ dissect_rtpproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
if ((tmp == 'u') || (tmp == 'l')){
/* Extract IP */
new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
- if (tvb_find_guint8(tvb, offset, new_offset - offset, ':') == -1)
- proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_ipv4, tvb, offset, new_offset - offset, ENC_ASCII | ENC_NA);
- else
- proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_ipv6, tvb, offset, new_offset - offset, ENC_ASCII | ENC_NA);
+ if (tvb_find_guint8(tvb, offset, new_offset - offset, ':') == -1){
+ if(inet_pton(AF_INET, (char*)tvb_get_ephemeral_string(tvb, offset, new_offset - offset), ipaddr))
+ proto_tree_add_ipv4(rtpproxy_tree, hf_rtpproxy_ipv4, tvb, offset, new_offset - offset, ipaddr[0]);
+ else
+ show_exception(tvb, pinfo, rtpproxy_tree, DissectorError, "Bogus IPv4");
+ }
+ else{
+ if(inet_pton(AF_INET6, (char*)tvb_get_ephemeral_string(tvb, offset, new_offset - offset), ipaddr))
+ proto_tree_add_ipv6(rtpproxy_tree, hf_rtpproxy_ipv6, tvb, offset, new_offset - offset, (const guint8 *)ipaddr);
+ else
+ show_exception(tvb, pinfo, rtpproxy_tree, DissectorError, "Bogus IPv6");
+ }
/* Skip whitespace */
offset = tvb_skip_wsp(tvb, new_offset+1, -1);
@@ -686,12 +716,12 @@ dissect_rtpproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
if(new_offset == -1){
/* NotifyTag wasn't found (we should re-use Call-ID instead) */
- rtpproxy_add_notify_addr(rtpproxy_tree, tvb, offset, realsize);
+ rtpproxy_add_notify_addr(tvb, pinfo, rtpproxy_tree, offset, realsize);
break; /* No more parameters */
}
/* NotifyTag was found */
- rtpproxy_add_notify_addr(rtpproxy_tree, tvb, offset, new_offset);
+ rtpproxy_add_notify_addr(tvb, pinfo, rtpproxy_tree, offset, new_offset);
/* Skip whitespace */
offset = tvb_skip_wsp(tvb, new_offset+1, -1);
@@ -760,29 +790,38 @@ dissect_rtpproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
offset = tvb_skip_wsp(tvb, new_offset+1, -1);
/* Extract IP */
+ memset(&addr, 0, sizeof(address));
tmp = tvb_find_line_end(tvb, offset, -1, &new_offset, FALSE);
if (tvb_find_guint8(tvb, offset, -1, ':') == -1){
- inet_pton(AF_INET, (char*)tvb_get_ephemeral_string(tvb, offset, tmp), ipaddr);
- addr.type = AT_IPv4;
- addr.len = 4;
- addr.data = ep_memdup(ipaddr, 4);
- proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_ipv4, tvb, offset, tmp, ENC_ASCII | ENC_NA);
+ if (inet_pton(AF_INET, (char*)tvb_get_ephemeral_string(tvb, offset, tmp), ipaddr)){
+ addr.type = AT_IPv4;
+ addr.len = 4;
+ addr.data = ep_memdup(ipaddr, 4);
+ proto_tree_add_ipv4(rtpproxy_tree, hf_rtpproxy_ipv4, tvb, offset, tmp, ipaddr[0]);
+ }
+ else
+ show_exception(tvb, pinfo, rtpproxy_tree, DissectorError, "Bogus IPv4");
}
else{
- inet_pton(AF_INET6, (char*)tvb_get_ephemeral_string(tvb, offset, tmp), ipaddr);
- addr.type = AT_IPv6;
- addr.len = 16;
- addr.data = ep_memdup(ipaddr, 16);
- proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_ipv6, tvb, offset, tmp, ENC_ASCII | ENC_NA);
+ if (inet_pton(AF_INET6, (char*)tvb_get_ephemeral_string(tvb, offset, tmp), ipaddr)){
+ addr.type = AT_IPv6;
+ addr.len = 16;
+ addr.data = ep_memdup(ipaddr, 16);
+ proto_tree_add_ipv6(rtpproxy_tree, hf_rtpproxy_ipv6, tvb, offset, tmp, (const guint8 *)ipaddr);
+ }
+ else
+ show_exception(tvb, pinfo, rtpproxy_tree, DissectorError, "Bogus IPv6");
}
if(rtpproxy_establish_conversation){
if (rtp_handle) {
/* FIXME tell if isn't a video stream, and setup codec mapping */
- rtp_add_address(pinfo, &addr, port, 0, "RTPproxy", pinfo->fd->num, 0, NULL);
+ if (addr.len)
+ rtp_add_address(pinfo, &addr, port, 0, "RTPproxy", pinfo->fd->num, 0, NULL);
}
if (rtcp_handle) {
- rtcp_add_address(pinfo, &addr, port+1, 0, "RTPproxy", pinfo->fd->num);
+ if (addr.len)
+ rtcp_add_address(pinfo, &addr, port+1, 0, "RTPproxy", pinfo->fd->num);
}
}
break;
@@ -884,7 +923,7 @@ proto_register_rtpproxy(void)
{
"IPv4",
"rtpproxy.ipv4",
- FT_STRING,
+ FT_IPv4,
BASE_NONE,
NULL,
0x0,
@@ -897,7 +936,7 @@ proto_register_rtpproxy(void)
{
"IPv6",
"rtpproxy.ipv6",
- FT_STRING,
+ FT_IPv6,
BASE_NONE,
NULL,
0x0,
@@ -984,11 +1023,11 @@ proto_register_rtpproxy(void)
}
},
{
- &hf_rtpproxy_command_parameter_local,
+ &hf_rtpproxy_command_parameter_local_ipv4,
{
- "Local IP address",
- "rtpproxy.command_parameter_local",
- FT_STRING,
+ "Local IPv4 address",
+ "rtpproxy.command_parameter_local_ipv4",
+ FT_IPv4, /* FIXME - is it ever possible to see IPv6 here? */
BASE_NONE,
NULL,
0x0,
@@ -997,11 +1036,11 @@ proto_register_rtpproxy(void)
}
},
{
- &hf_rtpproxy_command_parameter_remote,
+ &hf_rtpproxy_command_parameter_remote_ipv4,
{
- "Remote IP address",
- "rtpproxy.command_parameter_remote",
- FT_STRING,
+ "Remote IPv4 address",
+ "rtpproxy.command_parameter_remote_ipv4",
+ FT_IPv4, /* FIXME - is it ever possible to see IPv6 here? */
BASE_NONE,
NULL,
0x0,
@@ -1170,7 +1209,7 @@ proto_register_rtpproxy(void)
{
"Notification IPv4",
"rtpproxy.notify_ipv4",
- FT_STRING,
+ FT_IPv4,
BASE_NONE,
NULL,
0x0,
@@ -1183,7 +1222,7 @@ proto_register_rtpproxy(void)
{
"Notification IPv6",
"rtpproxy.notify_ipv6",
- FT_STRING,
+ FT_IPv6,
BASE_NONE,
NULL,
0x0,

View File

@ -0,0 +1,34 @@
From: Guy Harris <guy@alum.mit.edu>
Date: Wed, 1 Jan 2014 23:24:27 +0000
Subject: [PATCH] Copy over r54544 from trunk:
------------------------------------------------------------------------
r54544 | guy | 2014-01-01 15:22:53 -0800 (Wed, 01 Jan 2014) | 11 lines
If the uncompression buffers are empty, they have no data; set the count
of bytes in them to 0, as there's no data in them, and set the offset in
that buffer of the stream's current position, to 0, as we're currently
at the beginning of the file in both streams.
This fixes some tricky-to-reproduce errors (which show up only if the
ngsniffer_t structure is allocated from data that's been allocated,
written to in those variables, and freed).
svn path=/trunk-1.10/; revision=54545
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
index 92e451d..096ee00 100644
--- a/wiretap/ngsniffer.c
+++ b/wiretap/ngsniffer.c
@@ -740,7 +740,11 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info)
/* We haven't allocated any uncompression buffers yet. */
ngsniffer->seq.buf = NULL;
+ ngsniffer->seq.nbytes = 0;
+ ngsniffer->seq.nextout = 0;
ngsniffer->rand.buf = NULL;
+ ngsniffer->rand.nbytes = 0;
+ ngsniffer->rand.nextout = 0;
/* Set the current file offset; the offset in the compressed file
and in the uncompressed data stream currently the same. */

View File

@ -21,7 +21,7 @@
Summary: Network traffic analyzer Summary: Network traffic analyzer
Name: wireshark Name: wireshark
Version: 1.10.5 Version: 1.10.5
Release: 1%{?dist} Release: 2%{?dist}
License: GPL+ License: GPL+
Group: Applications/Internet Group: Applications/Internet
Source0: http://wireshark.org/download/src/%{name}-%{version}.tar.bz2 Source0: http://wireshark.org/download/src/%{name}-%{version}.tar.bz2
@ -66,9 +66,14 @@ Patch18: wireshark-0018-Copy-over-from-Trunk.patch
Patch19: wireshark-0019-Bugfix-port-number-endianness.-Bug-9530-https-bugs.w.patch Patch19: wireshark-0019-Bugfix-port-number-endianness.-Bug-9530-https-bugs.w.patch
# No longer necessary - will be removed in the next release (1.12.x) # No longer necessary - will be removed in the next release (1.12.x)
Patch20: wireshark-0020-Something-went-wrong-with-the-backport-of-r53608-r53.patch Patch20: wireshark-0020-Something-went-wrong-with-the-backport-of-r53608-r53.patch
# Sent upstream: # Applied upstream:
# https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9576 # https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9576
Patch21: wireshark-0021-Remove-g_memmove.patch Patch21: wireshark-0021-Remove-g_memmove.patch
# W.i.p. patch. See also:
# https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9561
Patch22: wireshark-0022-Fix-IP-types.patch
# Backported from upstream
Patch23: wireshark-0023-Copy-over-r54544-from-trunk.patch
Url: http://www.wireshark.org/ Url: http://www.wireshark.org/
BuildRequires: libpcap-devel >= 0.9 BuildRequires: libpcap-devel >= 0.9
@ -184,6 +189,8 @@ and plugins.
#%patch19 -p1 -b .fix_endianness #%patch19 -p1 -b .fix_endianness
#%patch20 -p1 -b .fix_previous_backport #%patch20 -p1 -b .fix_previous_backport
%patch21 -p1 -b .remove_g_memmove %patch21 -p1 -b .remove_g_memmove
%patch22 -p1 -b .rtpproxy_ip_types
%patch23 -p1 -b .rare_bug_with_sniffer_traces
%build %build
%ifarch s390 s390x sparcv9 sparc64 %ifarch s390 s390x sparcv9 sparc64
@ -382,6 +389,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_datadir}/aclocal/* %{_datadir}/aclocal/*
%changelog %changelog
* Mon Jan 13 2014 Peter Lemenkov <lemenkov@gmail.com> - 1.10.5-2
- Updated RTPproxy dissector (again)
- Fix rare issue with the Sniffer traces (patch no. 23)
* Mon Dec 23 2013 Peter Lemenkov <lemenkov@gmail.com> - 1.10.5-1 * Mon Dec 23 2013 Peter Lemenkov <lemenkov@gmail.com> - 1.10.5-1
- Ver. 1.10.5 - Ver. 1.10.5
- Don't apply upstreamed patches no. 18, 19, 20. - Don't apply upstreamed patches no. 18, 19, 20.