Commit Graph

287 Commits

Author SHA1 Message Date
Jakub Zawadzki 659d0efc92 sip optimization: avoid calling tvb_get_guint8.
Use tvb_pbrk_guint8, tvb_find_guint8 when possible.

Change-Id: If8090d9b9b92146e9c216f139c056130d6b04e78
Reviewed-on: https://code.wireshark.org/review/2569
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-07-01 04:15:02 +00:00
AndersBroman 073bf490aa From Johan Whahl:
Added dissection of the SIP Service-Route header.

Change-Id: Ic4523edb374ae03492af5853863dde501a0c30e0
Reviewed-on: https://code.wireshark.org/review/2721
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-30 14:38:46 +00:00
Evan Huus 02edc3369b Revert "Optimize sip_is_known_sip_header()"
This reverts commit c9a5fbeb1d.

Change-Id: Ic2e5d531f719ed1107ef7bb1de12175d4601fd6d
Reviewed-on: https://code.wireshark.org/review/2574
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-23 16:22:30 +00:00
Jakub Zawadzki c9a5fbeb1d Optimize sip_is_known_sip_header()
Profling SIP shows that gperf generated hashing code, is
3 times faster than using GHashTable & g_str_hash/_equal()

This result in about 1% improve of whole dissection (sip traffic with filter).

Change-Id: Id6bf64bacd872e2d1c30a1b6356db444b25ba326
Reviewed-on: https://code.wireshark.org/review/2116
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-23 14:42:20 +00:00
Jakub Zawadzki a45ce57a1a Optimize dissect_sip_route_header()
Don't manually fetch each character to find ',' use tvb_find_guint8()

Change-Id: I29711421469e868a86bf2edd7adf8dcc85ed26eb
Reviewed-on: https://code.wireshark.org/review/2446
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-19 22:16:43 +00:00
Jakub Zawadzki 5844e12989 Optimize dissect_sip_uri()
- Combine tvb_find_guint8() for comma, semicolon into one tvb_pbrk_guint8()

- Instead of fetching each character use tvb_pbrk_guint8() to fast
  forward.

- Remove not needed tvb_find_guint8() call, as the result is discarded.

Change-Id: I38d6775b187146656d47cea9b64f8e0ccad18d36
Reviewed-on: https://code.wireshark.org/review/2384
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-19 00:08:04 +00:00
Michael Mann 73217d9f3f tvb_new_subset -> tvb_new_subset_length when length parameters are equal.
tvb_new_subset -> tvb_new_subset_remaining it appears that's what the intention is.

Change-Id: I2334bbf3f10475b3c22391392fc8b6864454de2d
Reviewed-on: https://code.wireshark.org/review/1999
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-06-07 15:41:07 +00:00
AndersBroman 7e77631eae Add a handle to dissect sip userinfo.
Change-Id: Ia8c15b710d79f12e8f62a49b17f057b746f31f0c
Reviewed-on: https://code.wireshark.org/review/1980
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-05 14:32:17 +00:00
Jakub Zawadzki 5c48774a01 sip: avoid calling tvb_format_text() when tree is not visible.
sip dissector when filtering spends ~5% of Ir in tvb_format_text(),
avoid calling.

Change-Id: I1de8e970b300354c0536aead65178401f140f509
Reviewed-on: https://code.wireshark.org/review/1974
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-05 11:48:51 +00:00
Pascal Quantin 1c5e92da75 SIP: remove leading spaces/tabs between security parameters
Change-Id: Icf15d18a16937e48d6b96749e8fa7c931916b491
Reviewed-on: https://code.wireshark.org/review/1743
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-23 15:24:45 +00:00
Pascal Quantin 16d7dcad0b SIP: parse ports definition in security mechanism
Change-Id: Iaef57f01b903b66ec55275d77f80f4e81a8130dc
Reviewed-on: https://code.wireshark.org/review/1747
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-23 15:22:51 +00:00
AndersBroman 2cfda31ff0 Change the signature of dissector_try_heuristic() to return hdtbl_entry
which can be used to call the found heuristic dissector on the next pass.

Introduce call_heur_dissector_direct() to be used to call a heuristic
dissector which accepted the frame on the first pass.

Change-Id: I524edd717b7d92b510bd60acfeea686d5f2b4582
Reviewed-on: https://code.wireshark.org/review/1697
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-21 20:17:29 +00:00
Jakub Zawadzki d7bd2ecf9f Add new proto_tree_add_format_text() function
There are lot of text dissectors which want just to add escaped (not filtrable) text,
add new function proto_tree_add_format_text() which just do this in optimized way.

Change-Id: Ia0e189b620cc0a5b74cfdaef1ad4571d766bb2ab
Reviewed-on: https://code.wireshark.org/review/1678
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-19 02:27:12 +00:00
Jakub Zawadzki ea95c837fe Introduce col_add_lstr(), use it instead of slower col_add_fstr.
We have callgrind benchmarks which shows that col_add_fstr() takes
5% of Ir count cause of formatting done in g_vsnprintf().

New col_add_lstr() can be used in few dissectors without much ugliness,
and it should be a little faster.

Change-Id: Ifddd951063dfd3a27c2a7da4dafce9b242c0472c
Reviewed-on: https://code.wireshark.org/review/1629
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-17 21:33:26 +00:00
AndersBroman cd8188ddb8 Reduce the number of calls to tvb_reported_lenght_remaining().
Change-Id: I717572d403b38a33ccd5e390ace3742f3d296250
Reviewed-on: https://code.wireshark.org/review/1622
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-13 11:49:31 +00:00
AndersBroman 89e61b9b37 Save the result of tvb_reported_length_remaining() and use it to reduce the number of calls to tvb_reported_length_remaining().
Change-Id: I6c110d7d995e4c771bbeea9013d867c46ca96778
Reviewed-on: https://code.wireshark.org/review/1613
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-12 21:49:00 +00:00
AndersBroman 1d1730fc56 Update some soft-deprecated APIs.
Change-Id: I0e255e72dd4cd9a94a4f92af409c4b34c0a266ed
Reviewed-on: https://code.wireshark.org/review/1491
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-04 19:23:05 +00:00
Pascal Quantin ad33357e62 Exported PDU: add support for more than 32 tags
Change-Id: Idc9f105164919827a8a81c88b5a56de4fa25df0b
Reviewed-on: https://code.wireshark.org/review/1197
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-18 20:15:04 +00:00
Bill Meier c0b0a11e4e (Pedantic): set editor modelines tab-width & etc to 8; Also: fix some indentation in packet-sip.c
Change-Id: I623fc5e4c1247dbe5e15f0f33270f4f0994268ab
Reviewed-on: https://code.wireshark.org/review/943
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-04-03 15:31:56 +00:00
AndersBroman b3708a9c4a According to RFC 3261
7 SIP Messages

   SIP is a text-based protocol and uses the UTF-8 charset

So use ENC_UTF_8|ENC_NA.

Change-Id: I0101eca3dd7d8ff9ebf98fd733548131b862919e
Reviewed-on: https://code.wireshark.org/review/890
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-31 15:51:27 +00:00
Pascal Quantin 7785dd00cd Please checkAPI.pl
Change-Id: I78e9d3781df81fd4edda7e9b20749cb096a05499
Reviewed-on: https://code.wireshark.org/review/861
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-03-28 22:51:50 +00:00
AndersBroman f7c62543f9 tvb_get_ascii_string is really expensive. On a large capture file which I
profiled in october Fetch cost has gone from 15,6M to 24,2M, changing
tvb_get_string() to tvb_get_string_enc() with ENC_UTF_8 where it seems
safe helps a bit and should be done any way.

Change-Id: I4d3e640bfde3304a991c09e2a30ad7dd132fc5ac
Reviewed-on: https://code.wireshark.org/review/855
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-28 14:05:29 +00:00
Hadriel Kaplan a04f610989 Add debug printing functions for conversations, sip, sdp, rtp
There have been enough gnarly bus in sip/sdp/rtp that it needs
to have good debug printing. Using a debugger isn't good enough
because there's interaction across multiple frames and it's too
hard to follow what's going on without real printed data history.

Change-Id: Ifb5bb1fb580be81f988569ece79d238a9c030c34
Reviewed-on: https://code.wireshark.org/review/688
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-21 05:15:57 +00:00
Pascal Quantin 488f2a0974 Exported PDU: add support for data length on the wire
Change-Id: Iff14ec4d0297ec85f3597b33871fb0ab5256a597
Reviewed-on: https://code.wireshark.org/review/728
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-19 05:13:30 +00:00
Hadriel Kaplan c4c8350284 Fix bug 9021: 'RTP not decoded inside the conversation in v.1.10.1'
The behavior for SIP/SDP handling of RTP conversation tracking
changed in v1.10, with some unintended consequences.  The bugs did not
show up at the time because wireshark makes 2 passes of the packet list,
and so the problems auto-corrected themselves in most cases.  Unfortunately,
a change in r53641 modified how UDP behaves, making it always create
conversations for UDP packets, and that exposed the bugs inherent in the
SIP/SDP code changes.

This commit reverts the behavior of SIP/SDP to its pre-1.10 model, but
creates a new preference setting for "Delay SDP changes for tracking media",
which if enabled, will turn on the new (but buggy) model introduced in 1.10.
This preference is *disabled* by default, since for a majority of cases the
new behavior is worse than the previous behavior.

The preference, and this commit's fix, is not intended to last long. I intend
to re-write the SIP/SDP/RTP interaction model for release 1.11 - I think it's
too big a change for 1.10, however, which is why I submitted this commit.

Change-Id: Ic5601749d6c2344e952ced8206dd9296bfdc4b90
Reviewed-on: https://code.wireshark.org/review/543
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-12 17:59:51 +00:00
Hadriel Kaplan 69cc9e1045 Fix whitespace tabs to spaces, indent by 4, modelines
Change-Id: I8bb64a879d1aa779c9ac85db306cbd34d1188243
Reviewed-on: https://code.wireshark.org/review/617
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-12 16:28:10 +00:00
Pascal Quantin d89195d1b8 Fix a trivial typo
Change-Id: Ibb2609b865ebaca14572c480d06ecc6ae7ef73f5
Reviewed-on: https://code.wireshark.org/review/614
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-03-12 14:22:53 +00:00
Hadriel Kaplan 7e7bf82456 Fix Bug 9872: 'SIP status line in 200 OK for de-registration is misleading'
The status line of the 200 OK during a deregistration is (1 bindings), but it
should be (0 bindings). Wireshark should check the "expires=0" in the contact
header not just count the number of the contact lines. But since it's not
truly valid to have expires=o contacts in responses, this commit adds expert
info warning of such.

Also, the REGISTER request itself already says "(remove all bindings)"
in the Info column currently if the Contact was a '*', but it didn't
say something similar if only de-registering one or more explicit
contacts. This has been fixed as well.

Lastly, this fixes three other bugs I found while reading the code and testing:
(1) comma-separated Contact headers will be displayed as a single one if
the first one(s) don't have header params but a subsequent one does; and
(2) the last Contact header param is displayed with the trailing '\r\n'
header separator; and (3) the SIP REGISTER response code displayed contact
binding info for responses other than 2xx, which isn't logical.

Since all of these are in the same area and not critical, I'm lumping these
all together.

A test capture file used for testing is attached to the bug.

As an aside, the SIP header parsing code needs to be refactored. Most SIP
headers follow a common ABNF pattern, and should be parsed using a common
function(s) so these issues don't crop up for specific headers.

Change-Id: I16c531fcb244dc121fc0e8046908e475b41489f9
Reviewed-on: https://code.wireshark.org/review/612
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-12 12:51:48 +00:00
Hadriel Kaplan 058527f3f1 Fix bug 9835 disabled second media stream disables all media streams
When a single media line is rejected in an SDP answer, for example a second
'm=video' line, wireshark disables ALL media sessions, instead of just that
one.  But per the RFCs, all it should do is disable just the one RTP media
session the m= line represents. This commit fixes that, so that a disabled
media session (one with a m= port of 0) in the SDP answer only disables its
associated/paired media stream in the offer.

Change-Id: I9bd0d3fc88b8eaa55207c9bf3f3e37da7746fd14
Reviewed-on: https://code.wireshark.org/review/526
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-07 05:03:57 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Hadriel Kaplan cfeae2f86c Fix clang warning regarding null pointer use in packet-sip.c.
In malformed sip-sec header fields, missing spi-c/spi-s values will
cause thie 'value' pointer to remain NULL, leading to bad things.
This fix checks for that and adds an expert warning about malformed
sip-sec mechanism.

Change-Id: Ia7d1741fc8d829dd14e5c68f21fa99282eddbeab
Reviewed-on: https://code.wireshark.org/review/299
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-22 16:43:32 +00:00
Pascal Quantin 373bf9bd86 Parse SIP sec-mechanism
From Anders Broman: parse security mechanism as specified in RFC 3329

Change-Id: I37300aa45740a11679149550943b3a1614ac8423
Reviewed-on: https://code.wireshark.org/review/138
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Tested-by: Anders Broman <a.broman58@gmail.com>
2014-02-07 15:45:01 +00:00
Evan Huus 732db281e9 Use wmem_new0 to ensure that all field values are initialized. Caught by
valgrind fuzzing.

svn path=/trunk/; revision=54922
2014-01-23 01:48:13 +00:00
Anders Broman 7a5d4ed4da - Make local functions static.
- Forward declaration of register functions.

svn path=/trunk/; revision=53941
2013-12-11 19:46:38 +00:00
Michael Mann 9b7fb8a811 Create the ability to have packet scoped "proto" data. Bug 9470 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9470)
I'm not sold on the name or module the proto_data functions live in, but I believe the function arguments are solid and gives us the most flexibility for the future.  And search/replace of a function name is easy enough to do.

The big driving force for getting this in sooner rather than later is the saved memory on ethernet packets (and IP packets soon), that used to have file_scope() proto data when all it needed was packet_scope() data (technically packet_info->pool scoped), strictly for Decode As.

All dissectors that use p_add_proto_data() only for Decode As functionality have been converted to using packet_scope().  All other dissectors were converted to using file_scope() which was the original scope for "proto" data.

svn path=/trunk/; revision=53520
2013-11-23 02:20:13 +00:00
Jakub Zawadzki ae59b09443 Add missing includes in order to remove exceptions.h from proto.h (next commit).
svn path=/trunk/; revision=53230
2013-11-10 15:59:37 +00:00
Pascal Quantin ea0a85c230 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9031 :
SIP contact-param parsing fails in case the last parameter includes a quoted string

svn path=/trunk/; revision=53071
2013-11-03 18:07:46 +00:00
Michael Mann 02a8391535 Require dissector_try_string to pass a data parameter to its subdissectors. There weren't that many calls, so might as well modify the function than create a need for dissector_try_string_new.
svn path=/trunk/; revision=53049
2013-11-02 15:52:25 +00:00
Bill Meier 2ac134b3c5 whitespace fixes; mostly: remove trailing blanks
svn path=/trunk/; revision=52591
2013-10-13 19:56:52 +00:00
Pascal Quantin cf3ac5e781 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9228 :
Ensure that decompressed tvb exists before trying to add it to the tree

svn path=/trunk/; revision=52354
2013-10-04 10:29:57 +00:00
Pascal Quantin df5848517f From Didier Gautheron via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9210 :
Add 'deflate' to SIP Content-Encoding

svn path=/trunk/; revision=52315
2013-10-01 14:49:01 +00:00
Michael Mann cf80442912 Convert some proto_tree_add_string_format calls to something more appropriate.
There seem to be several cases of proto_tree_add_string_format where a "string" value/filter doesn't really make sense because it's always empty, and is just being used as a "filterable subtree header (placeholder)".  They appear to be more for "presense" than "value" and should probably be FT_NONE, although I'd almost argue for removing the filter in favor of  proto_tree_add_text.

svn path=/trunk/; revision=52296
2013-09-30 15:21:09 +00:00
Pascal Quantin a0c53ffaa1 emem -> wmem conversion:
- ep_tvb_get_bits() -> wmem_packet_tvb_get_bits()
- tvb_g_memdup()/ep_tvb_memdup() -> tvb_memdup()
- tvb_fake_unicode()/tvb_get_ephemeral_faked_unicode() -> tvb_get_faked_unicode()
- tvb_get_g_string()/tvb_get_ephemeral_string()/tvb_get_seasonal_string() -> tvb_get_string()
- tvb_get_g_unicode_string()/tvb_get_ephemeral_unicode_string() -> tvb_get_unicode_string()
- tvb_get_ephemeral_string_enc() -> tvb_get_string_enc()
- update docs accordingly

svn path=/trunk/; revision=52172
2013-09-22 15:50:55 +00:00
Michael Mann 9e3f9b449f expert_add_info_format_text -> expert_add_info_format
svn path=/trunk/; revision=51852
2013-09-09 00:44:09 +00:00
Anders Broman 4a226911da Protect agains infinite loop.
svn path=/trunk/; revision=51738
2013-09-03 18:47:44 +00:00
Pascal Quantin 84bf0acc00 Convert a few dissectors from EMEM to WMEM API
svn path=/trunk/; revision=51597
2013-08-30 14:49:55 +00:00
Anders Broman 7e3922cf43 Use dissector_delete_uint_range/dissector_add_uint_range
svn path=/trunk/; revision=51540
2013-08-27 19:21:20 +00:00
Pascal Quantin 4b641014a2 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9031 :
SIP contact-param parsing should be stopped when finding a comma separator

svn path=/trunk/; revision=51321
2013-08-12 19:23:08 +00:00
Martin Kaiser f76303cd6c coverity 280403 (logically dead code)
set first to FALSE after the first block was dissected

svn path=/trunk/; revision=51313
2013-08-12 10:15:01 +00:00
Pascal Quantin 2214b3f9d0 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9022 :
Fix dissection of Feature-Caps header field

svn path=/trunk/; revision=51233
2013-08-09 07:58:27 +00:00