aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/nettrace_3gpp_32_423.c
AgeCommit message (Collapse)AuthorFilesLines
2018-11-12wiretap: refactor common parameters for pcapng dump routinesPeter Wu1-1/+5
Four variants of wtap_dump_open_ng exists, each of them take the same three parameters for the SHB, IDB and NRB blocks that has to be written before packets are even written. Similarly, a lot of tools always create these arguments based on an existing capture file session (wth). Address the former duplication by creating a new data structure to hold the arguments. Address the second issue by creating new helper functions to initialize the parameters based on a wth. This refactoring should make it easier to add the new Decryption Secrets Block (DSB). No functional change intended. Change-Id: I42c019dc1d48a476773459212ca213de91a55684 Reviewed-on: https://code.wireshark.org/review/30578 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-09-24nettrace: Improve error printout at parse error.AndersBroman1-0/+4
Change-Id: I193301cb041ad2d513baa2806fd2168b95b17a3f Reviewed-on: https://code.wireshark.org/review/29804 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-16Eliminate some unneeded header checks.Guy Harris1-2/+0
sys/stat.h and sys/types.h date back to V7 UNIX, so they should be present on all UN*Xes, and we're assuming they're available on Windows, so, unless and until we ever support platforms that are neither UN*Xes nor Windows, we don't need to check for them. Remove the CMake checks for them, remove the HAVE_ values from cmakeconfig.h.in, and remove all tests for the HAVE_ values. Change-Id: I90bb2aab37958553673b03b52f4931d3b304b9d0 Reviewed-on: https://code.wireshark.org/review/27603 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-10nettrace: add g_assert in write_packet_data (CID 1435482).Dario Lombardo1-0/+2
proto_col_str could have been nulled by line 409, but in that case EXP_PDU_TAG_COL_PROT_BIT is not set, then strlen doesn't get called in line 432. Coverity raised a false positive and g_assert will pacify it. Change-Id: Ib22868a549319913c9c2a25ede0b63fed3af6eb0 Reviewed-on: https://code.wireshark.org/review/27424 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Dario Lombardo <lomato@gmail.com>
2018-05-05nettrace_3gpp_32_423: fix memleak and copy of uninitialized memoryPeter Wu1-10/+7
When protocol="map", but the name attribute value is invalid, a memleak occurs. Observe also that dissector_table_str is 22 bytes (21 characters plus nul) and rounding up to a multiple of 4 means that 2 bytes of uninitialized memory could be copied. Avoid that by copying the actual length. Memory leak was found by Clang Static Analyzer. Change-Id: I41f5b104449e108191e505611411a8fb18f1f5db Fixes: v2.1.0rc0-2545-g4b4c7a76c3 ("[Nettrace] Add parsing of some HSS records.") Reviewed-on: https://code.wireshark.org/review/27350 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-22nettrace: remove wrong frees (found by clang).Dario Lombardo1-3/+0
Change-Id: I5d8c81a4ebb89dfc6b6e9103a407cf24f1aa34d0 Reviewed-on: https://code.wireshark.org/review/25995 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-09Generalize wtap_pkthdr into a structure for packet and non-packet records.Guy Harris1-71/+70
Separate the stuff that any record could have from the stuff that only particular record types have; put the latter into a union, and put all that into a wtap_rec structure. Add some record-type checks as necessary. Change-Id: Id6b3486858f826fce4b096c59231f463e44bfaa2 Reviewed-on: https://code.wireshark.org/review/25696 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-08replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.Dario Lombardo1-1/+1
The first is deprecated, as per https://spdx.org/licenses/. Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed Reviewed-on: https://code.wireshark.org/review/25661 Petri-Dish: Anders Broman <a.broman58@gmail.com> Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-20wiretap: use SPDX identifiers (partial work).Dario Lombardo1-13/+1
Change-Id: I28436e003ce7fe31d53e6663f3cc7aca00845e4b Reviewed-on: https://code.wireshark.org/review/25392 Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-01-09Use pcapng as the name of the file format.Guy Harris1-1/+1
At one point, I remember a discussion resulting in the official name of the next-generation replacement for pcap format being changed to "pcapng", with no hyphen. Make Wireshark reflect that. Change-Id: Ie66fb13a0fe3a8682143106dab601952e9154e2a Reviewed-on: https://code.wireshark.org/review/25214 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-29"Hardcode" the port types used by Export PDU functionalityMichael Mann1-31/+34
The "internal" port type has been serialized by export PDU functionality and nettrace_3gpp_32_423 wiretap. To better support "endpoint" functionality the port types will be removed/updated and that changes the implicit values from the port_type enum. Take a snapshot of the current port_type values and use those specific values when reading/writing export PDU data and provide conversion functions that can be modified when port_types are removed. Do the same for nettrace_3gpp_32_423 wiretap. Change-Id: I770bd0cab22e84f3cf49032fc86c5927bf85263f Reviewed-on: https://code.wireshark.org/review/24169 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-09-26Rename "ws_version_info.h", also .cJoão Valverde1-1/+1
It's not installed so like most other files it doesn't need or benefit from the prefix. Change-Id: I01517e06f12b3101fee21b68cba3bc6842bbef5c Reviewed-on: https://code.wireshark.org/review/23751 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-06-05Allow bigger snapshot lengths for D-Bus captures.Guy Harris1-2/+2
Use WTAP_MAX_PACKET_SIZE_STANDARD, set to 256KB, for everything except for D-Bus captures. Use WTAP_MAX_PACKET_SIZE_DBUS, set to 128MB, for them, because that's the largest possible D-Bus message size. See https://bugs.freedesktop.org/show_bug.cgi?id=100220 for an example of the problems caused by limiting the snapshot length to 256KB for D-Bus. Have a snapshot length of 0 in a capture_file structure mean "there is no snapshot length for the file"; we don't need the has_snap field in that case, a value of 0 mean "no, we don't have a snapshot length". In dumpcap, start out with a pipe buffer size of 2KB, and grow it as necessary. When checking for a too-big packet from a pipe, check against the appropriate maximum - 128MB for DLT_DBUS, 256KB for everything else. Change-Id: Ib2ce7a0cf37b971fbc0318024fd011e18add8b20 Reviewed-on: https://code.wireshark.org/review/21952 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>
2017-06-03Don't keep the pcap/pcapng link-layer header type as interface data.Guy Harris1-1/+0
Either 1) it can be determined from the libwiretap encapsulation type, in which case it's redundant information or 2) there *is* no pcap/pcapng link-layer header type for that encapsulation type, in which case you need to check for the attempt to determine it failing and handle that failure appropriately. Change-Id: Ie9557b513365c1fc8c6df74b9c8239e29aad46bc Reviewed-on: https://code.wireshark.org/review/21924 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-26Ensure to have a valid string pointer when writing OS SHB optionPascal Quantin1-1/+6
Change-Id: Ib0b6dcdf1700e88383d30bf43739312fce10e1c7 Reviewed-on: https://code.wireshark.org/review/16696 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-07-26Fix some of the checkAPIs.pl warnings for g_warning.Michael Mann1-10/+10
1. Create ws_g_warning for legitimate uses of g_warning 2. Use proto_tree_add_debug_text 3. Comment some out Change-Id: Ida044bf40286b955fdd529c4f9907c8e09b3d7c5 Reviewed-on: https://code.wireshark.org/review/16678 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-14Redo the block options APIs.Guy Harris1-13/+13
A block can have zero or more instances of a given option. We distinguish between "one instance only" options, where a block can have zero or one instance, and "multiple instances allowed" options, where a block can have zero or more instances. For "one instance only" options: "add" routines add an instance if there isn't one already and fail if there is; "set" routines add an instance if there isn't one already and change the value of the existing instance if there is one; "set nth" routines fail; "get" routines return the value of the instance if there is one and fail if there isn't; "get nth" routines fail. For "multiple instances allowed" options: "add" routines add an instance; "set" routines fail; "set nth" routines set the value of the nth instance if there is one and fail otherwise; "get" routines fail; "get nth" routines get the value if the nth instance if there is one and fail otherwise. Rename "optionblock" to just "block"; it describes the contents of a block, including both mandatory items and options. Add some support for NRB options, including IPv4 and IPv6 option types. Change-Id: Iad184f668626c3d1498b2ed00c7f1672e4abf52e Reviewed-on: https://code.wireshark.org/review/16444 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-01Add data structures necessary to support multiple Section Header blocks.Michael Mann1-13/+12
This doesn't try to use any data from multiple Section Header blocks, it just converts single Section Header block usage into a GArray, so the potential is there to then use/support multiple Section Header blocks within a file format (like pcapng) Change-Id: I6ad1f7b8daf4b1ad7ba0eb1ecf2e170421505486 Reviewed-on: https://code.wireshark.org/review/15636 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-01Allow create_tempfile to support a suffix.Michael Mann1-1/+1
Ping-Bug: 10203 Change-Id: Ifa24870d711449b87e9839dd46af614e4aa28fde Reviewed-on: https://code.wireshark.org/review/15608 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2016-05-22Add wtap_optionblock_set_option_string_formatMichael Mann1-11/+11
Also add a length parameter to wtap_optionblock_set_option_string Change-Id: I8c7bbc48aa96b5c2a91ab9a17980928d6894f1ee Reviewed-on: https://code.wireshark.org/review/15505 Reviewed-by: Anthony Coddington <anthony.coddington@endace.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-21Link version code statically againJoão Valverde1-1/+1
This allows keeping the code-sharing with the static linking. This "fixes" a hypothetical ABI mismatch with wsutil and avoids pulling more external dependencies to wsutil than strictly necessary. A nice side-effect is that libwsutil no longer depends on version.h. Follow up to f95976eefcbeb5d24df383c29d29ef888b503945. Change-Id: I8f0d6a557ab3f7ce6f0e2c269124c89f29d6ad23 Reviewed-on: https://code.wireshark.org/review/15002 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-04-17Fix "2nd byte of optional tags bitmap" flag values.Guy Harris1-2/+2
The presence bits field isn't made up of multiple bytes, it's a single 32-bit field, so move the bit values up 8 bits so they don't collide with the values from the first byte. Prevents a crash with at least one 32.423 file. Change-Id: I804e76a5b8844f1f3894a43af7fd8bbe9fa7447c Reviewed-on: https://code.wireshark.org/review/14943 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-03-31[Nettrace] Add parsing of some HSS records.AndersBroman1-11/+138
Change-Id: I7c2f6ebdb20f90533ee008e1b4557ef27d4672dc Reviewed-on: https://code.wireshark.org/review/14708 Petri-Dish: Anders Broman <a.broman58@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-23Making wiretap option blocks more generic.Michael Mann1-38/+27
This was inspired by https://code.wireshark.org/review/9729/, but takes it in a different direction where all options are put into an array, regardless of whether they are "standard" or "custom". It should be easier to add "custom" options in this design. Some, but not all blocks have been converted. Descriptions of some of the block options have been moved from wtap.h to pcapng.h as it seems to be the one that implements the description of the blocks. Also what could be added/refactored is registering block behavior. Change-Id: I3dffa38f0bb088f98749a4f97a3b7655baa4aa6a Reviewed-on: https://code.wireshark.org/review/13667 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-13Assorted cleanups.Guy Harris1-13/+13
Fix indentation. Just directly assign values to elements in the packet buffer; no need to convert them to numbers and note the value as a comment. Give more detail in the comment for null-terminating buffers. Terminate packet_buf[] once we're finished reading into it, to make it a bit clearer what's being done. Make the magic number buffer 513 bytes, so we have 512 bytes plus a terminating null. Change-Id: Ie182d93393cc55835b24075e908393c386c85c24 Reviewed-on: https://code.wireshark.org/review/13250 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-13nettrace_3gpp_32_423 Protect from buffer overun.AndersBroman1-1/+5
Bug: 11982 Change-Id: Ib704d9128ab6427751edbf3a33f4b8fd14902562 Reviewed-on: https://code.wireshark.org/review/13233 Reviewed-by: Anders Broman <a.broman58@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-26Scan pcapng change time to unsignedJoão Valverde1-1/+2
Fixes warning: nettrace_3gpp_32_423.c:813:4: warning: format '%u' expects argument of type 'unsigned int *', but argument 3 has type 'int *' [-Wformat=] Change-Id: I4bfcc19ecac115d5aa2e222dfed8ea8b0b450d71 Reviewed-on: https://code.wireshark.org/review/12211 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-26Add a check for the day of the month.Guy Harris1-2/+18
Also, fix the month check ("month" is in the range 1 through 12, not 0 through 11), and if neither sscanf() gets the right number of fields, fail immediately. Change-Id: I3f0da49e969c020c292facb843b9741116647302 Reviewed-on: https://code.wireshark.org/review/12170 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-26Most fields in an ISO 8601 date/time are unsigned.Guy Harris1-3/+36
Add some bounds checks while we're at it. Change-Id: I19804aee10496fd68f95a27865f8f455d3abbe9f Reviewed-on: https://code.wireshark.org/review/12166 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-10-26[Nettrace] Port can have 5 characters.AndersBroman1-2/+2
Change-Id: Id09967378165b23358b4787e6ab96db42c41d2fd Reviewed-on: https://code.wireshark.org/review/11288 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-10-26Nettrace 3GPP 32.423: Fix Dead Store (Dead assignement/Dead increment) ↵Alexis La Goutte1-2/+0
warning found by Clang Change-Id: I721bb77fd95f02cd6795c09e780622575d031920 Reviewed-on: https://code.wireshark.org/review/11282 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-10-23[Nettrace] Add parsing of IP addresses and ports.AndersBroman1-58/+407
Change-Id: I4e2988edd9b5f75f7b104c8daddd1510bf1fc722 Reviewed-on: https://code.wireshark.org/review/11209 Petri-Dish: Anders Broman <a.broman58@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-10-20[Nettrace] Parse timestamps and add to individual packets.AndersBroman1-12/+92
Change-Id: I4a84f19011ef0e02836c84dff665b6fcadbf59ae Reviewed-on: https://code.wireshark.org/review/11180 Petri-Dish: Anders Broman <a.broman58@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-21Fix memory leaks of dumper SHB and IDB infosHadriel Kaplan1-25/+32
Change-Id: I6b81d3e853d503c6a81f9793957b48ab34c6808c Reviewed-on: https://code.wireshark.org/review/10156 Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-09[wiretap/nettrace_3gpp_32_423] Add editor modelinesBill Meier1-0/+13
Change-Id: Ie2b9da2b3a08d18fc913a00cf076aa881a583552 Reviewed-on: https://code.wireshark.org/review/9949 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-08-06Pcapng: support Name Resolution Block optionsHadriel Kaplan1-1/+2
Make pcapng decode options in an NRB during read, and store the comment option, and write it back out as well. Also make it handle plugin handlers for unknown options in received NRB(s). Change-Id: I81863ef8d85cb1c8b5ba6673ba0e562efe77714f Reviewed-on: https://code.wireshark.org/review/9723 Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-07-27nettrace3gpp324423: fix name consistencyLuke Mewburn1-1/+1
Improve consistency when referring to 3GPP TS 32.423: - The standard name is "3GPP TS 32.423" (with "TS", and "." separator). - Fix typo in number series ("32" not "34"). - The standard refers to "Trace", not "Nettrace". Change-Id: If9994b9c6de69b6e1bdfc6679fbaabe698971949 Reviewed-on: https://code.wireshark.org/review/9795 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: Anders Broman <a.broman58@gmail.com>
2015-05-04nettrace 3GPP: Fix Dead Store (Dead assignement/Dead increment) warning ↵Alexis La Goutte1-1/+0
found by Clang Change-Id: Ie94165a45d9af23eee6e4d6406ad6fba4de785c0 Reviewed-on: https://code.wireshark.org/review/8281 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-04-30[nettrace_3gpp_32_423] Fix nettrace_3gpp_32_423.c:292: warning:AndersBroman1-3/+3
declaration of 'random' shadows a global declaration. Change-Id: I2dde89a3f0e5abb3b8acc3c7d09e1a0d53a6c0f7 Reviewed-on: https://code.wireshark.org/review/8245 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-04-30Add the abillity to read 3GPP trace records with format accoding toAndersBroman1-0/+544
TS 32 423(XML) Change-Id: I37895ec35797089a32c7d1695e735046d6aa979e Reviewed-on: https://code.wireshark.org/review/8237 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>