Commit Graph

238 Commits

Author SHA1 Message Date
Joakim Wiberg 077a91a8c5 Added new ODVA specific TLV
Added new ODVA specific TLV that replaces an already existing
ODVA specific TLV that has been depredated.
2023-01-05 09:22:28 +00:00
Dylan Ulis d2e5bd80cb CIP: Minor cleanup/refactoring 2022-10-19 15:23:32 +00:00
Dylan Ulis 5f9d493640 CIP: Support object-specific services 2022-10-11 07:07:12 +00:00
David Perry 0e9e35cd29 Use `register_dissector()` for more protocols 2022-09-29 11:21:10 +00:00
Dylan Ulis 59909dfb5d CIP: Correct UTIME sub-seconds portion 2022-08-04 08:44:30 +00:00
Dylan Ulis c758e9d9c0 LLDP: Add CIP TLVs 2022-06-11 00:18:11 +00:00
Dylan Ulis 3aae474c49 CIP: Minor updates
1. Improve code documentation
2. Expose common variables,functions to let other dissectors to use them
2022-06-02 17:43:24 +00:00
Dylan Ulis e5e78d5da9 CIP Safety: Update more naming/units to match spec 2022-04-24 09:04:12 +00:00
Dylan Ulis 3c25b69ff6 CIP: Correct DATE, DATE_AND_TIME type handling, Part 2 2022-04-13 20:22:29 +00:00
Dylan Ulis 234db3b48f CIP Safety: Display human readable timestamps 2022-04-13 20:04:40 +00:00
Dylan Ulis 436abf4cf7 CIP: Show Attribute ID as decimal 2022-04-01 20:01:53 +00:00
Dylan Ulis f23a774819 CIP: Correct DATE type handling 2022-04-01 07:13:56 +00:00
Dylan Ulis f4703d4dcf CIP: Forward Close Req: Show connection parameters 2022-03-10 21:13:25 +00:00
João Valverde 8efad466c4 Tools: Fix fix-encoding-args.pl ASCII string validation
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 6ec429622c.
2022-02-15 11:38:16 +00:00
João Valverde 22ee2764a7 Replace g_snprintf() with snprintf() (dissectors)
Use macros from inttypes.h with format strings.
2021-12-19 20:25:11 +00:00
Evan Huus cdfab0d6e9 tvbuff: convert helper methods to pinfo->pool
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-09-01 03:54:52 +00:00
Martin Mathieson d3b016a365 Remove trailing colons from item label names
This is a new check added to check_typed_item_calls.py --label

Ignoring cases where item type is FT_NONE, as fpr tjpse
text was appended that otherwise would lack a colon.
2021-08-23 08:32:56 +00:00
Dylan Ulis 3c24694048 CIP: Match Connection ID from different fields 2021-08-04 19:34:11 +00:00
Dylan Ulis 3f9b0e36ea ENIP: Updates from latest spec
1. New EtherNet/IP commands and Common Packet Formats
2. CIP Security: Attributes (These go better in enip vs cip dissector)
3. TCP/IP object: Improve existing attribute parsing
4. Certificate Management Object: Attribute
5. Add units for some existing types
6. Correct hf_ size mismatch
2021-07-30 21:46:22 +00:00
Martin Mathieson 3b28d5219f Fix some copy-paste filter names.
Detected with tools/check_typed_item_calls.py --consecutive
2021-07-30 18:02:30 +01:00
Martin Mathieson d34d1a1e13 More fussing with masks.
Mostly longer masks with odd numbers of digits.
2021-07-29 10:15:58 +00:00
Dylan Ulis a1e05d09c6 CIP: Updates to match current specification
1. Connection Manager parameter is called 'Redundant Owner' instead of 'Exclusive'
2. Add new CIP Class Names
3. Support new time types: UTIME, STIME, NTIME
4. Add units to data type
2021-07-28 06:18:56 +00:00
João Valverde 133b0c583f Move epan/wmem/wmem_scopes.h to epan/
This header was installed incorrectly to epan/wmem_scopes.h.

Instead of creating additional installation rules for a single
header in a subfolder (kept for backward compatibility) just
rename the standard "epan/wmem/wmem.h" include to
"epan/wmem_scopes.h" and fix the documentation.

Now the header is installed *correctly* to epan/wmem_scopes.h.
2021-07-26 14:56:11 +00:00
João Valverde 8310665ae7 Normalize some dissector includes 2021-07-26 14:56:11 +00:00
Christian Fischer dd7639f64c packet-cip.c: Remove superfluous space in vendor name of cip_vendor_vals 2021-05-18 08:56:20 +00:00
Guy Harris 57a1514ac7 Cast away the return value of g_strlcpy() and g_strlcat().
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).
2021-04-30 03:19:19 -07:00
Chuck Craft cdf5f31454 cip: set hf_cip_cm_sc as generated field
Closes #17270
2021-03-06 15:17:23 +00:00
Martin Mathieson 11e919898c Set a few more dissector vars/funs to static.
These are the last of the easy ones to fix/set.
2021-02-15 09:20:58 +00:00
Martin Mathieson 0cf834f909 Make some more variables and functions static. 2021-02-14 19:42:01 +00:00
Martin Mathieson 08ab0e5d1f Fix some wrong filter names.
These were detected by running check_typed_item_calls.py
with --consecutive, which flags items that have different
labels but the same filter string.  Usually this is because
of copy/paste.

Quite a few similar bugs still exist, will address in a future commit.
2020-09-27 18:40:13 +00:00
Dylan Ulis 0e2cd329e3 CIP: Combine connection structs
Notes:
1. There are no functionality changes with this delivery
2. This change is to reduce manual copying between structs. This will make it easier to add upcoming feature changes, and fix some connection handling issues (future merge requests).
3. Combine enip_conn_val_t and cip_conn_info_t. Previously, there were 2 different structs to track information about an overall CIP Connection.
2020-08-27 19:56:13 -04:00
Dylan Ulis ba34033df4 CIP: Combine handling for cip_connID_info_t connections
Notes:
1. There are no functionality changes with this delivery
2. cip_connID_info_t describes a one-way connection. Each CIP Connection includes 2 of these. Previously, each operation was duplicated for each direction.
3. This change is to reduce copypaste, simplify logic, and make it easier to add upcoming feature changes, and fix some connection handling issues (future merge requests)

Changes:
1. Extract Method: get_conversation_info_one_direction
2. dissect_net_param16/dissect_net_param32: Parse and set data into cip_connID_info_t
2020-08-27 15:31:11 +00:00
Roland Knall b31a6aaae7 B&R - company naming
- refactoring of B&R specific company naming

Change-Id: Ic8533617f61f5bee009e1d00ebc323e00f28b3e8
Reviewed-on: https://code.wireshark.org/review/37851
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2020-07-14 08:47:16 +00:00
Guy Harris e1d9a226a2 Fix the type of arrays of pointers to hf_ values for bitfield routines.
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-06-19 11:32:26 +00:00
Dylan Ulis da8c28dc67 CIP Motion: Connection Configuration Data
1. Dissect the Motion Configuration Block from the Forward Open
2. Add Motion Attributes related to #1
3. Save the first/last segment for certain segment types in an EPATH.
Behavior changes based on the values in first segments for a given type,
vs later segments.

Change-Id: Id0552a585d158041c13adfa50f4bb164cada79b7
Reviewed-on: https://code.wireshark.org/review/37168
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-05-13 11:01:32 +00:00
Dylan Ulis 3a82774b32 CIP: Various Updates
1. Electronic Key Segment: Add support for Serial Number Key Format
2. Electronic Key Segment: Display more values in generated (response) output
3. Display Route/Connection Path in response data
4. Add more device types, class names
5. Minor display improvements to text strings, units for clarity

Change-Id: Ie7738cb395579674db448535474444da49b5b297
Reviewed-on: https://code.wireshark.org/review/37156
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2020-05-07 06:53:00 +00:00
Dylan Ulis ae2e83f2d8 CIP Safety: Change MacID to NodeID
This matches the wording in the Spec.

Change-Id: I566da78e88ff5aaa832c657dd74b5c590ee6b4aa
Reviewed-on: https://code.wireshark.org/review/36479
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-17 10:19:30 +00:00
Thomas Wiens 8e925238b0 Modbus: Unit and Transaction Id for request/response identification
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-08-24 06:35:56 +00:00
Dylan Ulis 6033e51733 CIP: Don't parse error responses as Success
Remove most cases where we were processing CI_GRC_SERVICE_ERROR as a
success condition.
Leave CI_GRC_SERVICE_ERROR in some cases where this may make sense, eg:
Modbus embedded messages may still want to be parsed as the embedded
format.

Bug: 15669
Change-Id: I44cae1ea8d3bacd6291a3118750f8a9e825de044
Reviewed-on: https://code.wireshark.org/review/32874
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-04-17 04:35:42 +00:00
Gerald Combs 8d3ac3af86 epan: Convert our PROTO_ITEM_ macros to inline functions.
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-04-04 04:03:38 +00:00
Dylan Ulis f2dc64e9b8 CIP: Fix false positive expert info
Some buffer size checking was off by 1.

Change-Id: Ib99da61f476b6f20abe40311fd2112a8693a7878
Reviewed-on: https://code.wireshark.org/review/31946
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-02-11 05:07:13 +00:00
Dylan Ulis ae394464df CIP: Improve API/RPI precision
1. Show 3 digits of precision after the decimal place for API/RPI when
displaying in ms.
2. Remove displaying the value as hex microseconds.

Change-Id: I483739c13ff0e02bd773b5207b41a5eec6c23289
Reviewed-on: https://code.wireshark.org/review/31583
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-18 06:08:11 +00:00
Dylan Ulis 75f9c95888 CIP: Add more objects
Add newer CIP objects

Change-Id: Ie1fcc219ee2d8abece8aaa9c4bbaade42f029ef9
Reviewed-on: https://code.wireshark.org/review/31568
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-17 13:09:44 +00:00
Dylan Ulis 56f988b125 CIP: Correct SSN to SNN
SNN = Safety Network Number

No functional/parsing changes.

Changes:
1. Fix some display fields and filter names that previously used the
incorrect ssn naming.
2. Changed all variable names in a similar way.

Change-Id: I7bdc52a5aef31a9c6007545d5a79c99bab6cd184
Reviewed-on: https://code.wireshark.org/review/31549
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-15 05:39:01 +00:00
Dylan Ulis e313b25359 CIP: Correct DATE_AND_TIME parsing
DATE_AND_TIME struct is actually time then date. We were previously
parsing it as date then time.

Change-Id: I7367b5502318de32b7c9e7fd170ae58de4c3347f
Reviewed-on: https://code.wireshark.org/review/31431
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-07 04:40:36 +00:00
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
Dylan Ulis ba25ec205f CIP: Minor code cleanup
dissect_cip_cm_data() was getting hard to read so:
1. Pull out some some logic into separate functions
    dissect_cip_cm_unconnected_send_req
    dissect_cip_cm_fwd_close_req
    dissect_cip_cm_fwd_close_rsp_success
2. Reduce the scope of some variables.

No functional changes

Change-Id: I40c3dd5d2505b29991589ede4752c383348006ec
Reviewed-on: https://code.wireshark.org/review/31051
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>
2018-12-15 07:43:21 +00:00
Dylan Ulis 11c4b31fc9 CIP: Show more unparsed data
Extra data could be an indicator of a problem, or it could be that we
haven't added support in Wireshark for it yet. Either way, it's helpful
to show it, instead of hiding it.

Changes:
1. Show unparsed data in the CIP CM dissector
2. Clean up some offsets

Change-Id: Ieebe208aab1f293f97a8774a6a4de5d5dbd3df67
Reviewed-on: https://code.wireshark.org/review/31003
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-11 04:42:47 +00:00
Dylan Ulis 39ac1a6694 CIP: Add Connection Index
Add cip.connection. This works just like tcp.stream, but for CIP
connections. This is added to CIP connected messages and the Forward
Open/Close messages.

Change-Id: Ib358c00dc0a4fd61065cb22b0e9b574ac43a44a4
Reviewed-on: https://code.wireshark.org/review/30984
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-10 14:42:31 +00:00
Dylan Ulis 5762fc617a CIP: Improve connected data information
1. For each connected data message, display generated connection
   information including:
    a. Connection Path from the initial connection
    b. API values
    c. Forward Open packet number. (This already existed, but moving it to a
       consistent place in the tree)
2. Display O->T or T->O in the Info column depending on the direction of data.
3. Remove cip.conn_path_class filter. This was originally added to show
   which type of data is in a given packet. But, it's not really needed
   anymore because we have the generated connection path in each connected
   data packet now.
4. Ensure dummy structs used for Decode As menus are zeroed out.
5. memset -> zero initialization

pcaps from the following bug reports are good examples:

Bug: 14939
Bug: 6617
Bug: 14916
Bug: 14958
Change-Id: I63885a5ca41f95e04f855a1e1dcd9ab3684f7eec
Reviewed-on: https://code.wireshark.org/review/30808
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-09 07:19:01 +00:00