dissect_rtp_heur: prevent a 'false positive' when trying stun dissection.
authorwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 12 Feb 2009 17:30:15 +0000 (17:30 +0000)
committerwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 12 Feb 2009 17:30:15 +0000 (17:30 +0000)
Specifically: when dissect_rtp_heur calls the stun dissector:
- Don't do a 'data' dissection if stun dissection fails;
  (ie: use call_dissector_only instead of call_dissector).
- return the stun dissector success/fail status to the caller of dissect_rtp_heur;
  (Done by registering and calling the heuristic version of the stun dissector).
Also: use call_dissector_only for each of the dissectors called by dissect_rtp_heur
 (altho it really makes no difference at this point except for the call to the
  stun dissector).

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27443 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-rtp.c
epan/dissectors/packet-stun.c

index 2036a960789027cbd169f09a34f87921c1e5f7c1..355b6638d3244ed229e84df62f2de989c342f5a9 100644 (file)
@@ -135,6 +135,7 @@ static const fragment_items rtp_fragment_items = {
 
 static dissector_handle_t rtp_handle;
 static dissector_handle_t stun_handle;
+static dissector_handle_t stun_heur_handle;
 static dissector_handle_t t38_handle;
 static dissector_handle_t zrtp_handle;
 
@@ -481,16 +482,16 @@ dissect_rtp_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
        if (version == 0) {
                if (!(tvb_memeql(tvb, 4, "ZRTP", 4)))
                {
-                       call_dissector(zrtp_handle, tvb, pinfo, tree);
+                       call_dissector_only(zrtp_handle, tvb, pinfo, tree);
                        return TRUE;
                } else {
                        switch (global_rtp_version0_type) {
                        case RTP0_STUN:
-                               call_dissector(stun_handle, tvb, pinfo, tree);
-                               return TRUE;
+                               return call_dissector_only(stun_heur_handle, tvb, pinfo, tree);
                                
                        case RTP0_T38:
-                               call_dissector(t38_handle, tvb, pinfo, tree);
+                               /* XXX: Should really be calling a heuristic dissector for T38 ??? */
+                               call_dissector_only(t38_handle, tvb, pinfo, tree);
                                return TRUE;
                                
                        case RTP0_INVALID:
@@ -1951,6 +1952,7 @@ proto_reg_handoff_rtp(void)
 
                data_handle = find_dissector("data");
                stun_handle = find_dissector("stun");
+               stun_heur_handle = find_dissector("stun-heur");
                t38_handle = find_dissector("t38");
                zrtp_handle = find_dissector("zrtp");
 
index 902ea5a5797fb75d1685eb84feae9bd7f129b80c..6e6ef1aa6fc3314ee25134722d52aff0a67660f3 100644 (file)
@@ -720,6 +720,7 @@ proto_register_stun(void)
        proto_register_subtree_array(ett, array_length(ett));
 
        new_register_dissector("stun", dissect_stun, proto_stun);
+        new_register_dissector("stun-heur", dissect_stun_heur, proto_stun);
 }