Commit Graph

178 Commits

Author SHA1 Message Date
Michael Mann e77261f659 Eliminate proto_tree_add_text from some dissectors.
Change-Id: Ib160211198ca02f7eacf29d04568628c11f208a5
Reviewed-on: https://code.wireshark.org/review/5407
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-11-20 16:09:09 +00:00
Bill Meier 18d72987cb Do encoding-arg changes (all benign)
For:
- FT_BYTES: Always use just ENC_NA
- integral/floating (other than FT_[U]INT8): Do ENC_NA --> ENC_BIG_ENDIAN

Also:
- FT_UINT... --> FT_UINT8 in a few cases (to match proto_tree_add_item...)
- Change one case of incorrect '||' to '|'

Change-Id: I427e0e61618ff8faf55691c8a695930f67d455b0
Reviewed-on: https://code.wireshark.org/review/4184
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-19 01:38:08 +00:00
Michael Mann 6691293a65 convert to proto_tree_add_subtree[_format]
Change-Id: I8d66b1bc7dbdfee3d4bf6fd3b3c21c6323b66f44
Reviewed-on: https://code.wireshark.org/review/2946
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-07-09 00:25:04 +00:00
Britt McKinley 4e9802e679 H264: Add support of packetization modes, SVC, MS-H264
Add support for Prefix, STAP, MTAP, NI-MTAP, and PACSI packet types.
Add support for Microsoft SEI messages [MS-H264PF]
Add support for dissecting scalable profiles
SDP: Add profile-level-id decode for payload type H264-SVC
MS-H264PF: http://msdn.microsoft.com/en-us/library/hh659565.aspx
Update #1 - Fix Tabs -> Spaces, Reinsert accidentally removed entry 19
from h264_type_values
Update #2 - Changed to using expert info for exceptions and Microsoft
errata.
Update #3:
  - Correct handling of truncated packets
  - Use guid functions and compare techniques
  - Correct ranges for expert info messages
  - Change to using reported_length from captured_length

Change-Id: I520a3c9a6d85c78a976b520cf5a6a405064a48f1
Reviewed-on: https://code.wireshark.org/review/2580
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-07-06 19:11:24 +00:00
Michael Mann 14824e6adf Revert "Fixup: tvb_* -> tvb_captured"
https://www.wireshark.org/lists/wireshark-dev/201406/msg00131.html

This reverts commit 246fe2ca4c.

Change-Id: Ib24bae0198c13a84bd7f731bf4af921212109a8f
Reviewed-on: https://code.wireshark.org/review/2430
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-19 18:25:59 +00:00
Dario Lombardo 246fe2ca4c Fixup: tvb_* -> tvb_captured
Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f
Reviewed-on: https://code.wireshark.org/review/2377
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18 14:14:58 +00:00
Dario Lombardo 971ffd683e Fixup: tvb_get_string(z) -> tvb_get_string(z)_enc
Change-Id: I63a3704effe3fcab01a193dc39b6a22e9f1cf3fe
Reviewed-on: https://code.wireshark.org/review/2376
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18 14:13:58 +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
Hadriel Kaplan e32b38164b Fix Bug 9958: 'SDP displays double spaces between payload formats as a 0 payload format'
Given an SDP m= line such as this:

    m=audio 29156 RTP/AVP 18  0

SDP will show a media format of G.729 (the 18) and then two G.711 entries: one
for the extra space between the 18 and 0, and one format for the 0. The latter
is correct, but the extra space one isn't.

Technically such an m= line is malformed, since only one space is allowed
between payload formats; but it's definitely not a format of 0.

A similar thing happens in many parts of SDP dissection code. It needs to issue
an expert error and handle it gracefully.

Change-Id: I1f1500489a13a55e03fc8ea14b37d99a019fc449
Reviewed-on: https://code.wireshark.org/review/989
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-07 04:22:15 +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
Hadriel Kaplan 04c05a21e3 Fix Bug 9920 Buildbot crash due to SDP/RTP mismatch
For details see comments in Bug 9920.

The executive summary:
Bug 9920 is a crash caused by a couple of issues:

1) The memory ownership model for the rtp_dyn_payload hashtable is split: SDP
creates the rtp_dyn_payload hashtable, but RTP can free it. Since there isn't
*one* pointer to the hashtable, RTP freeing it means SDP has a dangling
pointer.

2) Either the SDP dissector shouldn't be creating two separate, unique
hashtables for multiple media channels of the same addr:port, or RTP shouldn't
be free'ing the previous one.

Change-Id: I436e67de6882f84aa82dcbdfe60bf313fe4fd99c
Reviewed-on: https://code.wireshark.org/review/918
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-03 04:40:20 +00:00
AndersBroman 2284f0bdfa For now use UTF-8 for all strings for performance reasons.
Change-Id: If47ffbee58d534ce3d44f00e1e5b966bc42a2ea8
Reviewed-on: https://code.wireshark.org/review/906
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-01 08:06:16 +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 25826ad433 Fix using '%hh' for printf format because MS Visual C++ is lame
Change-Id: I1d80b82d7c6a5aa85bf59b449326874c0f851737
Reviewed-on: https://code.wireshark.org/review/763
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-21 14:25:19 +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
Hadriel Kaplan 30ba425e7e Fix Bug 9885: 'Buildbot crash output: fuzz-2014-03-14-15333.pcap'
The Buildbot found a crash which is cause by a bug that has
been there all along, but a recent change exposed. This bug is
likely in 1.10.6 as well, so I'll backport this if I can
reproduce it in 1.10.6.

Change-Id: I505bc73cbe6281e6d64f00de441c8e6231b55000
Reviewed-on: https://code.wireshark.org/review/702
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-03-19 05:09:12 +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
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
Jakub Zawadzki deb2b236f2 Add missing includes
svn path=/trunk/; revision=54332
2013-12-21 17:23:17 +00:00
Jakub Zawadzki 3d6fdc55d0 New functions: str_to_ip6(), str_to_ip()
This way we can avoid including lot of system header files in some dissectors
and it might fix bug #9581

svn path=/trunk/; revision=54330
2013-12-21 16:16:56 +00:00
Jakub Zawadzki 576c7eae45 Move base64_to_tvb() to tvbuff_base64.c
svn path=/trunk/; revision=54325
2013-12-21 14:33:54 +00:00
Jakub Zawadzki 4d92f6079b Remove not needed ';'
svn path=/trunk/; revision=54088
2013-12-14 11:12:20 +00:00
Anders Broman 2939977a4b - Make local functions static.
- Forward declaration of register functions.

svn path=/trunk/; revision=53942
2013-12-11 20:04:37 +00:00
Michael Mann 7221215cdc Add "rtp handle protection" inside srtp_add_address/rtp_add_address/bluetooth_add_address so dissectors calling it don't need to find "rtp" just for the handle check.
svn path=/trunk/; revision=53288
2013-11-12 22:04:03 +00:00
Michael Mann a661864f48 Add "T.38 handle protection" inside t38_add_address() so dissectors calling it don't need to find "t38" just for the handle check.
svn path=/trunk/; revision=53283
2013-11-12 21:10:20 +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
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
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
Evan Huus 4daaf4fb57 Purge some emem.
- In kingfisher it wasn't even needed, just use a variable on the stack.
- In SDP convert to wmem. Use auto-resetting trees to avoid the need for an init
  routine and somewhat simplify that whole thing.

svn path=/trunk/; revision=51484
2013-08-23 00:51:04 +00:00
Pascal Quantin b46f9bebe2 Change some dissectors to use pinfo memory pool instead of malloc if it can trigger an exception between between buffer allocation and tvb_set_free_cb call
svn path=/trunk/; revision=51427
2013-08-19 14:55:41 +00:00
Chris Maynard 91ecc2334f "man inet_pton" only says that it returns a negative value, zero or a postive value, and not specifically -1, 0, or 1, so even though we know that's what wsutil's inet_pton will return, we shouldn't test against those exact values.
svn path=/trunk/; revision=50670
2013-07-16 16:23:31 +00:00
Michael Mann b0090fd046 Batch of filterable expert infos
svn path=/trunk/; revision=49600
2013-05-27 23:21:11 +00:00
Anders Broman aefb9200d1 SDP adds per-packet-data twice, refactor to not use per-packet data.
svn path=/trunk/; revision=49314
2013-05-15 16:51:43 +00:00
Anders Broman 85a8e304dd Add the posibillity to use a key for per-packet-data.
svn path=/trunk/; revision=49259
2013-05-12 18:11:02 +00:00
Anders Broman 84241f46ad From beroset:
remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48399
2013-03-18 20:44:36 +00:00
Guy Harris 6b629c4d92 Move show_exception() and show_reported_bounds_error() to
epan/show_exception.c, as it's used outside
epan/dissectors/packet-frame.c.  Update their callers to include
<epan/show_exception.h> to get their declaration.

Add a CATCH_NONFATAL_ERRORS macro that catches all exceptions that, if
there's more stuff in the packet to dissect after the dissector call
that threw the exception, doesn't mean you shouldn't go ahead and
dissect that stuff.  Use it in all those cases, including ones where
BoundsError was inappropriately being caught (you want those passed up
to the top level, so that the packet is reported as having been cut
short in the capture process).

Add a CATCH_BOUNDS_ERRORS macro that catches all exceptions that
correspond to running past the end of the data for a tvbuff; use it
rather than explicitly catching those exceptions individually, and
rather than just catching all exceptions (the only place that
DissectorError should be caught, for example, is at the top level, so
dissector bugs show up in the protocol tree).

Don't catch and then immediately rethrow exceptions without doing
anything else; just let the exceptions go up to the final catcher.

Use show_exception() to report non-fatal errors, rather than doing it
yourself.
 
If a dissector is called from Lua, catch all non-fatal errors and use
show_exception() to report them rather than catching only
ReportedBoundsError and adding a proto_malformed item.

Don't catch exceptions when constructing a trailer tvbuff in
packet-ieee8023.c - just construct it after the payload has been
dissected, and let whatever exceptions that throws be handled at the top
level.

Avoid some TRY/CATCH/ENDTRY cases by using checks such as
tvb_bytes_exist() before even looking in the tvbuff.

svn path=/trunk/; revision=47924
2013-02-27 22:43:54 +00:00
Guy Harris ef715a28ae For each dynamic-payload hash table, keep a Boolean indicating whether
it's been used in an rtp_set_address() or srtp_set_address() call and,
if that Boolean is set, don't free the hash table; this fixes a case
where the hash table was freed while it was in use.

svn path=/trunk/; revision=47740
2013-02-18 22:37:07 +00:00
Michael Mann 823493b927 Only allow one packet to act as an SDP response. This should probably be caught at a higher layer (SIP), but the safety net should be there.
Also, cleanup SIP "response error" range.

Fixes crash in bug 8343 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8343)

svn path=/trunk/; revision=47705
2013-02-17 18:25:22 +00:00
Michael Mann ad92b749e8 Fix crash with SDP setup mechanism, bug 8323 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8323)
The issue was that hash tables were being accessed after they were freed from a "rejected answer".  

The code was also too generous in considering many SIP status codes as "rejected answers", so now less SIP status codes are treated as "rejected answers" and are ignored by the transport API.


svn path=/trunk/; revision=47652
2013-02-14 03:30:32 +00:00
Michael Mann 222a190373 Fix Coverity 980630, negative array index read.
svn path=/trunk/; revision=47648
2013-02-13 01:49:06 +00:00
Michael Mann c752593698 Handle SIP "resends" within SDP. This is to handle "duplicate" OFFERs so they don't end up being handled by setup_sdp_transport() because the current frame couldn't match a request (due to duplication).
setup_sdp_transport_resend() should be unnecessary once all higher layers use setup_sdp_transport() and the "registration" code within dissect_sdp() is removed.

svn path=/trunk/; revision=47572
2013-02-08 17:52:12 +00:00
Evan Huus fc48d80b32 Use glib's isdigit function.
svn path=/trunk/; revision=47565
2013-02-08 14:03:33 +00:00
Michael Mann faf307e2fc Support SDP context over SIP.
Added setup_sdp_transport() to allow higher layer protocols to call SDP with context to correctly setup an OFFER/ANSWER within SDP (which doesn't have its own transport layer).  I attempted to keep backwards compatibility until all higher layer protocols set up OFFER/ANSWER context.  If OFFER/ANSWER (request/response) can't be found (which would be the case for higher layer protocols without context), Wireshark should resort to the old behavior of applying SDP information as it sees packets.

This patch includes integration with SIP as it appears to have the most bug reports.  Other higher layer protocols will be done later.  Most are mentioned in bug 2368.

Fixes bug 2368 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2368) and all its duplicates
Fixes bug 2992 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2992) and all its duplicates

svn path=/trunk/; revision=47564
2013-02-08 13:47:07 +00:00
Anders Broman 750c5a8401 Fix dissection of path ["/" session-id] is optional.
svn path=/trunk/; revision=47270
2013-01-25 09:08:24 +00:00
Guy Harris 8ed7a73e22 Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().

Change some data types to avoid those implicit conversion warnings.

When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.

Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers.  Cast
away those warnings in some cases where an API we don't control forces
us to do so.

Enable a bunch of additional warnings by default.  Note why at least
some of the other warnings aren't enabled.

randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.

If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.

svn path=/trunk/; revision=46748
2012-12-26 05:57:06 +00:00
Anders Broman 52a4bd4644 Try to fix packet-sdp.c:1542: warning: 'parameter_item' may be used uninitialized in this function.
svn path=/trunk/; revision=46346
2012-12-03 15:04:24 +00:00
Anders Broman a07cfc3b50 Protect against malformed crypto-suite parameters.
Fixes SDP infinite loop.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8041

svn path=/trunk/; revision=46344
2012-12-03 13:55:03 +00:00
Anders Broman 82e67826b4 Back out the SDP part of r46165 "Set up BFCP conversations".
svn path=/trunk/; revision=46201
2012-11-26 09:30:00 +00:00