diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2013-11-17 14:48:55 +0000 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2013-11-17 14:48:55 +0000 |
commit | 55a9182c00814d8162511306c3cf2fa8e99b0f92 (patch) | |
tree | 51319548d792a56acb4f9cbef7adda5755640ab8 /epan/dissectors/packet-rtpproxy.c | |
parent | 3ddf37e9309fc58dcc052401b641b962c1590a78 (diff) |
From Peter Lemenkov via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9441 :
Fix Notify IPv6 address parsing in RTPproxy dissector
svn path=/trunk/; revision=53394
Diffstat (limited to 'epan/dissectors/packet-rtpproxy.c')
-rw-r--r-- | epan/dissectors/packet-rtpproxy.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/epan/dissectors/packet-rtpproxy.c b/epan/dissectors/packet-rtpproxy.c index b298897758..39eb44f69f 100644 --- a/epan/dissectors/packet-rtpproxy.c +++ b/epan/dissectors/packet-rtpproxy.c @@ -55,6 +55,7 @@ static int hf_rtpproxy_playback_filename = -1; static int hf_rtpproxy_playback_codec = -1; static int hf_rtpproxy_notify = -1; static int hf_rtpproxy_notify_ipv4 = -1; +static int hf_rtpproxy_notify_ipv6 = -1; static int hf_rtpproxy_notify_port = -1; static int hf_rtpproxy_notify_tag = -1; static int hf_rtpproxy_tag = -1; @@ -235,23 +236,32 @@ rtpproxy_add_tid(gboolean is_request, tvbuff_t *tvb, packet_info *pinfo, proto_t void rtpptoxy_add_notify_addr(proto_tree *rtpproxy_tree, tvbuff_t *tvb, guint begin, guint end) { - gint new_offset = 0; + gint offset = 0; + gint tmp = 0; + gboolean ipv6 = FALSE; proto_item *ti; - /* FIXME only IPv4 is supported */ - new_offset = tvb_find_guint8(tvb, begin, -1, ':'); - - if(new_offset == -1){ + /* Check for at least one colon */ + offset = tvb_find_guint8(tvb, begin, end, ':'); + if(offset != -1){ + /* Find if it's the latest colon (not in case of a IPv6) */ + while((tmp = tvb_find_guint8(tvb, offset+1, end, ':')) != -1){ + ipv6 = TRUE; + 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); + proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_port, tvb, offset+1, end - (offset+1), ENC_ASCII | ENC_NA); + } + 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>"); proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_port, tvb, begin, end - begin, ENC_ASCII | ENC_NA); } - else{ - /* We have ip:port */ - proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_ipv4, tvb, begin, new_offset - begin, ENC_ASCII | ENC_NA); - proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_port, tvb, new_offset+1, end - (new_offset+1), ENC_ASCII | ENC_NA); - } } static int @@ -805,6 +815,19 @@ proto_register_rtpproxy(void) } }, { + &hf_rtpproxy_notify_ipv6, + { + "Notification IPv6", + "rtpproxy.notify_ipv6", + FT_STRING, + BASE_NONE, + NULL, + 0x0, + NULL, + HFILL + } + }, + { &hf_rtpproxy_notify_port, { "Notification Port", |