aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mbtcp.c
AgeCommit message (Collapse)AuthorFilesLines
2022-08-05prefs: A few more range conversionsJohn Thacker1-27/+26
A few more protocols that have callbacks to retrieve auto preferences for request/response determination. Convert them to getting ranges, since all these are ranges now. Ping #14319
2022-02-15Tools: Fix fix-encoding-args.pl ASCII string validationJoão Valverde1-1/+1
Do not require a useless ENC_NA parameter for string encodings. FT_STRING and FT_STRINGZ types don't have any ndianness. Follow-up to 6ec429622c9258eefd388caf21ce92ab5b9f54b4.
2021-11-01Modbus: Add null pointer checks.Gerald Combs1-1/+11
Fixes #17703.
2021-02-13Modbus/TCP: Add TLS dissectorferst1-2/+31
In 2018 Modbus Organization published a document named "Modbus/TCP Security"[1] that specifies the use of Modbus/TCP over TLS. This commit register a new dissector, "mbtls", reusing "mbtcp" proto. A new option is added to define the Modbus/TLS port to be use in `classify_mbtcp_packet`. [1] https://modbus.org/docs/MB-TCP-Security-v21_2018-07-24.pdf
2019-08-24Modbus: Unit and Transaction Id for request/response identificationThomas Wiens1-19/+38
Use Unit and Transaction Identifier to identify the correct request to a response. The Transaction Identifier is only available in Modbus TCP. Bug: 15698 Change-Id: Ic3a279ce200bee9e9274aaec66bd9dc2f1c096b9 Reviewed-on: https://code.wireshark.org/review/34274 Petri-Dish: Anders Broman <a.broman58@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-07Modbus RTU: Fix Write Single Coil/Register dissectionTomasz Moń1-5/+8
The normal response to Write Single Coil and Write Single Register is an echo of the request and thus the Request/Response of these codes cannot be classified based on the length alone. When the mbrtu.tcp.port value is set to Modbus Slave listening port, then the Query/Response is correctly classified as long as the Master source port is different to the Slave listening port. Bug: 15573 Change-Id: I5cb9f1edb4cdc8e8872196075c14c61ae69b5d15 Reviewed-on: https://code.wireshark.org/review/33077 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-13modbustcp: fix a shadowed variable warningGraham Bloice1-2/+2
The checkapi code dislikes variables named time so rename it. Change-Id: I49727203baacb32869b78d047e86b478b8e5c25c Reviewed-on: https://code.wireshark.org/review/32840 Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Petri-Dish: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-04-04epan: Convert our PROTO_ITEM_ macros to inline functions.Gerald Combs1-3/+3
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>
2019-02-22mbtcp: Fix Dead Store (Dead assignement/Dead increment) Warning found by ClangAlexis La Goutte1-3/+0
Change-Id: Ief90dd117bfc8f4b1f3717b89f405b025146e8ad Reviewed-on: https://code.wireshark.org/review/32132 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-02-18Modbus: Explictly check for request when using byte count in responsesMichael Mann1-4/+4
Bug: 15473 Change-Id: Ia0c998bac4ea008e6a9a4792146780b0e680c606 Reviewed-on: https://code.wireshark.org/review/32081 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-02-17Modbus: If response packet is not found, base registers/coils on byte count.Michael Mann1-2/+8
Previously Modbus dissector was using request data to determine how many coils or registers to dissect. However, if the request wasn't found, it wouldn't dissect all of the coil/request data. Now if pkt_info->num_reg is 0, use the byte count in the packet for determining how many registers/coils there are. Bug: 15473 Change-Id: I8818ba53187248fea4ccc2b5077985ab94578886 Reviewed-on: https://code.wireshark.org/review/32077 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-02-17Add the response time to response packets if we find the request.Guy Harris1-1/+16
I suspect it's what https://ask.wireshark.org/question/7437/response-times-delta-times-after-reordering-sorting-the-row-values/ is *really* asking for, and it's what we do in other request-response protocols in any case. Change-Id: Ie6449958ac669cf45010a3182e2a77182a1fbba5 Reviewed-on: https://code.wireshark.org/review/32066 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
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-12-01Apply port preferences during dissector handoff registrationJaap Keuter1-0/+2
Handling of preferences is often done in the dissector handoff registration. Therefore this function is often registered as callback while registering preference handling for the module. In this way the preferences are processed both when registering the dissector and when changes happen. Some dissectors opt to register a seperate callback function to be called when preferences change. Now these have to be called from the dissector handoff function explicitly, in order to have the preferences processed during dissector registration. This becomes explicitly apparent when the port registration comes into play. With the migration to using dissector registration on ports with preference this port (range) is often retrieved from the preferences to match against the ports in a packet to determine an incoming or outgoing packet of a server. In case the callback function is not called from the dissector registration this determination fails, until the preferences are applied/changed, causing the preference handling callback to be called. This change add the calling of the callback during dissector registration, fixing some dissector port registrations in the process. Change-Id: Ieaea7f63f8f9062c56582a042a3a5a862e286406 Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl> Reviewed-on: https://code.wireshark.org/review/30848 Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
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-07-29Modbus: do not trigger an exception before saving pkt_info structurePascal Quantin1-3/+7
Otherwise on second pass pkt_info is null, leading to a segmentation fault Bug: 13925 Change-Id: I61cfbee894506fb6c4205c9a2ad19e6973821f23 Reviewed-on: https://code.wireshark.org/review/22833 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: Michael Mann <mmann78@netscape.net>
2017-06-22packet-mbtcp - Fix retrieval of Holding/Input Register Format PreferenceChris Bontje1-1/+1
Change-Id: I7a6a409df5c977db1898aec6a47ae3dd8427a00c Reviewed-on: https://code.wireshark.org/review/22286 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2017-05-25Modbus: Add dissection of each bit for holding coils and discrete inputsGraham Bloice1-23/+65
Bug: 13734 Change-Id: Ifd89bc1055edd7c123395ce0511594fc88d151a2 Reviewed-on: https://code.wireshark.org/review/21759 Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Petri-Dish: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-05-03[mbtcp] Separate conversation and per-packet data, build ppd on firstAndersBroman1-75/+76
pass. Change-Id: I741824b239476a3eafa481344a3f699f986a03c8 Reviewed-on: https://code.wireshark.org/review/20927 Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-02-18Modbus - Add ability to filter by holding/input register number OR valueChris Bontje1-24/+87
Bug: 13337 Change-Id: I695530c29b9b0f76eab65503dcba97d19af343fb Reviewed-on: https://code.wireshark.org/review/19706 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: Anders Broman <a.broman58@gmail.com>
2017-02-07GTK: Wrap static preference labels.Gerald Combs1-1/+1
In the GTK+ prefrences dialog, enable wrapping and set a maximum width. This should keep labels from making the dialog unusably wide. Make a couple of enum preferences drop-downs instead of radio buttons. Note that we might want to make the drop-down vs radio button behavior automatic. Change-Id: Ib72a2c8d5cfb99324be86f2218b6d57a395fa22c Reviewed-on: https://code.wireshark.org/review/19980 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-01-10Rename tvb_new_subset() to tvb_new_subset_length_caplen().Guy Harris1-1/+1
This emphasizes that there is no such thing as *the* routine to construct a subset tvbuff; you need to choose one of tvb_new_subset_remaining() (if you want a new tvbuff that contains everything past a certain point in an existing tvbuff), tvb_new_subset_length() (if you want a subset that contains everything past a certain point, for some number of bytes, in an existing tvbuff), and tvb_new_subset_length_caplen() (for all other cases). Many of the calls to tvb_new_subset_length_caplen() should really be calling one of the other routines; that's the next step. (This also makes it easier to find the calls that need fixing.) Change-Id: Ieb3d676d8cda535451c119487d7cd3b559221f2b Reviewed-on: https://code.wireshark.org/review/19597 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-11-22Add prefs_get_uint_value and prefs_get_range_valueMichael Mann1-11/+4
This allows dissectors to not need to know about the internal preference structure. Change-Id: I1ae67248cd0b0132aefc225ea0a9befaf9afdde2 Reviewed-on: https://code.wireshark.org/review/18864 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-26packet-mbtcp: Allow decode as Modbus RTU over USBDave Pifke1-0/+3
Modbus RTU is typically seen over serial links, which can be captured by sniffing USB traffic. This patch enables decoding USB payloads as Modbus RTU. Bug: 13055 Change-Id: I70d970760aa1b37b0f56dda9d3384e72d27c9d0a Reviewed-on: https://code.wireshark.org/review/18468 Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-08Combine Decode As and port preferences for tcp.port dissector table.Michael Mann1-57/+54
This patch introduces new APIs to allow dissectors to have a preference for a (TCP) port, but the underlying data is actually part of Decode As functionality. For now the APIs are intentionally separate from the regular APIs that register a dissector within a dissector table. It may be possible to eventually combine the two so that all dissectors that register with a dissector table have an opportunity to "automatically" have a preference to adjust the "table value" through the preferences dialog. The tcp.port dissector table was used as the guinea pig. This will eventually be expanded to other dissector tables as well (most notably UDP ports). Some dissectors that "shared" a TCP/UDP port preference were also converted. It also removed the need for some preference callback functions (mostly when the callback function was the proto_reg_handoff function) so there is cleanup around that. Dissectors that has a port preference whose default was 0 were switched to using the dissector_add_for_decode_as_with_preference API rather than dissector_add_uint_with_preference Also added comments for TCP ports used that aren't IANA registered. Change-Id: I99604f95d426ad345f4b494598d94178b886eb67 Reviewed-on: https://code.wireshark.org/review/17724 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-08-31Don't do any Decode As stuff for dissector tables not used with Decode As.Guy Harris1-2/+2
Have all dissector tables have a "supports Decode As" flag, which defaults to FALSE, and which is set to TRUE if a register_decode_as() refers to it. When adding a dissector to a dissector table with a given key, only add it for Decode As if the dissector table supports it. For non-FT_STRING dissector tables, always check for multiple entries for the same protocol with different dissectors, and report an error if we found them. This means there's no need for the creator of a dissector table to specify whether duplicates of that sort should be allowed - we always do the check when registering something for "Decode As" (in a non-FT_STRING dissector table), and just don't bother registering anything for "Decode As" if the dissector table doesn't support "Decode As", so there's no check done for those dissector tables. Change-Id: I4a1fdea3bddc2af27a65cfbca23edc99b26c0eed Reviewed-on: https://code.wireshark.org/review/17402 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-22Add "Modbus/TCP over UDP"Michael Mann1-8/+43
There already is "ModbusRTU over UDP", this is the Modbus/TCP format over UDP. Bug: 12768 Change-Id: I883aa8e88f8a1640459115434be84354e22bb361 Reviewed-on: https://code.wireshark.org/review/17215 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: Anders Broman <a.broman58@gmail.com>
2016-07-31Properly mask Modbus function codeMichael Mann1-1/+1
Bug: 12693 Change-Id: Ic0b226d2ba9518f9a1efe85527678daa5302cc3f Reviewed-on: https://code.wireshark.org/review/16792 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-27Follow up for proto_tree_add_checksum.Michael Mann1-2/+8
Fill in the "gaps" so that all dissectors that verify checksums have both a status and expert info field. Also address comments from original proto_tree_add_checksum patch that didn't make it. Ping-Bug: 8859 Change-Id: I2e6640108fd6bb218cb959fe9e4ba98a13e43a2f Reviewed-on: https://code.wireshark.org/review/16590 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>
2016-07-21Add proto_tree_add_checksum.Michael Mann1-6/+7
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-04-28Add support for ModbusRTU over UDP.Michael Mann1-46/+56
Bug: 12374 Change-Id: I2df806c902b932d87e82f6f097f7acce814e5040 Reviewed-on: https://code.wireshark.org/review/15126 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-27Add expert info when Modbus/TCP packet can't be classified.Michael Mann1-0/+14
The common case for this is using Decode As over the Modbus/TCP port preference. Here the port preference is used to determine request/response because the protocol itself doesn't have any indications (so Decode As can't be helpful). Looking into the packet itself can lead to too many false positives. Bug: 10933 Change-Id: Ic6b4304f062f55ff273105edbb0d272c30e53506 Reviewed-on: https://code.wireshark.org/review/15127 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>
2016-03-17Associate dissector tables and heuristic subdissector lists with a protocol.Michael Mann1-2/+2
This will make it easier to determine protocol dependencies. Some LLC OUI dissector tables didn't have an associated protocol, so they were left without one (-1 used) Change-Id: I6339f16476510ef3f393d6fb5d8946419bfb4b7d Reviewed-on: https://code.wireshark.org/review/14446 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-25Move the proto data stuff out of frame_data.[ch].Guy Harris1-0/+1
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-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-12Fix indentation.Guy Harris1-2/+2
Change-Id: I5ffe068753e549ac5f3159a3e026da3ae0a368f4 Reviewed-on: https://code.wireshark.org/review/13201 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-08Fix a lot of typos and misspellingsmoshekaplan1-1/+1
Change-Id: I8512cfa1d424f82a873a0e0e1d22c7b075fdd7f3 Reviewed-on: https://code.wireshark.org/review/13069 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.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-12-09new_register_dissector -> register_dissector for dissector directory.Michael Mann1-3/+3
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-11-06Major Re-factoring of the dissector and some new features.cbontje1-688/+765
A change-list is as follows: - Removed un-necessary dissector revision updates from the file header since GIT tracks these nicely. - Added proper size detection of Modbus RTU messages (including exception responses), when dealing with partial TCP segment reassembly. - Moved the 'register' decode preferences to the Modbus dissector as TCP vs. RTU granularity isn't needed in this case. - Obsoleted un-unused 'address type format' user preferences - Cleaned up dissect_modbus_data to remove proto_tree_set_text instances. - For decoded register tree objects, use register 'address' instead of 'value' for the filter field to provide a more useful filter. - Added in conversation support, to attempt to track responses back to matching requests. - Use conversation support to attempt to populate proper register address offsets in the response messages. Currently each request is saved and each response looks for the last prior request that matches the function code. - Re-factored Modbus dissector to split apart request vs. response decoding. This has led to cleaner code paths, but some duplication where replies and requests are identical format. Change-Id: I0c86ae85b8ae4cc59b037e5f68f408833205fadd Reviewed-on: https://code.wireshark.org/review/9914 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: Anders Broman <a.broman58@gmail.com>
2015-11-04Don't allow multiple registrations of a protocol in dissector tables.Michael Mann1-2/+2
The target here is the Decode As dialog where protocols have multiple registrations into a dissector table and that shows up as multiple entries in the Decode As dialog list with the same name so users are unsure which "dissector" they are choosing. The "default" behavior (done in this commit) is to not allow duplicates for a dissector table, whether its part of Decode As or not. It's just ENFORCED for Decode As. Bug: 3949 Change-Id: Ibe14fa61aaeca0881f9cc39b78799e314b5e8127 Reviewed-on: https://code.wireshark.org/review/11405 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-07Added support for optional display of signed 16/32-bit integer Modbus ↵cbontje1-0/+32
register data Change-Id: I2a81fdf426fdc20db200596ccd2eae26936fc81a Reviewed-on: https://code.wireshark.org/review/9526 Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Petri-Dish: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-24Remove a bunch more deprecated tvb_length callsEvan Huus1-4/+4
(getting really close!) Change-Id: Ibf22a5f727c4dc0070b78144a4b0ab8e0c5e1bce Reviewed-on: https://code.wireshark.org/review/9081 Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-23Replace more deprecated tvb_length callsEvan Huus1-6/+6
The return values of new-style dissectors always use the captured length, so replace those automagically with sed. Change-Id: Ic43072ee4a80d433cd4264444583a0e670adc26a Reviewed-on: https://code.wireshark.org/review/9065 Reviewed-by: Evan Huus <eapache@gmail.com>
2015-05-20Fixed Modbus RTU Serial message direction detection.cbontje1-0/+3
("And that, children, is why we always test different message types before submitting"). Change-Id: I29c730c01db4596a2326dcadfcffa3a20758569a Reviewed-on: https://code.wireshark.org/review/8539 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-05-07Fix detection of 'Write Multiple Registers' and 'Write Multiple Coils' ↵cbontje1-15/+43
function message 'direction' Also did some refactoring of existing code to make it more readable for the various existing function code types. ** Commit amendment to not use depreciated tvb_length() function. Change-Id: Ia4c9f3514968c2a7bebc404ca9185cf8d814dfca Reviewed-on: https://code.wireshark.org/review/8301 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-04-08Remove RTAC Serial preference that doubled for Decode As.Michael Mann1-2/+1
Just use Decode As directly. Change-Id: Iab03a6ff8a70c3c6b0406f426e622eb52bb34ba7 Reviewed-on: https://code.wireshark.org/review/7902 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-02-05The 'mbrtu' dissector should be registered with RTAC Serial, not the ↵cbontje1-1/+1
'modbus' one. (This error was missed by me when confirming recent changes to the RTAC serial dissector and fixes decoding of RTAC serial Modbus captures.) Change-Id: I2df609f88263e90ae4815722ff76b6a0b988a01e Reviewed-on: https://code.wireshark.org/review/6973 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-27Lua: Expose tcp_dissect_pdus() to LuaHadriel Kaplan1-2/+3
Provide a way for Lua-based dissectors to invoke tcp_dissect_pdus() to make TCP-based dissection easier. Bug: 9851 Change-Id: I91630ebf1f1fc1964118b6750cc34238e18a8ad3 Reviewed-on: https://code.wireshark.org/review/6778 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2014-12-21Cleanup use of #includes in non-generated epan/dissector/*.cBill Meier1-1/+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-09-26Modbus: Add value 90 (0x5A) used by Unity (Schneider)Alexis La Goutte1-0/+1
Change-Id: I205f77bccb8ca042da1a699d49844e305612aac2 Reviewed-on: https://code.wireshark.org/review/4307 Reviewed-by: Evan Huus <eapache@gmail.com>