Commit Graph

154 Commits

Author SHA1 Message Date
Guy Harris 7eb3e47fa4 Try to squeeze some bytes out of the frame_data structure.
Make the time stamp precision a 4-bit bitfield, so, when combined with
the other bitfields, we have 32 bits.  That means we put the flags at
the same structure level as the time stamp precision, so they can be
combined; that gets rid of an extra "flags." for references to the flags.

Put the two pointers next to each other, and after a multiple of 8 bytes
worth of other fields, so that there's no padding before or between them.

It's still not down to 64 bytes, which is the next lower power of 2, so
there's more work to do.

Change-Id: I6f3e9d9f6f48137bbee8f100c152d2c42adb8fbe
Reviewed-on: https://code.wireshark.org/review/31213
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-27 04:34:29 +00:00
Dario Lombardo 692cef88c7 dissectors: more SPDX license convertions.
Change-Id: I96e1f1cdbaaf49d65705ecacc903f73cf0e47d7c
Reviewed-on: https://code.wireshark.org/review/26334
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
2018-03-07 17:18:47 +00:00
Stig Bjørlykke f14f76d12a dmp: Allow multiple SecurityCategories again
A Security Classification in DMP may have multiple Security Categories
so don't restrict this to only one.  Add a arbitrary limit of 255 to
avoid a long dissector loop in malformed packets.

This fixes a bug introduced in g85bbda51.

Bug: 14408
Change-Id: I48e7a61a097c58dfcf21e9c9ed3147cf1573dae6
Reviewed-on: https://code.wireshark.org/review/26011
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-02-22 22:25:25 +00:00
Gerald Combs 85bbda514a DMP: Recurse only once.
Make sure we call dissect_dmp_security_category from itself only once.

Bug: 14408
Change-Id: Ia03fb32ca414e78ede572d3093b84f9d53ceb0b9
Reviewed-on: https://code.wireshark.org/review/25964
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-22 04:57:08 +00:00
Jakub Zawadzki 2fecc96868 dmp: fix memleaks
dmp_long_id_hash_table is wmem_map autoreset on file scope.
Don't put there g_strdup() data.

Valgrind log:
==15134== 8 bytes in 2 blocks are definitely lost in loss record 3,988 of 49,961
==15134==    at 0x4C29C4F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==15134==    by 0xA94E405: g_malloc (gmem.c:97)
==15134==    by 0xA966C4E: g_strdup (gstrfuncs.c:356)
==15134==    by 0x6CFC301: dissect_mts_identifier (packet-dmp.c:2684)
==15134==    by 0x6D01A8F: dissect_dmp_envelope (packet-dmp.c:2935)
==15134==    by 0x6D01A8F: dissect_dmp (packet-dmp.c:3909)

Found by oss-fuzz.

Change-Id: I7c3896a9b64c25035fbe8b4ef6130cd693a515db
Reviewed-on: https://code.wireshark.org/review/25575
Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2018-02-03 17:40:36 +00:00
Dario Lombardo 9aa42e89c3 dmp: rework build_national_strings() to avoid read/write overrun.
CID: 1417455
CID: 1417459

Change-Id: Idb63e21608825562f61c445309c1b95bb5b3692c
Reviewed-on: https://code.wireshark.org/review/25075
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-01-01 21:15:05 +00:00
Guy Harris ec9e555456 Have dissect_7bit_string() return a const gchar *.
Nobody needs to modify the string, and nobody needs to free it - which
is good, because it could be a string constant which can neither be
modified nor freed.

Change-Id: I13d4239557698e4631e8f8b062d436a2e94d5eca
Reviewed-on: https://code.wireshark.org/review/23773
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
(cherry picked from commit e209b4c5274766a92b1ae3daff57bf5ca21dfc0f)
Reviewed-on: https://code.wireshark.org/review/23774
(cherry picked from commit 54f1a4f285260d12d8da834637631e4020cf7786)
Reviewed-on: https://code.wireshark.org/review/23776
2017-09-28 20:37:58 +00:00
Pascal Quantin 8dbb21dfde DMP: check 7bit string length before decoding it
Bug: 14068
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3372
Change-Id: Ib9ff63e2ef8d3c2546f357534c374a662e70e43c
Reviewed-on: https://code.wireshark.org/review/23591
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-09-17 20:42:46 +00:00
Stig Bjørlykke 3246582716 dmp: Improve a sanity check
Bug: 14016
Change-Id: I7dd830b143160ddd609013517f1ee3d51aac3c10
Reviewed-on: https://code.wireshark.org/review/23305
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-08-30 11:32:03 +00:00
Michael Mann 577d21e35c GHashtable -> wmem_map conversions
Many of the register_init_routine/register_cleanup_routine functions
are for initializing and cleaning up a GHashtable.
wmem_map_new_autoreset can do that automatically, so convert many
of the simple cases.

Change-Id: I93e1f435845fd5a5e5286487e9f0092fae052f3e
Reviewed-on: https://code.wireshark.org/review/19912
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-02 13:46:03 +00:00
Michael Mann 51a3014225 format_text_wmem -> format_text
All cases of the "original" format_text have been handled to add the
proper wmem allocator scope.  Remove the "original" format_text
and replace it with one that has a wmem allocator as a parameter.

Change-Id: I278b93bcb4a17ff396413b75cd332f5fc2666719
Reviewed-on: https://code.wireshark.org/review/19884
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-31 17:08:47 +00:00
Michael Mann d802b5b0ec Add format_text_wmem.
This allows for a wmem_allocator for users of format_text who want
it (dissectors for wmem_packet_scope()).  This lessens the role of
current format_text functionality in hopes that it will eventually
be replaced.

Change-Id: I970557a65e32aa79634a3fcc654ab641b871178e
Reviewed-on: https://code.wireshark.org/review/19855
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-31 02:26:35 +00:00
Dario Lombardo 805ddd1add uat: add a reset callback.
This function will free the resources allocated by the caller.

Change-Id: Ib486c14e4fd3c321662fb71f7fd06733ce9a64a4
Reviewed-on: https://code.wireshark.org/review/19375
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-12 12:39:15 +00:00
Michael Mann 2eb7b05b8c Convert most UDP dissectors to use "auto" preferences.
Similar to the "tcp.port" changes in I99604f95d426ad345f4b494598d94178b886eb67,
convert dissectors that use "udp.port".

More cleanup done on dissectors that use both TCP and UDP dissector
tables, so that less preference callbacks exist.

Change-Id: If07be9b9e850c244336a7069599cd554ce312dd3
Reviewed-on: https://code.wireshark.org/review/18120
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-13 02:51:18 +00:00
Stig Bjørlykke eafa0a061d dmp: Restore checksum incorrect info
The "Checksum incorrect" note in COL_INFO was inadvertently
broken in gad6fc87d6.

Change-Id: I064c3c79aa3e1ae72d3a8167538e709d0b5fe94a
Reviewed-on: https://code.wireshark.org/review/17842
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-09-21 19:30:08 +00:00
Stig Bjørlykke 3c70e6d684 dmp: Code cleanup
Change-Id: I06c80ca44e8f727c9dc8ec552117ff60e44a7ef4
Reviewed-on: https://code.wireshark.org/review/17659
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-09-12 10:03:12 +00:00
Stig Bjørlykke 68fafcf43f dmp: Remove obsolete structured id handling
The structured id handling is not in use by anyone.

Change-Id: I643fb03f642a5c1900aaec7d41e2b66dba5a2b05
Reviewed-on: https://code.wireshark.org/review/17655
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-09-12 09:29:17 +00:00
Michael Mann ad6fc87d64 Add proto_tree_add_checksum.
This is an attempt to standardize display/handling of checksum fields for all dissectors.
The main target is for dissectors that do validation, but dissectors that just report the
checksum were also included just to make them easier to find in the future.

Bug: 10620
Bug: 12058
Ping-Bug: 8859
Change-Id: Ia8abd86e42eaf8ed50de6b173409e914b17993bf
Reviewed-on: https://code.wireshark.org/review/16380
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-21 12:35:22 +00:00
Michael Mann 2ab4155794 tvb_get_string_enc + proto_tree_add_item = proto_tree_add_item_ret_string
Also some other tricks to remove unnecessary tvb_get_string_enc calls.

Change-Id: I2f40d9175b6c0bb0b1364b4089bfaa287edf0914
Reviewed-on: https://code.wireshark.org/review/16158
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-27 15:20:06 +00:00
Guy Harris 6febe27586 Give the time_[m]secs_to routines names that begin with "[un]signed_".
Indicate whether they take a signed time delta or an unsigned time
delta.

Export unsigned_time_secs_to_str() while we're at it.

Change-Id: I0fbe87f1825efa886364caa61a3358b79d285947
Reviewed-on: https://code.wireshark.org/review/15324
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-09 22:55:00 +00:00
Stig Bjørlykke 0a6b6b09dc dmp: Report unused bits in last byte for 7bit string.
The protocol spec states that unused bits in the last byte in a
7bit string shall be null.

Change-Id: I6fa2e0af6462c87279c19e23a98bf624e46bc9c1
Reviewed-on: https://code.wireshark.org/review/14387
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-03-07 20:05:49 +00:00
Stig Bjørlykke 25996e9e21 dmp: Show correct uncompressed user data length
Change-Id: Iac9c6434da5bdd29768fbacd2bdc9cbe2713c17b
Reviewed-on: https://code.wireshark.org/review/14336
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-03-04 09:30:24 +00:00
Michael Mann 5aa3a88f1a Separate hf_ fields that share filter names with FT_UINT32 and FT_UINT64 datatypes.
'bitcoin.addr.count' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.inv.count' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.getdata.count' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.notfound.count' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.getblocks.count' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.getheaders.count' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.tx.input_count' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.tx.in.script_length' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.tx.output_count' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.tx.out.script_length' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.block.num_transactions' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.headers.count' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.merkleblock.flags.count' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.merkleblock.hashes.count' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.string.count' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'bitcoin.data.count' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'dcerpc.referent_id' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'dmp.body.id' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'edonkey.start_offset' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'edonkey.end_offset' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.entry' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.phoff' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.shoff' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.p_offset' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.p_vaddr' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.p_paddr' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.p_filesz' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.p_memsz' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.p_align' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.sh_addr' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.sh_offset' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.sh_size' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.sh_addralign' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.sh_entsize' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.symbol_table.value' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.symbol_table.size' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.dynamic.tag' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.dynamic.value' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.dynamic.pointer' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.dynamic.ignored' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'elf.dynamic.unspecified' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'h248.contextId' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'hcrt.data32' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'wlan_mgt.fixed.psmp.stainfo.reserved' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'isakmp.tf.attr.life_duration' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'isakmp.ike.attr.life_duration' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'jxta.message.element.content.length' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'rmt-lct.tsi' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'rmt-lct.toi' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'smb.alloc_size' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32
'trmac.response_code' exists multiple times with NOT compatible types: FT_UINT64 and FT_UINT32

Change-Id: I903933e6448bac3d3374eef1a6a0bc4771c1a9f4
Reviewed-on: https://code.wireshark.org/review/14060
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-02-22 13:40:27 +00:00
Guy Harris 099698445b Move the proto data stuff out of frame_data.[ch].
It's not tied to the frame_data structure any more, so it belongs by
itself.

Clean up some #includes while we're at it; in particular, frame_data.h
doesn't use anything related to tvbuffs, so don't have it gratuitiously
include tvbuff.h.

Change-Id: Ic32922d4a3840bac47007c5d4c546b8842245e0c
Reviewed-on: https://code.wireshark.org/review/13518
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-25 02:24:34 +00:00
Guy Harris bc5a0374bf Add the packet number to the packet_info structure, and use it.
That removes most of the uses of the frame number field in the
frame_data structure.

Change-Id: Ie22e4533e87f8360d7c0a61ca6ffb796cc233f22
Reviewed-on: https://code.wireshark.org/review/13509
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-24 03:41:28 +00:00
Guy Harris 9141bd9700 Add more fields to packet_info structure and use them.
Add fields for the absolute time stamp (and another field for a presence
flag for the absolute time stamp) and the packet encapsulation for the
packet.

This lets us remove the field for the packet encapsulation in the
frame_data structure; do so.

Change-Id: Ifb910a9a192414e2a53086f3f7b97f39ed36aa39
Reviewed-on: https://code.wireshark.org/review/13499
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-23 03:50:58 +00:00
Michael Mann 31a54708f4 new_register_dissector -> register_dissector for dissector directory.
Change-Id: Ie39ef054a4a942687bd079f3a4d8c2cc55d5f22c
Reviewed-on: https://code.wireshark.org/review/12485
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-09 12:38:06 +00:00
Stig Bjørlykke 2e19755c33 dmp: Fixed ack framenum links.
The ack symbol is for the Message, Report or Notification beeing acked.

Change-Id: I5ef99b9e7830f437278af18e681f8200fab6c3d4
Reviewed-on: https://code.wireshark.org/review/11818
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-11-14 14:34:29 +00:00
Stig Bjørlykke 89879ef9f9 dmp: Enhance ack framenum links.
Change-Id: Iade2d06512bacbeff3e7446487a03d4f73dba721
Reviewed-on: https://code.wireshark.org/review/11796
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-11-13 08:32:45 +00:00
Guy Harris ff9f9fc431 Don't include "file.h" if you don't need it.
It ends up dragging in libwireshark headers, which programs not linking
with libwireshark shouldn't do.  In particular, including
<epan/address.h> causes some functions that refer to libwireshark
functions to be defined if the compiler doesn't handle "static inline"
the way GCC does, and you end up requiring libwireshark even though you
shouldn't require it.

Move plurality() to wsutil/str_util.h, so that non-libwireshark code can
get it without include epan/packet.h.  Fix includes as necessary.

Change-Id: Ie4819719da4c2b349f61445112aa419e99b977d3
Reviewed-on: https://code.wireshark.org/review/11545
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-04 08:46:30 +00:00
João Valverde 3df2333155 Remaining ADDRESS macro to address function conversions
Change-Id: I8bc9af431e70243b05f4f0ce8c2b8ee451383788
Reviewed-on: https://code.wireshark.org/review/11463
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-03 12:20:34 +00:00
Gerald Combs 86fe2be4dc Use address functions instead of ADDRESS macros in asn1 and epan
Replace CMP_ADDRESS, COPY_ADDRESS, et al with their lower-case
equivalents in the asn1 and epan directories.

Change-Id: I4043b0931d4353d60cffbd829e30269eb8d08cf4
Reviewed-on: https://code.wireshark.org/review/11200
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-22 11:45:56 +00:00
Michael Mann 2be3820912 Address "shadow" warnings found by checkAPI script.
These aren't "true" shadow issues, but the script doesn't completely understand C syntax (for things like struct member names "time" and "index").  But fixing them creates less noise.

Change-Id: I5a2db1549095824530428529e86cab453c031a04
Reviewed-on: https://code.wireshark.org/review/10368
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-09-03 06:05:43 +00:00
Peter Wu 126e02cd58 Call reassembly_table_destroy and move g_hash_table_destroy
This patch moves g_hash_table_destroy calls from the init routine to
the cleanup routine. Besides that, the conditional check for the hash
table has been removed, assuming that init is always paired with a
cleanup call.

If reassembly_table_init is found, a reassembly_table_destroy call is
prepended to the cleanup function as well.

Comments have been removed from the init function as well as these did
not seem to have additional value ("destroy hash table" is clear from
the context).

The changes were automatically generated using
https://git.lekensteyn.nl/peter/wireshark-notes/diff/one-off/cleanup-rewrite.py?id=4d11f07180d9c115eb14bd860e9a47d82d3d1dcd
Manually edited files (for assignment auditing): dvbci, ositp, sccp,
tcp.

Other files that needed special attention due to the use of
register_postseq_cleanup_routine:

 - ipx: keep call, do not add another cleanup routine.
 - ncp: remove empty mncp_postseq_cleanup. mncp_hash_lookup is used
   even if a frame is visited before (see dissect_ncp_common), hence
   the hash table cannot be destroyed here. Do it in cleanup instead.
 - ndps: add cleanup routine to kill reassembly table, but do not
   destroy the hash table as it is already done in ndps_postseq_cleanup.

Change-Id: I95a72b3df2978b2c13fefff6bd6821442193d0ed
Reviewed-on: https://code.wireshark.org/review/9223
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-03 23:35:14 +00:00
Evan Huus 958cef5d68 Remove more deprecated tvb_length
Change-Id: Iac23a6c804ad3720d37186559477909b2ff33eb2
Reviewed-on: https://code.wireshark.org/review/9042
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-23 00:19:41 +00:00
Stig Bjørlykke a49e5523d0 DMP: Handle encoded 7bit string as binary.
This bug was introduced when rewriting tvb_get_string() to
handle encoding (and thus handling ASCII string different).

Change-Id: Ia37a9d075fb58c8d6c26af811e96f7ca1e82af3d
Reviewed-on: https://code.wireshark.org/review/7962
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-04-07 06:58:52 +00:00
Stig Bjørlykke 14c9b175f5 DMP: Make dmp.body.data FT_BYTES
With this it's possible to fetch the body from a Lua script again.

Change-Id: Ie1502d47ca3c137aedb4197c6a345b3eb340735a
Reviewed-on: https://code.wireshark.org/review/7769
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-03-20 08:58:43 +00:00
Bill Meier 7e1d73d0d4 dmp, gmhdr, vssmonitoring: prevent possible crashes;
gmtime()/localtime() can return NULL.

Change-Id: If0589261429ee15d0c07972a99d94f9fe83626f6
Reviewed-on: https://code.wireshark.org/review/6660
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-01-19 20:50:26 +00:00
Michael Mann ada1eec702 SE_COPY_ADDRESS -> WMEM_COPY_ADDRESS
Copy addresses with wmem-scope instead of (forced) seasonal scope.  All existing instances were converted to wmem_file_scope, but the flexibility is there for other scopes.

Change-Id: I8e58837b9ef574ec7dd87e278470d7063ae8c1c2
Reviewed-on: https://code.wireshark.org/review/6564
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-16 15:25:18 +00:00
Michael Mann 64a7bac641 tvb_bytes_to_ep_str -> tvb_bytes_to_str
Change-Id: I79c613cbdd8dc939dd4c29ebc477fb6eefd5bfc4
Reviewed-on: https://code.wireshark.org/review/6371
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-07 18:16:23 +00:00
Ricardo Cristian Ramirez e8568c83f4 s5066sis: Consume transport layer data in S5066sis
S5066 spec describes a transport layer for some
clients like Acp 142 and DMP but not for all of
them. Since RCOP/UDOP header definition are given
in S'5066 specification, consuming these header
bytes in S'5066 SIS dissector may be appropriate

Bug: 10827
Change-Id: Iffdf5d567e1a417ccbafdac919f5a5200159d31b
Reviewed-on: https://code.wireshark.org/review/6292
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-01-06 11:51:00 +00:00
Guy Harris d541774a61 Include <math.h> or <stdlib.h> as necessary to declare functions.
Various floating-point math functions require <math.h>, and abs()
requires <stdlib.h>.

Change-Id: Iadba9e0d7168bba6e67d9221e757a85960507742
Reviewed-on: https://code.wireshark.org/review/5999
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-22 21:24:15 +00:00
Martin Mathieson 596669f921 First batch of unincludes. Last attempt...
Change-Id: I3681462aeb98ca62ed3ec5eb226b2553317391a9
Reviewed-on: https://code.wireshark.org/review/5997
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-22 21:03:13 +00:00
Bill Meier b5d7b7ab6e Cleanup use of #includes in non-generated epan/dissector/*.c
Specifically:
- Set packet.h to be the first wireshark #include after
   config.h and "system" #includes.
   packet.h added as an #include in some cases when missing.
- Remove some #includes included (directly/indirectly) in
   packet.h. E.g., glib.h.
   (Done only for those files including packet.h).
- As needed, move "system" #includes to be after config.h and
   before wireshark #includes.
- Rework various #include file specifications for consistency.
- Misc.

Change-Id: Ifaa1a14b50b69fbad38ea4838a49dfe595c54c95
Reviewed-on: https://code.wireshark.org/review/5923
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-21 05:46:22 +00:00
Michael Mann 888f22de16 convert to proto_tree_add_subtree[_format]
Change-Id: I2ea1892b5963cc5578cbdd2b03029ca8424f2267
Reviewed-on: https://code.wireshark.org/review/2640
Tested-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-25 16:35:14 +00:00
Stig Bjørlykke 2ab2921c7d Revert part of svn revision 52045 (git b38ee917)
This fix does change the format printed for values using bitmasks
(because the bit values are printed first) and is not always wanted
in this dissectors (because of readability).

We should have a better way of doing what I want in this dissectors,
so I'll have a look at this later.

Change-Id: I2477aa6b1d0c42a7ad5848bba3cb74dce3bba1f0
Reviewed-on: https://code.wireshark.org/review/2485
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-06-20 17:04:49 +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
Stig Bjørlykke 87aed58548 Register DMP as new-style dissector
Change-Id: I0491c9c5e817e31011e64aebc9010437581ba718
Reviewed-on: https://code.wireshark.org/review/2269
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-06-16 20:28:21 +00:00