aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-afs.c
AgeCommit message (Collapse)AuthorFilesLines
2024-01-27Set BASE_NONE for FT_BOOLEAN items with zero maskMartin Mathieson1-4/+4
2023-11-20Remove init of proto variablesStig Bjørlykke1-306/+306
Remove init of proto, header field, expert info and subtree variables. This will reduces the binary size by approximate 1266320 bytes due to using .bss to zero-initialize the fields. The conversion is done using the tools/convert-proto-init.py script.
2023-05-25afs: Fix partition name UTF-8John Thacker1-3/+6
Partition names have a name starting with /vicepa to /vicepz, where the last character is stored as a 32 bit unsigned integer from 0 to 25. Keep that integer unsigned; declaring it as a signed integer and doing a less than comparison with 25 ends up adding all sorts of unprintable characters to the tree when an erroneous value would be converted to a negative number. Fix #19093
2022-12-15tools/check_typed_item_calls: check FT_BOOLEAN mask lengthMartin Mathieson1-5/+5
2022-12-03wmem: Remove strbuf max size parameterJoão Valverde1-1/+1
This parameter was introduced as a safeguard for bugs that generate an unbounded string but its utility for that purpose is doubtful and the way it is being used creates problems with invalid truncation of UTF-8 strings. Rename wmem_strbuf_sized_new() with a better name.
2022-11-07afs: Validate vectorized stringsJohn Thacker1-4/+9
The RXStringV type has one character (octet) stored per 32 bit word. There's no real indication of the string encoding (possibly locale dependent, maybe ASCII or UTF-8.) Validate it as UTF-8 for now, to produce good UTF-8 and handle the latter two cases. Fix #18583.
2021-12-22Corrects repeated words throughout the code.Moshe Kaplan1-1/+1
Repeated words were found with: egrep "(\b[a-zA-Z]+) +\1\b" . -Ir and then manually reviewed. Non-displayed strings (e.g., in comments) were also corrected, to ease future review.
2021-12-05Dissectors should not include stdio.h, unless neededJaap Keuter1-1/+1
2021-09-16ptvcursor: add explicit memory scopeEvan Huus1-1/+1
I was hoping to avoid this, since the ptvcursor should already be implicitly scoped to the tree it is working on. But there are a bunch of call sites where the passed tree can be NULL (?) and a few places where the tree is explicitly set/reset after creation, so requiring an explicit scope is safer. Avoids global memory pools in favour of ones the compiler can verify.
2021-09-01tvbuff: convert helper methods to pinfo->poolEvan Huus1-1/+1
A few of them just needed scratch memory, so allocate and free it manually after doing any exception-raising checks. A few others were returning memory, and needed conversion to accept a wmem scope argument.
2021-04-30Cast away the return value of g_strlcpy() and g_strlcat().Guy Harris1-7/+7
Most of the time, the return value tells us nothing useful, as we've already decided that we're perfectly willing to live with string truncation. Hopefully this keeps Coverity from whining that those routines could return an error code (NARRATOR: They don't) and thus that we're ignoring the possibility of failure (as indicated, we've already decided that we can live with string truncation, so truncation is *NOT* a failure).
2020-09-16afs: use a simpler way to read a time fieldMartin Kaiser1-11/+2
If a time field uses a standard enconding, we can call proto_tree_add_item() to add it to the tree. There's no need to parse the time field ourselves. Update two places in the afs dissector where the manual parsing can easily be replaced with a proto_tree_add_item() call.
2020-06-19Fix the type of arrays of pointers to hf_ values for bitfield routines.Guy Harris1-2/+2
The static arrays are supposed to be arrays of const pointers to int, not arrays of non-const pointers to const int. Fixing that means some bugs (scribbling on what's *supposed* to be a const array) will be caught (see packet-ieee80211-radiotap.c for examples, the first of which inspired this change and the second of which was discovered while testing compiles with this change), and removes the need for some annoying casts. Also make some of those arrays static while we're at it. Update documentation and dissector-generator tools. Change-Id: I789da5fc60aadc15797cefecfd9a9fbe9a130ccc Reviewed-on: https://code.wireshark.org/review/37517 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-04-05afs: remove dead codeMartin Kaiser1-22/+2
Remove some if and switch statements that do nothing. Change-Id: I3de6aaa5a67c96864d6d532e44841bf7d20ec038 Reviewed-on: https://code.wireshark.org/review/36700 Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-09afs: fix backup & butc RPC confusionMark Vitale1-3/+84
The AFS dissector was erroneously attempting to dissect the RPCs for the Backup Tape Controller (BUTC) on the BACKUP port 7021. A different set of RPCs for the Backup Database Server are served on the backup port 7021. To address this confusion: - Rename the existing "backup" RPC table to "butc", and dissect it on the correct port. This port may be in a range from 7025 up to the maximum 65535. - Create a new "backup" RPC table with the correct RPC names for those exported on the 7021 port. - Make other adjustments as needed to properly distinguish and handle both "backup" and "butc" requests and replies. With these changes, the BKUP operations in the Wireshark afs.cap sample capture are now dissected correctly. Change-Id: I906787889e10cad307d9a6fa610c3e35f2b69184 Reviewed-on: https://code.wireshark.org/review/36300 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-09afs: make defragment / reassembly configurableMark Vitale1-2/+12
AFS reassembly support was added by commit 64d9c005f96ffa2eabb8f3b4edafba9cffe32d87. However, it was always on and could not be disabled; this can cause unacceptable performance issues with large packet traces. Instead, add a configuration option for tshark: -o afs_defragment:true or false (false by default) Also, add a Wireshark preference pane item for AFS: [ ] "Reassemble fragmented AFS PDUs" (off by default) Change-Id: I9b8f2a7c7821214c15a2a27292f2f4006ce8efa3 Reviewed-on: https://code.wireshark.org/review/36299 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-09afs: add some "new" RPCsMark Vitale1-4/+10
Teach the dissector about some newer RPCs, and document some of the gaps in the RPC ranges. While here, remove a few commented-out lines that refer to previous incarnations of the reassembly code. Also correct the ouput description for the Link RPC, which actually describes the status of the created (hard) link, not a symlink. Change-Id: I03181cb4807f842842fe8a1003fc7b40a49ad2ba Reviewed-on: https://code.wireshark.org/review/36298 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-06afs: correctly calulate padding for stringsMark Vitale1-1/+2
length+value strings in AFS are padded to a multiple of 4 octets. A bug caused the dissector to add an extra 4-octet pad when no padding was required. This causes any field after the string to be mis-dissected, resulting in a false alarm "Malformed packet". Correct the padding logic to eliminate the false alarm. Change-Id: I2edc58f20830c2df99d87cdd7d0cbf3bc9b92991 Reviewed-on: https://code.wireshark.org/review/36297 Reviewed-by: Tomasz Moń <desowin@gmail.com> Petri-Dish: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin <pascal@wireshark.org>
2019-07-26HTTPS (almost) everywhere.Guy Harris1-1/+1
Change all wireshark.org URLs to use https. Fix some broken links while we're at it. Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c Reviewed-on: https://code.wireshark.org/review/34089 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-04epan: Convert our PROTO_ITEM_ macros to inline functions.Gerald Combs1-1/+1
Convert our various PROTO_ITEM_ macros to inline functions and document them. Change-Id: I070b15d4f70d2189217a177ee8ba2740be36327c Reviewed-on: https://code.wireshark.org/review/32706 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-27Try to squeeze some bytes out of the frame_data structure.Guy Harris1-1/+1
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-02-12dissectors: use SPDX identifiers.Dario Lombardo1-13/+1
Change-Id: I92c94448e6641716d03158a5f332c8b53709423a Reviewed-on: https://code.wireshark.org/review/25756 Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-02-02GHashtable -> wmem_map conversionsMichael Mann1-20/+4
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-01-29Register reassembly tablesMichael Mann1-3/+4
Register all reassembly tables with a central unit, allowing the central unit to have the callback that initializes and destroys the reassembly tables, rather than have dissectors do it individually. Change-Id: Ic92619c06fb5ba6f1c3012f613cae14982e101d4 Reviewed-on: https://code.wireshark.org/review/19834 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-06-26conversation: rename shadow variableDario Lombardo1-1/+1
Change-Id: I8f738b2e01d7f448b21cdc1b488b16b7dd581911 Reviewed-on: https://code.wireshark.org/review/16104 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-06afs: eliminate "malformed packet" false alarmsMark Vitale1-1/+2
Many AFS packets have empty payloads, and Wireshark marks these as "Malformed Packet" even though they are normal. Eliminate these false alarms by using tvb_reported_length_remaining when adding items to the tree. Change-Id: I4f134fef36b8bb7f99224f02fea9cf29117fb36a Reviewed-on: https://code.wireshark.org/review/15754 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>
2016-03-28Fix some warnings/errors of typeJoerg Mayer1-1/+1
git/epan/dissectors/packet-a21.c:478:25: error: 'item' was marked unused but was used [-Werror,-Wused-but-marked-unused] proto_item_append_text(item, "%s", val_to_str_const(event_id, a21_event_vals, "Unknown")); ^ Added manual change id because file-jpeg.c forced the use of commit -n Change-Id: Iffff53d6253758c8454d9583f0a11f317c8390cb Fix warnings/errors of type: git/epan/dissectors/packet-ax25-kiss.c:205:52: error: 'pseudo_header' was marked unused but was used [-Werror,-Wused-but-marked-unused] return capture_ax25( pd, l_offset, len, cpinfo, pseudo_header ); Fix checkhf warnings: Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_address_netswitch Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_address_subswitch Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_poll_reply_trailer Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_rdm_universe Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_tod_data_universe Change-Id: Id1fa12afb97a8e9cd4ed0ea25351c3b2639c930e Reviewed-on: https://code.wireshark.org/review/14667 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2016-01-24Add the packet number to the packet_info structure, and use it.Guy Harris1-2/+2
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-23Add more fields to packet_info structure and use them.Guy Harris1-2/+2
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>
2015-12-09new_register_dissector -> register_dissector for dissector directory.Michael Mann1-1/+1
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-10-01Treat IPv4 subnet masks as distinct from addressesJeffrey Smith1-1/+1
While IPv4 subnet masks are obviously related and similar to IPv4 addresses, they are distinct enough that they need to be treated seperately in some aspects. For instance, there is no value in attempting to resolve a subnet mask. This change creates a new display type: BASE_NETMASK, which allows distinction from FT_IPv4 (and possible name resolution) where appropriate. Change-Id: I99e19c9a58eb613f8e58d481af84c30e2e5e14d7 Reviewed-on: https://code.wireshark.org/review/10438 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-03Call reassembly_table_destroy and move g_hash_table_destroyPeter Wu1-6/+8
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-06-01AFS: Fix Mac OS X buildbot (-Wshadow)Alexis La Goutte1-3/+3
Rename index -> idx Change-Id: I22b23535e3d24866bdbe63be8f242a3c3ebcc6ba Reviewed-on: https://code.wireshark.org/review/8726 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-06-01Convert AFS dissector to use ptvcursor API.Michael Mann1-1236/+1058
The dissector was written in all macros, presumably to get just a single lines to display a field. The ptvcursor API is good for that, and using it over macros more than halves the object size. Real code (vs macros) is also much easier to use in a debugger. It also makes it easier for the check* scripts to find possible errors. Also eliminate proto_tree_add_text. Change-Id: Id07e015b5a2d1a98a4b36e40a426442d826d9a09 Reviewed-on: https://code.wireshark.org/review/8723 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-12-22First batch of unincludes. Last attempt...Martin Mathieson1-3/+0
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-21Cleanup use of #includes in non-generated epan/dissector/*.cBill Meier1-3/+0
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-07AFS: Missing break in switch (CID 280434 & 280435)Alexis La Goutte1-0/+2
Change-Id: Ia0a39f7e4670d74325ddc40b34cd56ca018c0bde Reviewed-on: https://code.wireshark.org/review/5655 Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-11-29Use proto_tree_add_bitmask for groups of proto_tree_add_boolean.Michael Mann1-43/+30
Part 1 of many Change-Id: I77a5789ac23388e6a5f8098dc398592f39638124 Reviewed-on: https://code.wireshark.org/review/5532 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-10-06Adjust indentation to match editor modelines; Do other minor whitespace changes.Bill Meier1-39/+39
Change-Id: Ic020b2c92db5d14a2be9dc4d35aef4514b8b0353 Reviewed-on: https://code.wireshark.org/review/4502 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-27Eliminate proto_tree_add_text from some dissectors.Michael Mann1-43/+31
Some other related cleanup. Change-Id: I45f54032aa8318858f4ee784945b6f2ed163b6ea Reviewed-on: https://code.wireshark.org/review/4328 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-09-16Fix spelling: cant-->can't, wont-->won't, etcBill Meier1-1/+1
Change-Id: I4497f1b8b6eab0e576d9dd31b732965f9a6679c6 Reviewed-on: https://code.wireshark.org/review/4124 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-10Replace deprecated tvb_length callsEvan Huus1-6/+6
And a few other misc. cleanups while in the neighbourhood. Change-Id: Ic0d6836dec9c36d31ea244a6adc74d4713565090 Reviewed-on: https://code.wireshark.org/review/4047 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-19Revert "Fixup: tvb_* -> tvb_captured"Michael Mann1-6/+6
https://www.wireshark.org/lists/wireshark-dev/201406/msg00131.html This reverts commit 246fe2ca4c67d8c98caa84e2f57694f6322e2f96. Change-Id: Ib24bae0198c13a84bd7f731bf4af921212109a8f Reviewed-on: https://code.wireshark.org/review/2430 Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-18Fixup: tvb_* -> tvb_capturedDario Lombardo1-6/+6
Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f Reviewed-on: https://code.wireshark.org/review/2377 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(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>
2013-12-02Reject the packet if data is NULL.Chris Maynard1-0/+3
svn path=/trunk/; revision=53709
2013-10-22Pass struct rxinfo "private data" into AFS dissector instead of using ↵Michael Mann1-5/+7
pinfo->private_data. svn path=/trunk/; revision=52751
2013-09-19From Mark Vitale via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9141Evan Huus1-4/+83
Decode AFS RXAFSCB_GetCapabilities RPC requests with their replies. svn path=/trunk/; revision=52143
2013-09-16From Mark Vitale via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9142Evan Huus1-1/+1
Fix decoding of AFS Volume Name. svn path=/trunk/; revision=52114
2013-09-16From Mark Vitale via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9140Evan Huus1-26/+135
Add reassembly support for AFS. From me: minor tweaks to conform to other reassemblable protocols; indentation fixes; modelines svn path=/trunk/; revision=52113