aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-cipsafety.c
AgeCommit message (Collapse)AuthorFilesLines
2017-03-18cipsafety: Fix Dereference of null pointer found by Clang AnalyzerAlexis La Goutte1-1/+1
Change-Id: Id5d9972f527e94164b61bf420ddf9c444d90235b Reviewed-on: https://code.wireshark.org/review/20607 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>
2017-03-16Add support for verifying CIP Safety CRC values.Michael Mann1-32/+548
Change-Id: I44f7ff6980f27b1a0d4199a91f9b217aec7e4652 Reviewed-on: https://code.wireshark.org/review/20557 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-03-14CIP: Log more errors when expected data is missingD. Ulis1-42/+16
1. CIP: Instead of exiting early in dissect_cip_generic_service_req/rsp when there is no data, keep processing so that a malformed packet warning will be displayed when there should be data. 2. CIP Safety: Remove copy-paste. Use load_cip_request_data 3. CIP Safety: Use more constants. Change-Id: Ic364201f1e587b43cf2bda407fb77b50032974ae Reviewed-on: https://code.wireshark.org/review/20549 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-12-21CIP: More attribute updatesD. Ulis1-1/+8
1. CIP Safety: SERCOS Safety Network Number attribute should be 6 bytes. Don't just use all remaining bytes 2. Remove cip_byte_array type. The last remaining usage was #1 above and it really shouldn't be used in the future. Any attribute that would eat up all remaining bytes would have issues with Get Attribute List responses and Set Attribute List requests. 3. Optional Attribute List: Display the attribute name if known. 4. Port: Display Port Number name 5. Port: Associated Communication Objects attribute Change-Id: I94d99bb1f07aa4b8c44949b2ffb5d75e72483459 Reviewed-on: https://code.wireshark.org/review/19374 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-07CIP: More minor bug fixesD. Ulis1-142/+54
1. CIP Safety: Exception Detail Alarm and Exception Detail Warning both were not parsing their 3 parts because the offset was not increased. Fixed the offsets and combined the functions because they have the same format. 2. CIP: Forward Open Safety Response had wrong offsets so it was parsing incorrectly. This incorrectly showed as Malformed. 3. CIP Safety: Pass in tvb to proto_tree_add_subtree() instead of NULL. This was causing a Dissector bug (seems only on trunk, not 2.2). This was already done for packet-cip.c under https://code.wireshark.org/review/#/c/16748/ 4. Some minor typos Change-Id: I63e8d200cd3408c16ca0a1edbc483c3bb8298d3b Reviewed-on: https://code.wireshark.org/review/18100 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-04-07CIP: Attribute updatesD. Ulis1-44/+5
1. Switched to common way to parse Get Attr All, using dissect_cip_get_attribute_all_rsp, for CCO (class version) and CIP Validator. This also fixed a missing attribute in the old CIP Validator code. 2. Add cip_string2 attribute implementation 3. For CIP Validator, set the protocol as "CIPS Validator", previously this was "CIPS Supervisor". 4. For classes with subdissectors, add the service to the Info column in the response. Change-Id: Id9593ca39497261075df8146cf63ee9581462e2a Reviewed-on: https://code.wireshark.org/review/14837 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-28Fix more -Wused-but-marked-unused warnings/errors.Joerg Mayer1-1/+1
Change-Id: Ieb3e70a23c1a55b7ba60b1b32f159341adfe65b7 Reviewed-on: https://code.wireshark.org/review/14682 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2016-03-14CIP: Restore path information to Info columnD. Ulis1-2/+2
When the "Display enhanced Info column data" preference is set, ensure that: 1. For non-MSP packets, path information (class/symbol) is displayed in the Info column for Forward Open, Forward Close, regular Message Router Request/Response messages 2. For MSP packets, don't display the class/symbol in the Info column (it's too wordy) This now relies on an extra boolean passed to dissect_cip_data() to handle #2 above. Previously, this relied on checking a proto_item* for NULL, which is not correct. Change-Id: I7532660bcb23bd664c1f5532256755922c4937d1 Reviewed-on: https://code.wireshark.org/review/14458 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-03-14Don't let the existence of a protocol tree affect what's in the Info column.Guy Harris1-2/+2
A dissector must never assume that it will, or won't, be called with a protocol tree; it's up to the Wireshark/TShark/etc. core to decide whether to do it, and it can change its behavior over time or even change it from release to release. Have dissect_epath() take an argument that explicitly indicates whether to add the CIP class to the Info column, rather than assuming that you do so only if the tree pointer passed to it is null. Bug: 12257 Change-Id: Ide8a6fc21252880f849a8d0aa4659a675bb3ae04 Reviewed-on: https://code.wireshark.org/review/14456 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-03-10CIP: Improve info column informationD. Ulis1-10/+4
1. Remove "Object" from CIP class names. It was already removed from some of the objects, the string "Object" is implied for all objects, and it helps reduce wordiness in the Info column. 2. Don't display Class/Symbol name in the Info column when it's inside a MSP. 3. Enable enhanced Info column by default now that some of the additional wordiness was removed by the above points. 4. Put single quotes around the symbol name in the Info column. This makes it more obvious that something is a symbol instead of an actual class name from the spec, and would prevent ambiguity if the symbol name was something like "Identity". 5. Print the CIP service for both requests/responses in CIP Safety processing. This was already added to normal CIP. 6. Display Class/Symbol and service on the Service Packet in the MSP tree. This makes it easier to find without expanding every MSP item. Change-Id: I7197dd4bf3dad6d7bdba247d3d7ab76cca52c785 Reviewed-on: https://code.wireshark.org/review/14325 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: D. Ulis <daulis0@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-02-04Have CIP dissectors find the CIP Class dissector table, rather than have a ↵Michael Mann1-0/+2
externed global variable. Change-Id: Id8156680d67d65d87c156df05e8a66e2531728d2 Reviewed-on: https://code.wireshark.org/review/13709 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-02-04CIP/ENIP: Enhance Info column displayD. Ulis1-2/+2
1. ENIP: When there is more than one ENIP command in a given TCP packet, display both in the Info column. Previously, only 1 would be displayed. 2. CIP: Services need a context to be able to interpret properly. Display the Class or Symbol name in the Info column in an object oriented manner for Request Paths, or Connection Paths. 3. CIP: Display the request path/service in a CIP response, instead of just "Success". These changes make it visually easier to identify traffic. 4. CIP: For the Info column, make Multiple Service Packet formatting a little more consistent regarding the divider between embedded packets. Previously, it would display 2 different separator types "," and "|". 5. CIP: Add preference to enable/disable "Display enhanced Info column data" Change-Id: I7e95bc144588c0925137e01abbc814babb494d19 Reviewed-on: https://code.wireshark.org/review/13632 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-01-25Move the proto data stuff out of frame_data.[ch].Guy Harris1-0/+2
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-22CIP: Add support for Get Attributes AllMichael Mann1-87/+52
Get Attributes All is a predefined list of existing attribute IDs for a given class. Add a new index for each attribute for their place in GetAttributesAll response. Then a hash table of classes for existing attributes are created to handle the GetAttributesAll service. Added more TCP/IP object attributes since more have been added to the spec. Moved TCP/IP object attributes all to ENIP dissector. Bug: 11996 Change-Id: I7f50c9aadf04efdb17ef31f39e6a991c0a84bef2 Reviewed-on: https://code.wireshark.org/review/13186 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-01-13Use result of register_dissectorPeter Wu1-4/+5
Assign result of `register_dissector(..., func, proto)` to FOO_handle and remove `FOO_handle = create_dissector_handle(func, proto)`. Found by looking for files named packet-FOO.c having the above create_dissector_handle pattern. Some files (with different dissect routines for the two functions) remain unchanged. Change-Id: Ifbed8202c6dbc63a1dae9acc03313980ffbbbb90 Reviewed-on: https://code.wireshark.org/review/13247 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
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-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-12-09new_create_dissector_handle -> create_dissector_handle for dissector directory.Michael Mann1-3/+3
Some of the ASN.1 dissectors still generate a new_create_dissector_handle from the tool itself, so leave those for now. Change-Id: Ic6e5803b1444d7ac24070949f5fd557909a5641f Reviewed-on: https://code.wireshark.org/review/12484 Petri-Dish: Anders Broman <a.broman58@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-13register_dissector -> new_register_dissectorMichael Mann1-4/+5
Picking off "easy" dissectors that only have one or two exit points at most. Change-Id: I3d5e576b796556ef070bb36d8b55da0b175dcba8 Reviewed-on: https://code.wireshark.org/review/11805 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-07-17Remove all preferences related to enabling/disabling heuristic dissectors.Michael Mann1-1/+1
The preferences are still supported for backwards compatibility, but the heuristic_protos file has final say on the "preference" to enable/disable a heuristic dissector. Also add parameter to heur_dissector_add() for the "default" enable/disable of a heuristic dissector. With this parameter, a few more (presumably weak) heuristic dissectors have been "registered" but of course default to being disabled. Change-Id: I51bebb2146ef3fbb8418d4f5c7f2cb2b58003a22 Reviewed-on: https://code.wireshark.org/review/9610 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-12Add "user presentable" and "unique string ids" to heuristic table entries.Michael Mann1-1/+1
This allows better presentation of heuristic dissectors to the end user. Change-Id: I2ff3985ab914e83c2989880cc0c7b9904045b3f6 Reviewed-on: https://code.wireshark.org/review/9602 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-04-16Replace deprecated tvb_length APIsAndersBroman1-5/+5
Change-Id: Idfd3bed012e823de544fe4de483c8f095fc7c65d Reviewed-on: https://code.wireshark.org/review/8086 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-04-04Add proper "Decode As" mechanism for EtherNet/IP I/O instead of preference.Michael Mann1-1/+5
Change-Id: I9d7c0f296176679b61d7ee0c4358ce409dfc4f4f Reviewed-on: https://code.wireshark.org/review/7895 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-22First batch of unincludes. Last attempt...Martin Mathieson1-1/+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-08-03Eliminate proto_tree_add_text from some dissectors.Michael Mann1-7/+11
Change-Id: I398e9cf4f6882e76644aa758e12c39a39159e95f Reviewed-on: https://code.wireshark.org/review/3319 Petri-Dish: Michael Mann <mmann78@netscape.net> Petri-Dish: Evan Huus <eapache@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-24convert to proto_tree_add_subtree[_format]Michael Mann1-31/+17
Change-Id: I5f573dffabb8685a8e5a334ff2bfb24d9838daa6 Reviewed-on: https://code.wireshark.org/review/2601 Tested-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-19Revert "Fixup: tvb_* -> tvb_captured"Michael Mann1-5/+5
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-5/+5
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-11-29Rename some of pint.h macros to match common style (bits number on the end).Jakub Zawadzki1-1/+1
pntohs -> pntoh16 pntohl -> pntoh32 pletohs -> pletoh16 pletohl -> pletoh32 phtons -> phton16 phtonl -> phton32 svn path=/trunk/; revision=53652
2013-11-23Create the ability to have packet scoped "proto" data. Bug 9470 ↵Michael Mann1-4/+4
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9470) I'm not sold on the name or module the proto_data functions live in, but I believe the function arguments are solid and gives us the most flexibility for the future. And search/replace of a function name is easy enough to do. The big driving force for getting this in sooner rather than later is the saved memory on ethernet packets (and IP packets soon), that used to have file_scope() proto data when all it needed was packet_scope() data (technically packet_info->pool scoped), strictly for Decode As. All dissectors that use p_add_proto_data() only for Decode As functionality have been converted to using packet_scope(). All other dissectors were converted to using file_scope() which was the original scope for "proto" data. svn path=/trunk/; revision=53520
2013-11-09include <wsutil/pint.h> only when needed.Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53196
2013-06-08Batch of filterable expert infos.Michael Mann1-45/+117
svn path=/trunk/; revision=49845
2013-05-12Add the posibillity to use a key for per-packet-data.Anders Broman1-4/+4
svn path=/trunk/; revision=49259
2013-03-15[-Wmissing-prototypes]Anders Broman1-0/+3
Use explicit casts. svn path=/trunk/; revision=48313
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-3/+1
svn path=/trunk/; revision=45017
2012-09-10Initial commit to support yet another method of passing data between dissectors.Jakub Zawadzki1-3/+3
Add new parameter 'data' to heur_dissector_t and new_dissector_t, for now it's always NULL svn path=/trunk/; revision=44860
2012-08-10Use val_to_str_const() where appropriate;Bill Meier1-2/+2
Also (for a few files): - create/use some extended value strings; - remove unneeded #include files; - remove unneeded variable initialization; - re-order fcns slightly so prefs_reg_handoff...() at end, etc svn path=/trunk/; revision=44438
2012-08-09 registered init routine action need be done just once in ↵Bill Meier1-8/+5
proto_reg_handoff...(); localize handle to proto_reg_handoff(); svn path=/trunk/; revision=44373
2012-06-28Update FSF address - part II.Jakub Zawadzki1-1/+1
svn path=/trunk/; revision=43538
2012-06-12Fix: code under 'if(tree)' (in)directly calls ↵Bill Meier1-21/+15
sub-dissector/col_...()/expert...() fcns svn path=/trunk/; revision=43226
2012-05-05Fix some more hf encodings.Jeff Morriss1-7/+7
svn path=/trunk/; revision=42434
2012-04-09Mark some function static.Jakub Zawadzki1-29/+29
svn path=/trunk/; revision=41999
2012-03-06Reformat long lines...Bill Meier1-397/+1088
svn path=/trunk/; revision=41384
2012-03-06Fix incorrect packet-details display of certain 1 bit FT_BOOLEAN fields.Bill Meier1-44/+44
Also: reformat a few lines. svn path=/trunk/; revision=41383
2012-03-06Don't use FT_BOOLEAN with value_strings: the code to generateJeff Morriss1-6/+4
representations of former is expecting true_false_strings--which are quite different than the latter. svn path=/trunk/; revision=41363
2012-03-06Don't use FT_*INT with true_false strings: the code to generateJeff Morriss1-3/+3
representations of former is expecting value_strings--which are quite different than the latter. svn path=/trunk/; revision=41361
2012-03-02Fix some Dead Store (Dead assignement/Dead increment) Warning found by ClangAlexis La Goutte1-1/+1
svn path=/trunk/; revision=41304
2012-03-02From Michael Mann via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6893 :Jeff Morriss1-60/+46
The attached patches fix the following issues: 1. CIP-Motion shouldn't be a heuristic dissector. CIP-Motion packets are determined by specific fields in a CIP ForwardOpen. I ran into situations where CIP-Motion's "vague" heuristics incorrectly dissected packets meant for CIP-Safety. Of course this requires the ForwardOpen to be in the trace, but it is the most deterministic way to have CIP-Motion packets. 2. Minor bugfix to the CIP-Safety dissector. A couple of fields were "missing", causing errant malformed packets. svn path=/trunk/; revision=41283
2012-02-27From Michael Mann:Anders Broman1-0/+1912
a dissector for the ODVA protocol: CIP Safety. More information about the protocol can be found here: http://www.odva.org/Home/ODVATECHNOLOGIES/CIP/CIPTechnologyOverview/CIPSafety/CIPSafetyOverview/tabid/131/lng/en-US/Default.aspx https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6862 svn path=/trunk/; revision=41201